Bug 1546364 - Reformat to Google coding style in ldap/. rs=reformat
authorJorg K <jorgk@jorgk.com>
Wed, 24 Apr 2019 00:27:10 +0200
changeset 34309 0c50a354ca18dd895b9f6d4e1a19a1780927e21f
parent 34308 506e8bcb98739cf13ae0db2257e2e33f25496c2a
child 34310 27ccda1bf87f796f2f7088c408497ee1cc6162f1
push id2407
push userclokep@gmail.com
push dateMon, 20 May 2019 17:11:26 +0000
treeherdercomm-beta@193428fd6fd4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersreformat
bugs1546364
Bug 1546364 - Reformat to Google coding style in ldap/. rs=reformat # ignore-this-changeset
ldap/c-sdk/include/disptmpl.h
ldap/c-sdk/include/iutil.h
ldap/c-sdk/include/lber.h
ldap/c-sdk/include/lcache.h
ldap/c-sdk/include/ldap-deprecated.h
ldap/c-sdk/include/ldap-extension.h
ldap/c-sdk/include/ldap-platform.h
ldap/c-sdk/include/ldap-standard.h
ldap/c-sdk/include/ldap-to-be-deprecated.h
ldap/c-sdk/include/ldap.h
ldap/c-sdk/include/ldap_ssl.h
ldap/c-sdk/include/ldaplog.h
ldap/c-sdk/include/ldappr.h
ldap/c-sdk/include/ldaprot.h
ldap/c-sdk/include/ldif.h
ldap/c-sdk/include/portable.h
ldap/c-sdk/include/proto-ntutil.h
ldap/c-sdk/include/regex.h
ldap/c-sdk/include/srchpref.h
ldap/c-sdk/libraries/liblber/bprint.c
ldap/c-sdk/libraries/liblber/decode.c
ldap/c-sdk/libraries/liblber/dtest.c
ldap/c-sdk/libraries/liblber/encode.c
ldap/c-sdk/libraries/liblber/etest.c
ldap/c-sdk/libraries/liblber/idtest.c
ldap/c-sdk/libraries/liblber/io.c
ldap/c-sdk/libraries/liblber/lber-int.h
ldap/c-sdk/libraries/libldap/abandon.c
ldap/c-sdk/libraries/libldap/add.c
ldap/c-sdk/libraries/libldap/authzidctrl.c
ldap/c-sdk/libraries/libldap/bind.c
ldap/c-sdk/libraries/libldap/cache.c
ldap/c-sdk/libraries/libldap/charray.c
ldap/c-sdk/libraries/libldap/charset.c
ldap/c-sdk/libraries/libldap/cldap.c
ldap/c-sdk/libraries/libldap/compare.c
ldap/c-sdk/libraries/libldap/compat.c
ldap/c-sdk/libraries/libldap/control.c
ldap/c-sdk/libraries/libldap/countvalues.c
ldap/c-sdk/libraries/libldap/delete.c
ldap/c-sdk/libraries/libldap/disptmpl.c
ldap/c-sdk/libraries/libldap/dllmain.c
ldap/c-sdk/libraries/libldap/dsparse.c
ldap/c-sdk/libraries/libldap/error.c
ldap/c-sdk/libraries/libldap/extendop.c
ldap/c-sdk/libraries/libldap/free.c
ldap/c-sdk/libraries/libldap/freevalues.c
ldap/c-sdk/libraries/libldap/friendly.c
ldap/c-sdk/libraries/libldap/getattr.c
ldap/c-sdk/libraries/libldap/getdn.c
ldap/c-sdk/libraries/libldap/getdxbyname.c
ldap/c-sdk/libraries/libldap/geteffectiverightsctrl.c
ldap/c-sdk/libraries/libldap/getentry.c
ldap/c-sdk/libraries/libldap/getfilter.c
ldap/c-sdk/libraries/libldap/getoption.c
ldap/c-sdk/libraries/libldap/getvalues.c
ldap/c-sdk/libraries/libldap/ldap-int.h
ldap/c-sdk/libraries/libldap/memcache.c
ldap/c-sdk/libraries/libldap/message.c
ldap/c-sdk/libraries/libldap/modify.c
ldap/c-sdk/libraries/libldap/mozock.c
ldap/c-sdk/libraries/libldap/nsprthreadtest.c
ldap/c-sdk/libraries/libldap/open.c
ldap/c-sdk/libraries/libldap/os-ip.c
ldap/c-sdk/libraries/libldap/proxyauthctrl.c
ldap/c-sdk/libraries/libldap/psearch.c
ldap/c-sdk/libraries/libldap/pthreadtest.c
ldap/c-sdk/libraries/libldap/pwmodext.c
ldap/c-sdk/libraries/libldap/pwpctrl.c
ldap/c-sdk/libraries/libldap/referral.c
ldap/c-sdk/libraries/libldap/regex.c
ldap/c-sdk/libraries/libldap/rename.c
ldap/c-sdk/libraries/libldap/request.c
ldap/c-sdk/libraries/libldap/reslist.c
ldap/c-sdk/libraries/libldap/result.c
ldap/c-sdk/libraries/libldap/saslbind.c
ldap/c-sdk/libraries/libldap/saslio.c
ldap/c-sdk/libraries/libldap/sbind.c
ldap/c-sdk/libraries/libldap/search.c
ldap/c-sdk/libraries/libldap/setoption.c
ldap/c-sdk/libraries/libldap/sort.c
ldap/c-sdk/libraries/libldap/sortctrl.c
ldap/c-sdk/libraries/libldap/srchpref.c
ldap/c-sdk/libraries/libldap/test.c
ldap/c-sdk/libraries/libldap/tmplout.c
ldap/c-sdk/libraries/libldap/tmpltest.c
ldap/c-sdk/libraries/libldap/ufn.c
ldap/c-sdk/libraries/libldap/unbind.c
ldap/c-sdk/libraries/libldap/unescape.c
ldap/c-sdk/libraries/libldap/url.c
ldap/c-sdk/libraries/libldap/userstatusctrl.c
ldap/c-sdk/libraries/libldap/utf8.c
ldap/c-sdk/libraries/libldap/vlistctrl.c
ldap/c-sdk/libraries/libldap/whoami.c
ldap/c-sdk/libraries/libldif/line64.c
ldap/c-sdk/libraries/libprldap/ldappr-dns.c
ldap/c-sdk/libraries/libprldap/ldappr-error.c
ldap/c-sdk/libraries/libprldap/ldappr-int.h
ldap/c-sdk/libraries/libprldap/ldappr-io.c
ldap/c-sdk/libraries/libprldap/ldappr-public.c
ldap/c-sdk/libraries/libprldap/ldappr-threads.c
ldap/xpcom/src/nsLDAPBERElement.cpp
ldap/xpcom/src/nsLDAPBERElement.h
ldap/xpcom/src/nsLDAPBERValue.cpp
ldap/xpcom/src/nsLDAPBERValue.h
ldap/xpcom/src/nsLDAPConnection.cpp
ldap/xpcom/src/nsLDAPConnection.h
ldap/xpcom/src/nsLDAPControl.cpp
ldap/xpcom/src/nsLDAPControl.h
ldap/xpcom/src/nsLDAPInternal.h
ldap/xpcom/src/nsLDAPMessage.cpp
ldap/xpcom/src/nsLDAPMessage.h
ldap/xpcom/src/nsLDAPModification.cpp
ldap/xpcom/src/nsLDAPModification.h
ldap/xpcom/src/nsLDAPOperation.cpp
ldap/xpcom/src/nsLDAPOperation.h
ldap/xpcom/src/nsLDAPProtocolModule.cpp
ldap/xpcom/src/nsLDAPSecurityGlue.cpp
ldap/xpcom/src/nsLDAPServer.cpp
ldap/xpcom/src/nsLDAPServer.h
ldap/xpcom/src/nsLDAPService.cpp
ldap/xpcom/src/nsLDAPService.h
ldap/xpcom/src/nsLDAPSyncQuery.cpp
ldap/xpcom/src/nsLDAPSyncQuery.h
ldap/xpcom/src/nsLDAPURL.cpp
ldap/xpcom/src/nsLDAPURL.h
ldap/xpcom/src/nsLDAPUtils.h
--- a/ldap/c-sdk/include/disptmpl.h
+++ b/ldap/c-sdk/include/disptmpl.h
@@ -45,335 +45,321 @@
  * may not be used to endorse or promote products derived from this
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  *
  * disptmpl.h:  display template library defines
  */
 
 #ifndef _DISPTMPL_H
-#define _DISPTMPL_H
+#  define _DISPTMPL_H
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 extern "C" {
-#endif
+#  endif
 
 /* calling conventions used by library */
-#ifndef LDAP_CALL
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#define LDAP_C __cdecl
-#ifndef _WIN32
-#define __stdcall _far _pascal
-#define LDAP_CALLBACK _loadds
-#else
-#define LDAP_CALLBACK
-#endif /* _WIN32 */
-#define LDAP_PASCAL __stdcall
-#define LDAP_CALL LDAP_PASCAL
-#else /* _WINDOWS */
-#define LDAP_C
-#define LDAP_CALLBACK
-#define LDAP_PASCAL
-#define LDAP_CALL
-#endif /* _WINDOWS */
-#endif /* LDAP_CALL */
+#  ifndef LDAP_CALL
+#    if defined(_WINDOWS) || defined(_WIN32)
+#      define LDAP_C __cdecl
+#      ifndef _WIN32
+#        define __stdcall _far _pascal
+#        define LDAP_CALLBACK _loadds
+#      else
+#        define LDAP_CALLBACK
+#      endif /* _WIN32 */
+#      define LDAP_PASCAL __stdcall
+#      define LDAP_CALL LDAP_PASCAL
+#    else /* _WINDOWS */
+#      define LDAP_C
+#      define LDAP_CALLBACK
+#      define LDAP_PASCAL
+#      define LDAP_CALL
+#    endif /* _WINDOWS */
+#  endif   /* LDAP_CALL */
 
-#define LDAP_TEMPLATE_VERSION 1
+#  define LDAP_TEMPLATE_VERSION 1
 
 /*
  * general types of items (confined to most significant byte)
  */
-#define LDAP_SYN_TYPE_TEXT    0x01000000L
-#define LDAP_SYN_TYPE_IMAGE   0x02000000L
-#define LDAP_SYN_TYPE_BOOLEAN 0x04000000L
-#define LDAP_SYN_TYPE_BUTTON  0x08000000L
-#define LDAP_SYN_TYPE_ACTION  0x10000000L
-
+#  define LDAP_SYN_TYPE_TEXT 0x01000000L
+#  define LDAP_SYN_TYPE_IMAGE 0x02000000L
+#  define LDAP_SYN_TYPE_BOOLEAN 0x04000000L
+#  define LDAP_SYN_TYPE_BUTTON 0x08000000L
+#  define LDAP_SYN_TYPE_ACTION 0x10000000L
 
 /*
  * syntax options (confined to second most significant byte)
  */
-#define LDAP_SYN_OPT_DEFER 0x00010000L
-
+#  define LDAP_SYN_OPT_DEFER 0x00010000L
 
 /*
  * display template item syntax ids (defined by common agreement)
  * these are the valid values for the ti_syntaxid of the tmplitem
  * struct (defined below).  A general type is encoded in the
  * most-significant 8 bits, and some options are encoded in the next
  * 8 bits.  The lower 16 bits are reserved for the distinct types.
  */
-#define LDAP_SYN_CASEIGNORESTR  ( 1 | LDAP_SYN_TYPE_TEXT )
-#define LDAP_SYN_MULTILINESTR   ( 2 | LDAP_SYN_TYPE_TEXT )
-#define LDAP_SYN_DN             ( 3 | LDAP_SYN_TYPE_TEXT )
-#define LDAP_SYN_BOOLEAN        ( 4 | LDAP_SYN_TYPE_BOOLEAN )
-#define LDAP_SYN_JPEGIMAGE      ( 5 | LDAP_SYN_TYPE_IMAGE )
-#define LDAP_SYN_JPEGBUTTON     ( 6 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER )
-#define LDAP_SYN_FAXIMAGE       ( 7 | LDAP_SYN_TYPE_IMAGE )
-#define LDAP_SYN_FAXBUTTON      ( 8 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER )
-#define LDAP_SYN_AUDIOBUTTON    ( 9 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER )
-#define LDAP_SYN_TIME           ( 10 | LDAP_SYN_TYPE_TEXT )
-#define LDAP_SYN_DATE           ( 11 | LDAP_SYN_TYPE_TEXT )
-#define LDAP_SYN_LABELEDURL     ( 12 | LDAP_SYN_TYPE_TEXT )
-#define LDAP_SYN_SEARCHACTION   ( 13 | LDAP_SYN_TYPE_ACTION )
-#define LDAP_SYN_LINKACTION     ( 14 | LDAP_SYN_TYPE_ACTION )
-#define LDAP_SYN_ADDDNACTION    ( 15 | LDAP_SYN_TYPE_ACTION )
-#define LDAP_SYN_VERIFYDNACTION ( 16 | LDAP_SYN_TYPE_ACTION )
-#define LDAP_SYN_RFC822ADDR     ( 17 | LDAP_SYN_TYPE_TEXT )
-
+#  define LDAP_SYN_CASEIGNORESTR (1 | LDAP_SYN_TYPE_TEXT)
+#  define LDAP_SYN_MULTILINESTR (2 | LDAP_SYN_TYPE_TEXT)
+#  define LDAP_SYN_DN (3 | LDAP_SYN_TYPE_TEXT)
+#  define LDAP_SYN_BOOLEAN (4 | LDAP_SYN_TYPE_BOOLEAN)
+#  define LDAP_SYN_JPEGIMAGE (5 | LDAP_SYN_TYPE_IMAGE)
+#  define LDAP_SYN_JPEGBUTTON (6 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER)
+#  define LDAP_SYN_FAXIMAGE (7 | LDAP_SYN_TYPE_IMAGE)
+#  define LDAP_SYN_FAXBUTTON (8 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER)
+#  define LDAP_SYN_AUDIOBUTTON (9 | LDAP_SYN_TYPE_BUTTON | LDAP_SYN_OPT_DEFER)
+#  define LDAP_SYN_TIME (10 | LDAP_SYN_TYPE_TEXT)
+#  define LDAP_SYN_DATE (11 | LDAP_SYN_TYPE_TEXT)
+#  define LDAP_SYN_LABELEDURL (12 | LDAP_SYN_TYPE_TEXT)
+#  define LDAP_SYN_SEARCHACTION (13 | LDAP_SYN_TYPE_ACTION)
+#  define LDAP_SYN_LINKACTION (14 | LDAP_SYN_TYPE_ACTION)
+#  define LDAP_SYN_ADDDNACTION (15 | LDAP_SYN_TYPE_ACTION)
+#  define LDAP_SYN_VERIFYDNACTION (16 | LDAP_SYN_TYPE_ACTION)
+#  define LDAP_SYN_RFC822ADDR (17 | LDAP_SYN_TYPE_TEXT)
 
 /*
  * handy macros
  */
-#define LDAP_GET_SYN_TYPE( syid )    ((syid) & 0xFF000000UL )
-#define LDAP_GET_SYN_OPTIONS( syid ) ((syid) & 0x00FF0000UL )
-
+#  define LDAP_GET_SYN_TYPE(syid) ((syid)&0xFF000000UL)
+#  define LDAP_GET_SYN_OPTIONS(syid) ((syid)&0x00FF0000UL)
 
 /*
  * display options for output routines (used by entry2text and friends)
  */
 /*
  * use calculated label width (based on length of longest label in
  * template) instead of constant width
  */
-#define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001L
-#define LDAP_DISP_OPT_HTMLBODYONLY   0x00000002L
+#  define LDAP_DISP_OPT_AUTOLABELWIDTH 0x00000001L
+#  define LDAP_DISP_OPT_HTMLBODYONLY 0x00000002L
 
 /*
  * perform search actions (applies to ldap_entry2text_search only)
  */
-#define LDAP_DISP_OPT_DOSEARCHACTIONS 0x00000002L
+#  define LDAP_DISP_OPT_DOSEARCHACTIONS 0x00000002L
 
 /*
  * include additional info. relevant to "non leaf" entries only
  * used by ldap_entry2html and ldap_entry2html_search to include "Browse"
  * and "Move Up" HREFs
  */
-#define LDAP_DISP_OPT_NONLEAF 0x00000004L
-
+#  define LDAP_DISP_OPT_NONLEAF 0x00000004L
 
 /*
  * display template item options (may not apply to all types)
  * if this bit is set in ti_options, it applies.
  */
-#define LDAP_DITEM_OPT_READONLY      0x00000001L
-#define LDAP_DITEM_OPT_SORTVALUES    0x00000002L
-#define LDAP_DITEM_OPT_SINGLEVALUED  0x00000004L
-#define LDAP_DITEM_OPT_HIDEIFEMPTY   0x00000008L
-#define LDAP_DITEM_OPT_VALUEREQUIRED 0x00000010L
-#define LDAP_DITEM_OPT_HIDEIFFALSE   0x00000020L  /* booleans only */
-
-
+#  define LDAP_DITEM_OPT_READONLY 0x00000001L
+#  define LDAP_DITEM_OPT_SORTVALUES 0x00000002L
+#  define LDAP_DITEM_OPT_SINGLEVALUED 0x00000004L
+#  define LDAP_DITEM_OPT_HIDEIFEMPTY 0x00000008L
+#  define LDAP_DITEM_OPT_VALUEREQUIRED 0x00000010L
+#  define LDAP_DITEM_OPT_HIDEIFFALSE 0x00000020L /* booleans only */
 
 /*
  * display template item structure
  */
 struct ldap_tmplitem {
-    unsigned long ti_syntaxid;
-    unsigned long ti_options;
-    char *ti_attrname;
-    char *ti_label;
-    char **ti_args;
-    struct ldap_tmplitem *ti_next_in_row;
-    struct ldap_tmplitem *ti_next_in_col;
-    void *ti_appdata;
+  unsigned long ti_syntaxid;
+  unsigned long ti_options;
+  char *ti_attrname;
+  char *ti_label;
+  char **ti_args;
+  struct ldap_tmplitem *ti_next_in_row;
+  struct ldap_tmplitem *ti_next_in_col;
+  void *ti_appdata;
 };
 
-
-#define NULLTMPLITEM ((struct ldap_tmplitem *)0)
+#  define NULLTMPLITEM ((struct ldap_tmplitem *)0)
 
-#define LDAP_SET_TMPLITEM_APPDATA( ti, datap ) \
-  (ti)->ti_appdata = (void *)(datap)
+#  define LDAP_SET_TMPLITEM_APPDATA(ti, datap) \
+    (ti)->ti_appdata = (void *)(datap)
 
-#define LDAP_GET_TMPLITEM_APPDATA( ti, type ) \
-  (type)((ti)->ti_appdata)
+#  define LDAP_GET_TMPLITEM_APPDATA(ti, type) (type)((ti)->ti_appdata)
 
-#define LDAP_IS_TMPLITEM_OPTION_SET( ti, option ) \
-  (((ti)->ti_options & option ) != 0 )
-
+#  define LDAP_IS_TMPLITEM_OPTION_SET(ti, option) \
+    (((ti)->ti_options & option) != 0)
 
 /*
  * object class array structure
  */
 struct ldap_oclist {
-    char **oc_objclasses;
-    struct ldap_oclist *oc_next;
+  char **oc_objclasses;
+  struct ldap_oclist *oc_next;
 };
 
-#define NULLOCLIST ((struct ldap_oclist *)0)
-
+#  define NULLOCLIST ((struct ldap_oclist *)0)
 
 /*
  * add defaults list
  */
 struct ldap_adddeflist {
-    int ad_source;
-#define LDAP_ADSRC_CONSTANTVALUE 1
-#define LDAP_ADSRC_ADDERSDN 2
-    char *ad_attrname;
-    char *ad_value;
-    struct ldap_adddeflist *ad_next;
+  int ad_source;
+#  define LDAP_ADSRC_CONSTANTVALUE 1
+#  define LDAP_ADSRC_ADDERSDN 2
+  char *ad_attrname;
+  char *ad_value;
+  struct ldap_adddeflist *ad_next;
 };
 
-#define NULLADLIST ((struct ldap_adddeflist *)0)
-
+#  define NULLADLIST ((struct ldap_adddeflist *)0)
 
 /*
  * display template global options
  * if this bit is set in dt_options, it applies.
  */
 /*
  * users should be allowed to try to add objects of these entries
  */
-#define LDAP_DTMPL_OPT_ADDABLE 0x00000001L
+#  define LDAP_DTMPL_OPT_ADDABLE 0x00000001L
 
 /*
  * users should be allowed to do "modify RDN" operation of these entries
  */
-#define LDAP_DTMPL_OPT_ALLOWMODRDN 0x00000002L
+#  define LDAP_DTMPL_OPT_ALLOWMODRDN 0x00000002L
 
 /*
  * this template is an alternate view, not a primary view
  */
-#define LDAP_DTMPL_OPT_ALTVIEW 0x00000004L
-
+#  define LDAP_DTMPL_OPT_ALTVIEW 0x00000004L
 
 /*
  * display template structure
  */
 struct ldap_disptmpl {
-    char *dt_name;
-    char *dt_pluralname;
-    char *dt_iconname;
-    unsigned long dt_options;
-    char *dt_authattrname;
-    char *dt_defrdnattrname;
-    char *dt_defaddlocation;
-    struct ldap_oclist *dt_oclist;
-    struct ldap_adddeflist *dt_adddeflist;
-    struct ldap_tmplitem *dt_items;
-    void *dt_appdata;
-    struct ldap_disptmpl *dt_next;
+  char *dt_name;
+  char *dt_pluralname;
+  char *dt_iconname;
+  unsigned long dt_options;
+  char *dt_authattrname;
+  char *dt_defrdnattrname;
+  char *dt_defaddlocation;
+  struct ldap_oclist *dt_oclist;
+  struct ldap_adddeflist *dt_adddeflist;
+  struct ldap_tmplitem *dt_items;
+  void *dt_appdata;
+  struct ldap_disptmpl *dt_next;
 };
 
-#define NULLDISPTMPL ((struct ldap_disptmpl *)0)
+#  define NULLDISPTMPL ((struct ldap_disptmpl *)0)
 
-#define LDAP_SET_DISPTMPL_APPDATA( dt, datap ) \
-  (dt)->dt_appdata = (void *)(datap)
+#  define LDAP_SET_DISPTMPL_APPDATA(dt, datap) \
+    (dt)->dt_appdata = (void *)(datap)
 
-#define LDAP_GET_DISPTMPL_APPDATA( dt, type ) \
-  (type)((dt)->dt_appdata)
+#  define LDAP_GET_DISPTMPL_APPDATA(dt, type) (type)((dt)->dt_appdata)
 
-#define LDAP_IS_DISPTMPL_OPTION_SET( dt, option ) \
-  (((dt)->dt_options & option ) != 0 )
+#  define LDAP_IS_DISPTMPL_OPTION_SET(dt, option) \
+    (((dt)->dt_options & option) != 0)
 
-#define LDAP_TMPL_ERR_VERSION 1
-#define LDAP_TMPL_ERR_MEM 2
-#define LDAP_TMPL_ERR_SYNTAX 3
-#define LDAP_TMPL_ERR_FILE 4
+#  define LDAP_TMPL_ERR_VERSION 1
+#  define LDAP_TMPL_ERR_MEM 2
+#  define LDAP_TMPL_ERR_SYNTAX 3
+#  define LDAP_TMPL_ERR_FILE 4
 
 /*
  * buffer size needed for entry2text and vals2text
  */
-#define LDAP_DTMPL_BUFSIZ 8192
+#  define LDAP_DTMPL_BUFSIZ 8192
 
-typedef int (*writeptype)( void *writeparm, char *p, int len );
+typedef int (*writeptype)(void *writeparm, char *p, int len);
 
 LDAP_API(int)
 LDAP_CALL
-ldap_init_templates( char *file, struct ldap_disptmpl **tmpllistp );
+ldap_init_templates(char *file, struct ldap_disptmpl **tmpllistp);
 
 LDAP_API(int)
 LDAP_CALL
-ldap_init_templates_buf( char *buf, long buflen,
-  struct ldap_disptmpl **tmpllistp );
+ldap_init_templates_buf(char *buf, long buflen,
+                        struct ldap_disptmpl **tmpllistp);
 
 LDAP_API(void)
 LDAP_CALL
-ldap_free_templates( struct ldap_disptmpl *tmpllist );
+ldap_free_templates(struct ldap_disptmpl *tmpllist);
 
 LDAP_API(struct ldap_disptmpl *)
 LDAP_CALL
-ldap_first_disptmpl( struct ldap_disptmpl *tmpllist );
+ldap_first_disptmpl(struct ldap_disptmpl *tmpllist);
 
 LDAP_API(struct ldap_disptmpl *)
 LDAP_CALL
-ldap_next_disptmpl( struct ldap_disptmpl *tmpllist,
-  struct ldap_disptmpl *tmpl );
+ldap_next_disptmpl(struct ldap_disptmpl *tmpllist, struct ldap_disptmpl *tmpl);
 
 LDAP_API(struct ldap_disptmpl *)
 LDAP_CALL
-ldap_name2template( char *name, struct ldap_disptmpl *tmpllist );
+ldap_name2template(char *name, struct ldap_disptmpl *tmpllist);
 
 LDAP_API(struct ldap_disptmpl *)
 LDAP_CALL
-ldap_oc2template( char **oclist, struct ldap_disptmpl *tmpllist );
+ldap_oc2template(char **oclist, struct ldap_disptmpl *tmpllist);
 
 LDAP_API(char **)
 LDAP_CALL
-ldap_tmplattrs( struct ldap_disptmpl *tmpl, char **includeattrs, int exclude,
-   unsigned long syntaxmask );
+ldap_tmplattrs(struct ldap_disptmpl *tmpl, char **includeattrs, int exclude,
+               unsigned long syntaxmask);
 
 LDAP_API(struct ldap_tmplitem *)
 LDAP_CALL
-ldap_first_tmplrow( struct ldap_disptmpl *tmpl );
+ldap_first_tmplrow(struct ldap_disptmpl *tmpl);
 
 LDAP_API(struct ldap_tmplitem *)
 LDAP_CALL
-ldap_next_tmplrow( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row );
+ldap_next_tmplrow(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row);
+
+LDAP_API(struct ldap_tmplitem *)
+LDAP_CALL
+ldap_first_tmplcol(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row);
 
 LDAP_API(struct ldap_tmplitem *)
 LDAP_CALL
-ldap_first_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row );
-
-LDAP_API(struct ldap_tmplitem *)
-LDAP_CALL
-ldap_next_tmplcol( struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row,
-  struct ldap_tmplitem *col );
+ldap_next_tmplcol(struct ldap_disptmpl *tmpl, struct ldap_tmplitem *row,
+                  struct ldap_tmplitem *col);
 
 LDAP_API(int)
 LDAP_CALL
-ldap_entry2text( LDAP *ld, char *buf, LDAPMessage *entry,
-  struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
-  writeptype writeproc, void *writeparm, char *eol, int rdncount,
-  unsigned long opts );
+ldap_entry2text(LDAP *ld, char *buf, LDAPMessage *entry,
+                struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
+                writeptype writeproc, void *writeparm, char *eol, int rdncount,
+                unsigned long opts);
 
 LDAP_API(int)
 LDAP_CALL
-ldap_vals2text( LDAP *ld, char *buf, char **vals, char *label, int labelwidth,
-  unsigned long syntaxid, writeptype writeproc, void *writeparm,
-  char *eol, int rdncount );
+ldap_vals2text(LDAP *ld, char *buf, char **vals, char *label, int labelwidth,
+               unsigned long syntaxid, writeptype writeproc, void *writeparm,
+               char *eol, int rdncount);
+
+LDAP_API(int)
+LDAP_CALL
+ldap_entry2text_search(LDAP *ld, char *dn, char *base, LDAPMessage *entry,
+                       struct ldap_disptmpl *tmpllist, char **defattrs,
+                       char ***defvals, writeptype writeproc, void *writeparm,
+                       char *eol, int rdncount, unsigned long opts);
 
 LDAP_API(int)
 LDAP_CALL
-ldap_entry2text_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry,
-  struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
-  writeptype writeproc, void *writeparm, char *eol, int rdncount,
-  unsigned long opts );
+ldap_entry2html(LDAP *ld, char *buf, LDAPMessage *entry,
+                struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
+                writeptype writeproc, void *writeparm, char *eol, int rdncount,
+                unsigned long opts, char *urlprefix, char *base);
 
 LDAP_API(int)
 LDAP_CALL
-ldap_entry2html( LDAP *ld, char *buf, LDAPMessage *entry,
-  struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
-  writeptype writeproc, void *writeparm, char *eol, int rdncount,
-  unsigned long opts, char *urlprefix, char *base );
+ldap_vals2html(LDAP *ld, char *buf, char **vals, char *label, int labelwidth,
+               unsigned long syntaxid, writeptype writeproc, void *writeparm,
+               char *eol, int rdncount, char *urlprefix);
 
 LDAP_API(int)
 LDAP_CALL
-ldap_vals2html( LDAP *ld, char *buf, char **vals, char *label, int labelwidth,
-  unsigned long syntaxid, writeptype writeproc, void *writeparm,
-  char *eol, int rdncount, char *urlprefix );
-
-LDAP_API(int)
-LDAP_CALL
-ldap_entry2html_search( LDAP *ld, char *dn, char *base, LDAPMessage *entry,
-  struct ldap_disptmpl *tmpllist, char **defattrs, char ***defvals,
-  writeptype writeproc, void *writeparm, char *eol, int rdncount,
-  unsigned long opts, char *urlprefix );
+ldap_entry2html_search(LDAP *ld, char *dn, char *base, LDAPMessage *entry,
+                       struct ldap_disptmpl *tmpllist, char **defattrs,
+                       char ***defvals, writeptype writeproc, void *writeparm,
+                       char *eol, int rdncount, unsigned long opts,
+                       char *urlprefix);
 
 LDAP_API(char *)
 LDAP_CALL
-ldap_tmplerr2string( int err );
+ldap_tmplerr2string(int err);
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 }
-#endif
+#  endif
 #endif /* _DISPTMPL_H */
--- a/ldap/c-sdk/include/iutil.h
+++ b/ldap/c-sdk/include/iutil.h
@@ -45,28 +45,28 @@
 
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
 /* from iutil-lock.c */
 
 #ifdef _WINDOWS
-#define LDAP_MUTEX_T HANDLE
+#  define LDAP_MUTEX_T HANDLE
 
 extern char *ldap_strdup();
 extern unsigned char *ldap_utf8_nextchar();
 extern char **ldap_explode_ava();
 extern int ldap_utf8_toupper();
 
-int pthread_mutex_init( LDAP_MUTEX_T *mp, void *attr);
-static void  * pthread_mutex_alloc( void );
-int pthread_mutex_destroy( LDAP_MUTEX_T *mp );
-static void pthread_mutex_free( void *mutexp );
-int pthread_mutex_lock( LDAP_MUTEX_T *mp );
-int pthread_mutex_unlock( LDAP_MUTEX_T *mp );
+int pthread_mutex_init(LDAP_MUTEX_T *mp, void *attr);
+static void *pthread_mutex_alloc(void);
+int pthread_mutex_destroy(LDAP_MUTEX_T *mp);
+static void pthread_mutex_free(void *mutexp);
+int pthread_mutex_lock(LDAP_MUTEX_T *mp);
+int pthread_mutex_unlock(LDAP_MUTEX_T *mp);
 
 #endif /* _WINDOWS */
 
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 #endif /* _IUTIL_H */
--- a/ldap/c-sdk/include/lber.h
+++ b/ldap/c-sdk/include/lber.h
@@ -31,309 +31,310 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 /* lber.h - header file for ber_* functions */
 #ifndef _LBER_H
-#define _LBER_H
+#  define _LBER_H
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 extern "C" {
-#endif
+#  endif
 
-#include <stdlib.h>  /* to pick up size_t typedef */
+#  include <stdlib.h> /* to pick up size_t typedef */
 
 /*
  * Note that LBER_ERROR and LBER_DEFAULT are values that can never appear
  * as valid BER tags, and so it is safe to use them to report errors.  In
  * fact, any tag for which the following is true is invalid:
  *     (( tag & 0x00000080 ) != 0 ) && (( tag & 0xFFFFFF00 ) != 0 )
  */
-#define LBER_ERROR              ((ber_tag_t) -1) /* 0xffffffffU */
-#define LBER_DEFAULT            ((ber_tag_t) -1) /* 0xffffffffU */
-#define LBER_END_OF_SEQORSET    ((ber_tag_t) -2) /* 0xfffffffeU */
-#define LBER_OVERFLOW           ((ber_tag_t) -3) /* 0xfffffffdU */
+#  define LBER_ERROR ((ber_tag_t)-1)           /* 0xffffffffU */
+#  define LBER_DEFAULT ((ber_tag_t)-1)         /* 0xffffffffU */
+#  define LBER_END_OF_SEQORSET ((ber_tag_t)-2) /* 0xfffffffeU */
+#  define LBER_OVERFLOW ((ber_tag_t)-3)        /* 0xfffffffdU */
 
 /* BER classes and mask */
-#define LBER_CLASS_UNIVERSAL    0x00
-#define LBER_CLASS_APPLICATION  0x40
-#define LBER_CLASS_CONTEXT      0x80
-#define LBER_CLASS_PRIVATE      0xc0
-#define LBER_CLASS_MASK         0xc0
+#  define LBER_CLASS_UNIVERSAL 0x00
+#  define LBER_CLASS_APPLICATION 0x40
+#  define LBER_CLASS_CONTEXT 0x80
+#  define LBER_CLASS_PRIVATE 0xc0
+#  define LBER_CLASS_MASK 0xc0
 
 /* BER encoding type and mask */
-#define LBER_PRIMITIVE          0x00
-#define LBER_CONSTRUCTED        0x20
-#define LBER_ENCODING_MASK      0x20
+#  define LBER_PRIMITIVE 0x00
+#  define LBER_CONSTRUCTED 0x20
+#  define LBER_ENCODING_MASK 0x20
 
-#define LBER_BIG_TAG_MASK       0x1f
-#define LBER_MORE_TAG_MASK      0x80
+#  define LBER_BIG_TAG_MASK 0x1f
+#  define LBER_MORE_TAG_MASK 0x80
 
 /* general BER types we know about */
-#define LBER_BOOLEAN     0x01
-#define LBER_INTEGER     0x02
-#define LBER_BITSTRING   0x03
-#define LBER_OCTETSTRING 0x04
-#define LBER_NULL        0x05
-#define LBER_ENUMERATED  0x0a
-#define LBER_SEQUENCE    0x30
-#define LBER_SET         0x31
+#  define LBER_BOOLEAN 0x01
+#  define LBER_INTEGER 0x02
+#  define LBER_BITSTRING 0x03
+#  define LBER_OCTETSTRING 0x04
+#  define LBER_NULL 0x05
+#  define LBER_ENUMERATED 0x0a
+#  define LBER_SEQUENCE 0x30
+#  define LBER_SET 0x31
 
 /* BerElement set/get options */
-#define LBER_OPT_REMAINING_BYTES   0x01
-#define LBER_OPT_TOTAL_BYTES       0x02
-#define LBER_OPT_USE_DER           0x04
-#define LBER_OPT_TRANSLATE_STRINGS 0x08
-#define LBER_OPT_BYTES_TO_WRITE    0x10
-#define LBER_OPT_MEMALLOC_FN_PTRS  0x20
-#define LBER_OPT_DEBUG_LEVEL       0x40
-#define LBER_OPT_BUFSIZE           0x80
+#  define LBER_OPT_REMAINING_BYTES 0x01
+#  define LBER_OPT_TOTAL_BYTES 0x02
+#  define LBER_OPT_USE_DER 0x04
+#  define LBER_OPT_TRANSLATE_STRINGS 0x08
+#  define LBER_OPT_BYTES_TO_WRITE 0x10
+#  define LBER_OPT_MEMALLOC_FN_PTRS 0x20
+#  define LBER_OPT_DEBUG_LEVEL 0x40
+#  define LBER_OPT_BUFSIZE 0x80
 
 /*
  * LBER_USE_DER is defined for compatibility with the C LDAP API RFC.
  * In our implementation, we recognize it (instead of the numerically
  * identical LBER_OPT_REMAINING_BYTES) in calls to ber_alloc_t() and
  * ber_init_w_nullchar() only.  Callers of ber_set_option() or
  * ber_get_option() must use LBER_OPT_USE_DER instead.  Sorry!
  */
-#define LBER_USE_DER 0x01
+#  define LBER_USE_DER 0x01
 
 /* Sockbuf set/get options */
-#define LBER_SOCKBUF_OPT_TO_FILE           0x001
-#define LBER_SOCKBUF_OPT_TO_FILE_ONLY      0x002
-#define LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE 0x004
-#define LBER_SOCKBUF_OPT_NO_READ_AHEAD     0x008
-#define LBER_SOCKBUF_OPT_DESC              0x010
-#define LBER_SOCKBUF_OPT_COPYDESC          0x020
-#define LBER_SOCKBUF_OPT_READ_FN           0x040
-#define LBER_SOCKBUF_OPT_WRITE_FN          0x080
-#define LBER_SOCKBUF_OPT_EXT_IO_FNS        0x100
-#define LBER_SOCKBUF_OPT_VALID_TAG         0x200
-#define LBER_SOCKBUF_OPT_SOCK_ARG          0x400
+#  define LBER_SOCKBUF_OPT_TO_FILE 0x001
+#  define LBER_SOCKBUF_OPT_TO_FILE_ONLY 0x002
+#  define LBER_SOCKBUF_OPT_MAX_INCOMING_SIZE 0x004
+#  define LBER_SOCKBUF_OPT_NO_READ_AHEAD 0x008
+#  define LBER_SOCKBUF_OPT_DESC 0x010
+#  define LBER_SOCKBUF_OPT_COPYDESC 0x020
+#  define LBER_SOCKBUF_OPT_READ_FN 0x040
+#  define LBER_SOCKBUF_OPT_WRITE_FN 0x080
+#  define LBER_SOCKBUF_OPT_EXT_IO_FNS 0x100
+#  define LBER_SOCKBUF_OPT_VALID_TAG 0x200
+#  define LBER_SOCKBUF_OPT_SOCK_ARG 0x400
 
-#define LBER_OPT_ON ((void *) 1)
-#define LBER_OPT_OFF ((void *) 0)
+#  define LBER_OPT_ON ((void *)1)
+#  define LBER_OPT_OFF ((void *)0)
 
-typedef unsigned int ber_len_t;   /* for BER len */
-typedef unsigned int ber_tag_t;   /* for BER tags */
-typedef int ber_int_t;            /* for BER ints, enums, and Booleans */
-typedef unsigned int ber_uint_t;  /* unsigned equivalent of ber_int_t */
-typedef int ber_slen_t;           /* signed equivalent of ber_len_t */
+typedef unsigned int ber_len_t;  /* for BER len */
+typedef unsigned int ber_tag_t;  /* for BER tags */
+typedef int ber_int_t;           /* for BER ints, enums, and Booleans */
+typedef unsigned int ber_uint_t; /* unsigned equivalent of ber_int_t */
+typedef int ber_slen_t;          /* signed equivalent of ber_len_t */
 
 typedef struct berval {
   ber_len_t bv_len;
   char *bv_val;
 } BerValue;
 
 typedef struct berelement BerElement;
 typedef struct sockbuf Sockbuf;
-typedef int (*BERTranslateProc)( char **bufp, ber_uint_t *buflenp,
-  int free_input );
-#ifndef macintosh
-#if defined( _WINDOWS ) || defined( _WIN32) || defined( _CONSOLE )
-#include <winsock.h> /* for SOCKET */
+typedef int (*BERTranslateProc)(char **bufp, ber_uint_t *buflenp,
+                                int free_input);
+#  ifndef macintosh
+#    if defined(_WINDOWS) || defined(_WIN32) || defined(_CONSOLE)
+#      include <winsock.h> /* for SOCKET */
 typedef SOCKET LBER_SOCKET;
-#else
+#    else
 typedef long LBER_SOCKET;
-#endif /* _WINDOWS */
-#else /* macintosh */
+#    endif /* _WINDOWS */
+#  else    /* macintosh */
 typedef void *LBER_SOCKET;
-#endif /* macintosh */
+#  endif   /* macintosh */
 
 /* calling conventions used by library */
-#ifndef LDAP_CALL
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#define LDAP_C __cdecl
-#ifndef _WIN32
-#define __stdcall _far _pascal
-#define LDAP_CALLBACK _loadds
-#else
-#define LDAP_CALLBACK
-#endif /* _WIN32 */
-#define LDAP_PASCAL __stdcall
-#define LDAP_CALL LDAP_PASCAL
-#else /* _WINDOWS */
-#define LDAP_C
-#define LDAP_CALLBACK
-#define LDAP_PASCAL
-#define LDAP_CALL
-#endif /* _WINDOWS */
-#endif /* LDAP_CALL */
+#  ifndef LDAP_CALL
+#    if defined(_WINDOWS) || defined(_WIN32)
+#      define LDAP_C __cdecl
+#      ifndef _WIN32
+#        define __stdcall _far _pascal
+#        define LDAP_CALLBACK _loadds
+#      else
+#        define LDAP_CALLBACK
+#      endif /* _WIN32 */
+#      define LDAP_PASCAL __stdcall
+#      define LDAP_CALL LDAP_PASCAL
+#    else /* _WINDOWS */
+#      define LDAP_C
+#      define LDAP_CALLBACK
+#      define LDAP_PASCAL
+#      define LDAP_CALL
+#    endif /* _WINDOWS */
+#  endif   /* LDAP_CALL */
 
 /*
  * function prototypes for lber library
  */
 
-#ifndef LDAP_API
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#define LDAP_API(rt) rt
-#else /* _WINDOWS */
-#define LDAP_API(rt) rt
-#endif /* _WINDOWS */
-#endif /* LDAP_API */
+#  ifndef LDAP_API
+#    if defined(_WINDOWS) || defined(_WIN32)
+#      define LDAP_API(rt) rt
+#    else /* _WINDOWS */
+#      define LDAP_API(rt) rt
+#    endif /* _WINDOWS */
+#  endif   /* LDAP_API */
 
-struct lextiof_socket_private;          /* Defined by the extended I/O */
-                                        /* callback functions */
-struct lextiof_session_private;         /* Defined by the extended I/O */
-                                        /* callback functions */
+struct lextiof_socket_private;  /* Defined by the extended I/O */
+                                /* callback functions */
+struct lextiof_session_private; /* Defined by the extended I/O */
+                                /* callback functions */
 
 /* This is modeled after the PRIOVec that is passed to the NSPR
    writev function! The void* is a char* in that struct */
 typedef struct ldap_x_iovec {
   char *ldapiov_base;
-  int  ldapiov_len;
+  int ldapiov_len;
 } ldap_x_iovec;
 
 /*
  * libldap read and write I/O function callbacks.  The rest of the I/O callback
  * types are defined in ldap.h
  */
-typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_READ_CALLBACK)( LBER_SOCKET s,
-  void *buf, int bufsize );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_WRITE_CALLBACK)( LBER_SOCKET s,
-  const void *buf, int len );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_READ_CALLBACK)( int s,
-  void *buf, int bufsize, struct lextiof_socket_private *socketarg );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_WRITE_CALLBACK)( int s,
-  const void *buf, int len, struct lextiof_socket_private *socketarg );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_WRITEV_CALLBACK)(int s,
-  const ldap_x_iovec iov[], int iovcnt, struct lextiof_socket_private *socketarg);
-
+typedef int(LDAP_C LDAP_CALLBACK LDAP_IOF_READ_CALLBACK)(LBER_SOCKET s,
+                                                         void *buf,
+                                                         int bufsize);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_IOF_WRITE_CALLBACK)(LBER_SOCKET s,
+                                                          const void *buf,
+                                                          int len);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_READ_CALLBACK)(
+    int s, void *buf, int bufsize, struct lextiof_socket_private *socketarg);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_WRITE_CALLBACK)(
+    int s, const void *buf, int len, struct lextiof_socket_private *socketarg);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_WRITEV_CALLBACK)(
+    int s, const ldap_x_iovec iov[], int iovcnt,
+    struct lextiof_socket_private *socketarg);
 
 /*
  * Structure for use with LBER_SOCKBUF_OPT_EXT_IO_FNS:
  */
 struct lber_x_ext_io_fns {
   /* lbextiofn_size should always be set to LBER_X_EXTIO_FNS_SIZE */
   int lbextiofn_size;
   LDAP_X_EXTIOF_READ_CALLBACK *lbextiofn_read;
   LDAP_X_EXTIOF_WRITE_CALLBACK *lbextiofn_write;
   struct lextiof_socket_private *lbextiofn_socket_arg;
   LDAP_X_EXTIOF_WRITEV_CALLBACK *lbextiofn_writev;
 };
-#define LBER_X_EXTIO_FNS_SIZE sizeof(struct lber_x_ext_io_fns)
+#  define LBER_X_EXTIO_FNS_SIZE sizeof(struct lber_x_ext_io_fns)
 
 /*
  * liblber memory allocation callback functions.  These are global to all
  *  Sockbufs and BerElements.  Install your own functions by using a call
  *  like this: ber_set_option( NULL, LBER_OPT_MEMALLOC_FN_PTRS, &memalloc_fns );
  */
-typedef void * (LDAP_C LDAP_CALLBACK LDAP_MALLOC_CALLBACK)( size_t size );
-typedef void * (LDAP_C LDAP_CALLBACK LDAP_CALLOC_CALLBACK)( size_t nelem,
-  size_t elsize );
-typedef void * (LDAP_C LDAP_CALLBACK LDAP_REALLOC_CALLBACK)( void *ptr,
-  size_t size );
-typedef void (LDAP_C LDAP_CALLBACK LDAP_FREE_CALLBACK)( void *ptr );
+typedef void *(LDAP_C LDAP_CALLBACK LDAP_MALLOC_CALLBACK)(size_t size);
+typedef void *(LDAP_C LDAP_CALLBACK LDAP_CALLOC_CALLBACK)(size_t nelem,
+                                                          size_t elsize);
+typedef void *(LDAP_C LDAP_CALLBACK LDAP_REALLOC_CALLBACK)(void *ptr,
+                                                           size_t size);
+typedef void(LDAP_C LDAP_CALLBACK LDAP_FREE_CALLBACK)(void *ptr);
 
 struct lber_memalloc_fns {
   LDAP_MALLOC_CALLBACK *lbermem_malloc;
   LDAP_CALLOC_CALLBACK *lbermem_calloc;
   LDAP_REALLOC_CALLBACK *lbermem_realloc;
   LDAP_FREE_CALLBACK *lbermem_free;
 };
 
 /*
  * decode routines
  */
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_tag( BerElement *ber );
-LDAP_API(ber_tag_t) LDAP_CALL ber_skip_tag( BerElement *ber,
-  ber_len_t *len );
-LDAP_API(ber_tag_t) LDAP_CALL ber_peek_tag( BerElement *ber,
-  ber_len_t *len );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_int( BerElement *ber, ber_int_t *num );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_stringb( BerElement *ber, char *buf,
-  ber_len_t *len );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_stringa( BerElement *ber,
-  char **buf );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_stringal( BerElement *ber,
-  struct berval **bv );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_bitstringa( BerElement *ber,
-  char **buf, ber_len_t *len );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_null( BerElement *ber );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_boolean( BerElement *ber,
-  ber_int_t *boolval );
-LDAP_API(ber_tag_t) LDAP_CALL ber_first_element( BerElement *ber,
-  ber_len_t *len, char **last );
-LDAP_API(ber_tag_t) LDAP_CALL ber_next_element( BerElement *ber,
-  ber_len_t *len, char *last );
-LDAP_API(ber_tag_t) LDAP_C ber_scanf( BerElement *ber, const char *fmt,
-  ... );
-LDAP_API(void) LDAP_CALL ber_bvfree( struct berval *bv );
-LDAP_API(void) LDAP_CALL ber_bvecfree( struct berval **bv );
-LDAP_API(void) LDAP_CALL ber_svecfree( char **vals );
-LDAP_API(struct berval *) LDAP_CALL ber_bvdup( const struct berval *bv );
-LDAP_API(void) LDAP_CALL ber_set_string_translators( BerElement *ber,
-  BERTranslateProc encode_proc, BERTranslateProc decode_proc );
-LDAP_API(BerElement *) LDAP_CALL ber_init( const struct berval *bv );
+LDAP_API(ber_tag_t) LDAP_CALL ber_get_tag(BerElement *ber);
+LDAP_API(ber_tag_t) LDAP_CALL ber_skip_tag(BerElement *ber, ber_len_t *len);
+LDAP_API(ber_tag_t) LDAP_CALL ber_peek_tag(BerElement *ber, ber_len_t *len);
+LDAP_API(ber_tag_t) LDAP_CALL ber_get_int(BerElement *ber, ber_int_t *num);
+LDAP_API(ber_tag_t)
+LDAP_CALL ber_get_stringb(BerElement *ber, char *buf, ber_len_t *len);
+LDAP_API(ber_tag_t) LDAP_CALL ber_get_stringa(BerElement *ber, char **buf);
+LDAP_API(ber_tag_t)
+LDAP_CALL ber_get_stringal(BerElement *ber, struct berval **bv);
+LDAP_API(ber_tag_t)
+LDAP_CALL ber_get_bitstringa(BerElement *ber, char **buf, ber_len_t *len);
+LDAP_API(ber_tag_t) LDAP_CALL ber_get_null(BerElement *ber);
+LDAP_API(ber_tag_t)
+LDAP_CALL ber_get_boolean(BerElement *ber, ber_int_t *boolval);
+LDAP_API(ber_tag_t)
+LDAP_CALL ber_first_element(BerElement *ber, ber_len_t *len, char **last);
+LDAP_API(ber_tag_t)
+LDAP_CALL ber_next_element(BerElement *ber, ber_len_t *len, char *last);
+LDAP_API(ber_tag_t) LDAP_C ber_scanf(BerElement *ber, const char *fmt, ...);
+LDAP_API(void) LDAP_CALL ber_bvfree(struct berval *bv);
+LDAP_API(void) LDAP_CALL ber_bvecfree(struct berval **bv);
+LDAP_API(void) LDAP_CALL ber_svecfree(char **vals);
+LDAP_API(struct berval *) LDAP_CALL ber_bvdup(const struct berval *bv);
+LDAP_API(void)
+LDAP_CALL
+    ber_set_string_translators(BerElement *ber, BERTranslateProc encode_proc,
+                               BERTranslateProc decode_proc);
+LDAP_API(BerElement *) LDAP_CALL ber_init(const struct berval *bv);
 
 /*
  * encoding routines
  */
-LDAP_API(int) LDAP_CALL ber_put_enum( BerElement *ber, ber_int_t num,
-  ber_tag_t tag );
-LDAP_API(int) LDAP_CALL ber_put_int( BerElement *ber, ber_int_t num,
-  ber_tag_t tag );
-LDAP_API(int) LDAP_CALL ber_put_ostring( BerElement *ber, char *str,
-  ber_len_t len, ber_tag_t tag );
-LDAP_API(int) LDAP_CALL ber_put_string( BerElement *ber, char *str,
-  ber_tag_t tag );
-LDAP_API(int) LDAP_CALL ber_put_bitstring( BerElement *ber, char *str,
-  ber_len_t bitlen, ber_tag_t tag );
-LDAP_API(int) LDAP_CALL ber_put_null( BerElement *ber, ber_tag_t tag );
-LDAP_API(int) LDAP_CALL ber_put_boolean( BerElement *ber,
-  ber_int_t boolval, ber_tag_t tag );
-LDAP_API(int) LDAP_CALL ber_start_seq( BerElement *ber, ber_tag_t tag );
-LDAP_API(int) LDAP_CALL ber_start_set( BerElement *ber, ber_tag_t tag );
-LDAP_API(int) LDAP_CALL ber_put_seq( BerElement *ber );
-LDAP_API(int) LDAP_CALL ber_put_set( BerElement *ber );
-LDAP_API(int) LDAP_C ber_printf( BerElement *ber, const char *fmt, ... );
-LDAP_API(int) LDAP_CALL ber_flatten( BerElement *ber,
-  struct berval **bvPtr );
+LDAP_API(int)
+LDAP_CALL ber_put_enum(BerElement *ber, ber_int_t num, ber_tag_t tag);
+LDAP_API(int)
+LDAP_CALL ber_put_int(BerElement *ber, ber_int_t num, ber_tag_t tag);
+LDAP_API(int)
+LDAP_CALL
+    ber_put_ostring(BerElement *ber, char *str, ber_len_t len, ber_tag_t tag);
+LDAP_API(int)
+LDAP_CALL ber_put_string(BerElement *ber, char *str, ber_tag_t tag);
+LDAP_API(int)
+LDAP_CALL ber_put_bitstring(BerElement *ber, char *str, ber_len_t bitlen,
+                            ber_tag_t tag);
+LDAP_API(int) LDAP_CALL ber_put_null(BerElement *ber, ber_tag_t tag);
+LDAP_API(int)
+LDAP_CALL ber_put_boolean(BerElement *ber, ber_int_t boolval, ber_tag_t tag);
+LDAP_API(int) LDAP_CALL ber_start_seq(BerElement *ber, ber_tag_t tag);
+LDAP_API(int) LDAP_CALL ber_start_set(BerElement *ber, ber_tag_t tag);
+LDAP_API(int) LDAP_CALL ber_put_seq(BerElement *ber);
+LDAP_API(int) LDAP_CALL ber_put_set(BerElement *ber);
+LDAP_API(int) LDAP_C ber_printf(BerElement *ber, const char *fmt, ...);
+LDAP_API(int) LDAP_CALL ber_flatten(BerElement *ber, struct berval **bvPtr);
 
 /*
  * miscellaneous routines
  */
-LDAP_API(void) LDAP_CALL ber_free( BerElement *ber, int freebuf );
-LDAP_API(void) LDAP_CALL ber_special_free(void* buf, BerElement *ber);
-LDAP_API(int) LDAP_CALL ber_flush( Sockbuf *sb, BerElement *ber, int freeit );
-LDAP_API(BerElement*) LDAP_CALL ber_alloc( void );
-LDAP_API(BerElement*) LDAP_CALL der_alloc( void );
-LDAP_API(BerElement*) LDAP_CALL ber_alloc_t( int options );
-LDAP_API(void*) LDAP_CALL ber_special_alloc(size_t size, BerElement **ppBer);
-LDAP_API(BerElement*) LDAP_CALL ber_dup( BerElement *ber );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_next( Sockbuf *sb, ber_len_t *len,
-  BerElement *ber );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_next_buffer( void *buffer,
-  size_t buffer_size, ber_len_t *len, BerElement *ber,
-  ber_len_t *Bytes_Scanned );
-LDAP_API(ber_tag_t) LDAP_CALL ber_get_next_buffer_ext( void *buffer,
-  size_t buffer_size, ber_len_t *len, BerElement *ber,
-  ber_len_t *Bytes_Scanned, Sockbuf *sb );
-LDAP_API(ber_int_t) LDAP_CALL ber_read( BerElement *ber, char *buf,
-  ber_len_t len );
-LDAP_API(ber_int_t) LDAP_CALL ber_write( BerElement *ber, char *buf,
-  ber_len_t len, int nosos );
-LDAP_API(void) LDAP_CALL ber_init_w_nullchar( BerElement *ber, int options );
-LDAP_API(void) LDAP_CALL ber_reset( BerElement *ber, int was_writing );
-LDAP_API(size_t) LDAP_CALL ber_get_buf_datalen( BerElement *ber );
-LDAP_API(int) LDAP_CALL ber_stack_init(BerElement *ber, int options,
-  char * buf, size_t size);
-LDAP_API(char*) LDAP_CALL ber_get_buf_databegin (BerElement * ber);
+LDAP_API(void) LDAP_CALL ber_free(BerElement *ber, int freebuf);
+LDAP_API(void) LDAP_CALL ber_special_free(void *buf, BerElement *ber);
+LDAP_API(int) LDAP_CALL ber_flush(Sockbuf *sb, BerElement *ber, int freeit);
+LDAP_API(BerElement *) LDAP_CALL ber_alloc(void);
+LDAP_API(BerElement *) LDAP_CALL der_alloc(void);
+LDAP_API(BerElement *) LDAP_CALL ber_alloc_t(int options);
+LDAP_API(void *) LDAP_CALL ber_special_alloc(size_t size, BerElement **ppBer);
+LDAP_API(BerElement *) LDAP_CALL ber_dup(BerElement *ber);
+LDAP_API(ber_tag_t)
+LDAP_CALL ber_get_next(Sockbuf *sb, ber_len_t *len, BerElement *ber);
+LDAP_API(ber_tag_t)
+LDAP_CALL ber_get_next_buffer(void *buffer, size_t buffer_size, ber_len_t *len,
+                              BerElement *ber, ber_len_t *Bytes_Scanned);
+LDAP_API(ber_tag_t)
+LDAP_CALL ber_get_next_buffer_ext(void *buffer, size_t buffer_size,
+                                  ber_len_t *len, BerElement *ber,
+                                  ber_len_t *Bytes_Scanned, Sockbuf *sb);
+LDAP_API(ber_int_t)
+LDAP_CALL ber_read(BerElement *ber, char *buf, ber_len_t len);
+LDAP_API(ber_int_t)
+LDAP_CALL ber_write(BerElement *ber, char *buf, ber_len_t len, int nosos);
+LDAP_API(void) LDAP_CALL ber_init_w_nullchar(BerElement *ber, int options);
+LDAP_API(void) LDAP_CALL ber_reset(BerElement *ber, int was_writing);
+LDAP_API(size_t) LDAP_CALL ber_get_buf_datalen(BerElement *ber);
+LDAP_API(int)
+LDAP_CALL ber_stack_init(BerElement *ber, int options, char *buf, size_t size);
+LDAP_API(char *) LDAP_CALL ber_get_buf_databegin(BerElement *ber);
 LDAP_API(void) LDAP_CALL ber_sockbuf_free_data(Sockbuf *p);
-LDAP_API(int) LDAP_CALL ber_set_option( BerElement *ber, int option,
-  void *value );
-LDAP_API(int) LDAP_CALL ber_get_option( BerElement *ber, int option,
-  void *value );
-LDAP_API(Sockbuf*) LDAP_CALL ber_sockbuf_alloc( void );
-LDAP_API(void) LDAP_CALL ber_sockbuf_free( Sockbuf* p );
-LDAP_API(int) LDAP_CALL ber_sockbuf_set_option( Sockbuf *sb, int option,
-  void *value );
-LDAP_API(int) LDAP_CALL ber_sockbuf_get_option( Sockbuf *sb, int option,
-  void *value );
+LDAP_API(int)
+LDAP_CALL ber_set_option(BerElement *ber, int option, void *value);
+LDAP_API(int)
+LDAP_CALL ber_get_option(BerElement *ber, int option, void *value);
+LDAP_API(Sockbuf *) LDAP_CALL ber_sockbuf_alloc(void);
+LDAP_API(void) LDAP_CALL ber_sockbuf_free(Sockbuf *p);
+LDAP_API(int)
+LDAP_CALL ber_sockbuf_set_option(Sockbuf *sb, int option, void *value);
+LDAP_API(int)
+LDAP_CALL ber_sockbuf_get_option(Sockbuf *sb, int option, void *value);
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 }
-#endif
+#  endif
 #endif /* _LBER_H */
-
--- a/ldap/c-sdk/include/lcache.h
+++ b/ldap/c-sdk/include/lcache.h
@@ -32,63 +32,71 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* lcache.h - ldap persistent cache */
 #ifndef _LCACHE_H
-#define _LCACHE_H
+#  define _LCACHE_H
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 extern "C" {
-#endif
+#  endif
 
 /* calling conventions used by library */
-#ifndef LDAP_CALL
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#define LDAP_C __cdecl
-#ifndef _WIN32
-#define __stdcall _far _pascal
-#define LDAP_CALLBACK _loadds
-#else
-#define LDAP_CALLBACK
-#endif /* _WIN32 */
-#define LDAP_PASCAL __stdcall
-#define LDAP_CALL LDAP_PASCAL
-#else /* _WINDOWS */
-#define LDAP_C
-#define LDAP_CALLBACK
-#define LDAP_PASCAL
-#define LDAP_CALL
-#endif /* _WINDOWS */
-#endif /* LDAP_CALL */
+#  ifndef LDAP_CALL
+#    if defined(_WINDOWS) || defined(_WIN32)
+#      define LDAP_C __cdecl
+#      ifndef _WIN32
+#        define __stdcall _far _pascal
+#        define LDAP_CALLBACK _loadds
+#      else
+#        define LDAP_CALLBACK
+#      endif /* _WIN32 */
+#      define LDAP_PASCAL __stdcall
+#      define LDAP_CALL LDAP_PASCAL
+#    else /* _WINDOWS */
+#      define LDAP_C
+#      define LDAP_CALLBACK
+#      define LDAP_PASCAL
+#      define LDAP_CALL
+#    endif /* _WINDOWS */
+#  endif   /* LDAP_CALL */
 
-LDAP_API(int) LDAP_C lcache_init( LDAP *ld, void *arg );
-LDAP_API(int) LDAP_C lcache_bind( LDAP *ld, int msgid, unsigned long tag,
-  const char *dn, struct berval *cred, int method );
-LDAP_API(int) LDAP_C lcache_unbind( LDAP *ld, int msgid, unsigned long tag );
-LDAP_API(int) LDAP_C lcache_search( LDAP *ld, int msgid, unsigned long tag,
-  const char *dn, int scope, const char *filter, char **attrs,
-  int attrsonly );
-LDAP_API(int) LDAP_C lcache_compare( LDAP *ld, int msgid, unsigned long tag,
-  const char *dn, const char *attr, struct berval *val );
-LDAP_API(int) LDAP_C lcache_add( LDAP *ld, int msgid, unsigned long tag,
-  const char *dn, LDAPMod **entry );
-LDAP_API(int) LDAP_C lcache_delete( LDAP *ld, int msgid, unsigned long tag,
-  const char *dn );
-LDAP_API(int) LDAP_C lcache_rename( LDAP *ld, int msgid, unsigned long tag,
-  const char *dn, const char *newrdn, const char *newparent,
-  int deleteoldrdn );
-LDAP_API(int) LDAP_C lcache_modify( LDAP *ld, int msgid, unsigned long tag,
-  const char *dn, LDAPMod **mods );
-LDAP_API(int) LDAP_C lcache_modrdn( LDAP *ld, int msgid, unsigned long tag,
-  const char *dn, const char *newrdn, int deleteoldrdn );
-LDAP_API(int) LDAP_C lcache_result( LDAP *ld, int msgid, int all,
-  struct timeval *timeout, LDAPMessage **result );
-LDAP_API(int) LDAP_C lcache_flush( LDAP *ld, char *dn, char *filter );
+LDAP_API(int) LDAP_C lcache_init(LDAP *ld, void *arg);
+LDAP_API(int)
+LDAP_C lcache_bind(LDAP *ld, int msgid, unsigned long tag, const char *dn,
+                   struct berval *cred, int method);
+LDAP_API(int) LDAP_C lcache_unbind(LDAP *ld, int msgid, unsigned long tag);
+LDAP_API(int)
+LDAP_C
+    lcache_search(LDAP *ld, int msgid, unsigned long tag, const char *dn,
+                  int scope, const char *filter, char **attrs, int attrsonly);
+LDAP_API(int)
+LDAP_C lcache_compare(LDAP *ld, int msgid, unsigned long tag, const char *dn,
+                      const char *attr, struct berval *val);
+LDAP_API(int)
+LDAP_C lcache_add(LDAP *ld, int msgid, unsigned long tag, const char *dn,
+                  LDAPMod **entry);
+LDAP_API(int)
+LDAP_C lcache_delete(LDAP *ld, int msgid, unsigned long tag, const char *dn);
+LDAP_API(int)
+LDAP_C
+    lcache_rename(LDAP *ld, int msgid, unsigned long tag, const char *dn,
+                  const char *newrdn, const char *newparent, int deleteoldrdn);
+LDAP_API(int)
+LDAP_C lcache_modify(LDAP *ld, int msgid, unsigned long tag, const char *dn,
+                     LDAPMod **mods);
+LDAP_API(int)
+LDAP_C lcache_modrdn(LDAP *ld, int msgid, unsigned long tag, const char *dn,
+                     const char *newrdn, int deleteoldrdn);
+LDAP_API(int)
+LDAP_C lcache_result(LDAP *ld, int msgid, int all, struct timeval *timeout,
+                     LDAPMessage **result);
+LDAP_API(int) LDAP_C lcache_flush(LDAP *ld, char *dn, char *filter);
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 }
-#endif
+#  endif
 
 #endif /* _LCACHE_H */
--- a/ldap/c-sdk/include/ldap-deprecated.h
+++ b/ldap/c-sdk/include/ldap-deprecated.h
@@ -55,147 +55,160 @@
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /*
  * establish an ldap session
  */
-LDAP_API(LDAP *) LDAP_CALL ldap_open( const char *host, int port );
+LDAP_API(LDAP *) LDAP_CALL ldap_open(const char *host, int port);
 
 /*
  * Authentication methods:
  */
-#define LDAP_AUTH_NONE          0x00L
-#define LDAP_AUTH_SIMPLE        0x80L
-#define LDAP_AUTH_SASL          0xa3L
-LDAP_API(int) LDAP_CALL ldap_bind( LDAP *ld, const char *who,
-        const char *passwd, int authmethod );
-LDAP_API(int) LDAP_CALL ldap_bind_s( LDAP *ld, const char *who,
-        const char *cred, int method );
+#define LDAP_AUTH_NONE 0x00L
+#define LDAP_AUTH_SIMPLE 0x80L
+#define LDAP_AUTH_SASL 0xa3L
+LDAP_API(int)
+LDAP_CALL
+    ldap_bind(LDAP *ld, const char *who, const char *passwd, int authmethod);
+LDAP_API(int)
+LDAP_CALL ldap_bind_s(LDAP *ld, const char *who, const char *cred, int method);
 
-LDAP_API(int) LDAP_CALL ldap_modrdn( LDAP *ld, const char *dn,
-        const char *newrdn );
-LDAP_API(int) LDAP_CALL ldap_modrdn_s( LDAP *ld, const char *dn,
-        const char *newrdn );
-LDAP_API(int) LDAP_CALL ldap_modrdn2( LDAP *ld, const char *dn,
-        const char *newrdn, int deleteoldrdn );
-LDAP_API(int) LDAP_CALL ldap_modrdn2_s( LDAP *ld, const char *dn,
-        const char *newrdn, int deleteoldrdn);
+LDAP_API(int)
+LDAP_CALL ldap_modrdn(LDAP *ld, const char *dn, const char *newrdn);
+LDAP_API(int)
+LDAP_CALL ldap_modrdn_s(LDAP *ld, const char *dn, const char *newrdn);
+LDAP_API(int)
+LDAP_CALL ldap_modrdn2(LDAP *ld, const char *dn, const char *newrdn,
+                       int deleteoldrdn);
+LDAP_API(int)
+LDAP_CALL ldap_modrdn2_s(LDAP *ld, const char *dn, const char *newrdn,
+                         int deleteoldrdn);
 
-LDAP_API(void) LDAP_CALL ldap_perror( LDAP *ld, const char *s );
-LDAP_API(int) LDAP_CALL ldap_result2error( LDAP *ld, LDAPMessage *r,
-        int freeit );
+LDAP_API(void) LDAP_CALL ldap_perror(LDAP *ld, const char *s);
+LDAP_API(int) LDAP_CALL ldap_result2error(LDAP *ld, LDAPMessage *r, int freeit);
 
 /*
  * Preferred language and get_lang_values (an API extension --
  * LDAP_API_FEATURE_X_GETLANGVALUES)
  *
  * The following two APIs are deprecated
  */
 
-#define LDAP_OPT_PREFERRED_LANGUAGE     0x14    /* 20 - API extension */
-LDAP_API(char **) LDAP_CALL ldap_get_lang_values( LDAP *ld, LDAPMessage *entry,
-        const char *target, char **type );
-LDAP_API(struct berval **) LDAP_CALL ldap_get_lang_values_len( LDAP *ld,
-        LDAPMessage *entry, const char *target, char **type );
+#define LDAP_OPT_PREFERRED_LANGUAGE 0x14 /* 20 - API extension */
+LDAP_API(char **)
+LDAP_CALL ldap_get_lang_values(LDAP *ld, LDAPMessage *entry, const char *target,
+                               char **type);
+LDAP_API(struct berval **)
+LDAP_CALL ldap_get_lang_values_len(LDAP *ld, LDAPMessage *entry,
+                                   const char *target, char **type);
 
 /*
  * Asynchronous I/O (an API extension).
  */
 /*
  * This option enables completely asynchronous IO.  It works by using ioctl()
  * on the fd, (or tlook())
  */
-#define LDAP_OPT_ASYNC_CONNECT          0x63    /* 99 - API extension */
+#define LDAP_OPT_ASYNC_CONNECT 0x63 /* 99 - API extension */
 
 /*
  * functions and definitions that have been replaced by new improved ones
  */
 /*
  * Use ldap_get_option() with LDAP_OPT_API_INFO and an LDAPAPIInfo structure
  * instead of ldap_version().
  */
 typedef struct _LDAPVersion {
-        int sdk_version;      /* Version of the SDK, * 100 */
-        int protocol_version; /* Highest protocol version supported, * 100 */
-        int SSL_version;      /* SSL version if this SDK supports it, * 100 */
-        int security_level;   /* highest level available */
-        int reserved[4];
+  int sdk_version;      /* Version of the SDK, * 100 */
+  int protocol_version; /* Highest protocol version supported, * 100 */
+  int SSL_version;      /* SSL version if this SDK supports it, * 100 */
+  int security_level;   /* highest level available */
+  int reserved[4];
 } LDAPVersion;
-#define LDAP_SECURITY_NONE      0
-LDAP_API(int) LDAP_CALL ldap_version( LDAPVersion *ver );
+#define LDAP_SECURITY_NONE 0
+LDAP_API(int) LDAP_CALL ldap_version(LDAPVersion *ver);
 
 /* use ldap_create_filter() instead of ldap_build_filter() */
-LDAP_API(void) LDAP_CALL ldap_build_filter( char *buf, unsigned long buflen,
-        char *pattern, char *prefix, char *suffix, char *attr,
-        char *value, char **valwords );
+LDAP_API(void)
+LDAP_CALL ldap_build_filter(char *buf, unsigned long buflen, char *pattern,
+                            char *prefix, char *suffix, char *attr, char *value,
+                            char **valwords);
 /* use ldap_set_filter_additions() instead of ldap_setfilteraffixes() */
-LDAP_API(void) LDAP_CALL ldap_setfilteraffixes( LDAPFiltDesc *lfdp,
-        char *prefix, char *suffix );
+LDAP_API(void)
+LDAP_CALL ldap_setfilteraffixes(LDAPFiltDesc *lfdp, char *prefix, char *suffix);
 
 /* older result types a server can return -- use LDAP_RES_MODDN instead */
-#define LDAP_RES_MODRDN                 LDAP_RES_MODDN
-#define LDAP_RES_RENAME                 LDAP_RES_MODDN
+#define LDAP_RES_MODRDN LDAP_RES_MODDN
+#define LDAP_RES_RENAME LDAP_RES_MODDN
 
 /* older error messages */
-#define LDAP_AUTH_METHOD_NOT_SUPPORTED  LDAP_STRONG_AUTH_NOT_SUPPORTED
+#define LDAP_AUTH_METHOD_NOT_SUPPORTED LDAP_STRONG_AUTH_NOT_SUPPORTED
 
 /*
  * Generalized cache callback interface:
  */
-#define LDAP_OPT_CACHE_FN_PTRS          0x0D    /* 13 - API extension */
-#define LDAP_OPT_CACHE_STRATEGY         0x0E    /* 14 - API extension */
-#define LDAP_OPT_CACHE_ENABLE           0x0F    /* 15 - API extension */
+#define LDAP_OPT_CACHE_FN_PTRS 0x0D  /* 13 - API extension */
+#define LDAP_OPT_CACHE_STRATEGY 0x0E /* 14 - API extension */
+#define LDAP_OPT_CACHE_ENABLE 0x0F   /* 15 - API extension */
 
 /* cache strategies */
-#define LDAP_CACHE_CHECK                0
-#define LDAP_CACHE_POPULATE             1
-#define LDAP_CACHE_LOCALDB              2
+#define LDAP_CACHE_CHECK 0
+#define LDAP_CACHE_POPULATE 1
+#define LDAP_CACHE_LOCALDB 2
 
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_BIND_CALLBACK)( LDAP *ld, int msgid,
-        unsigned long tag, const char *dn, const struct berval *creds,
-        int method);
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_UNBIND_CALLBACK)( LDAP *ld,
-        int unused0, unsigned long unused1 );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_SEARCH_CALLBACK)( LDAP *ld,
-        int msgid, unsigned long tag, const char *base, int scope,
-        const char LDAP_CALLBACK *filter, char **attrs, int attrsonly );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_COMPARE_CALLBACK)( LDAP *ld,
-        int msgid, unsigned long tag, const char *dn, const char *attr,
-        const struct berval *value );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_ADD_CALLBACK)( LDAP *ld,
-        int msgid, unsigned long tag, const char *dn, LDAPMod **attrs );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_DELETE_CALLBACK)( LDAP *ld,
-        int msgid, unsigned long tag, const char *dn );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_MODIFY_CALLBACK)( LDAP *ld,
-        int msgid, unsigned long tag, const char *dn, LDAPMod **mods );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_MODRDN_CALLBACK)( LDAP *ld,
-        int msgid, unsigned long tag, const char *dn, const char *newrdn,
-        int deleteoldrdn );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_RESULT_CALLBACK)( LDAP *ld,
-        int msgid, int all, struct timeval *timeout, LDAPMessage **result );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CF_FLUSH_CALLBACK)( LDAP *ld,
-        const char *dn, const char *filter );
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_BIND_CALLBACK)(
+    LDAP *ld, int msgid, unsigned long tag, const char *dn,
+    const struct berval *creds, int method);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_UNBIND_CALLBACK)(
+    LDAP *ld, int unused0, unsigned long unused1);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_SEARCH_CALLBACK)(
+    LDAP *ld, int msgid, unsigned long tag, const char *base, int scope,
+    const char LDAP_CALLBACK *filter, char **attrs, int attrsonly);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_COMPARE_CALLBACK)(
+    LDAP *ld, int msgid, unsigned long tag, const char *dn, const char *attr,
+    const struct berval *value);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_ADD_CALLBACK)(LDAP *ld, int msgid,
+                                                       unsigned long tag,
+                                                       const char *dn,
+                                                       LDAPMod **attrs);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_DELETE_CALLBACK)(LDAP *ld, int msgid,
+                                                          unsigned long tag,
+                                                          const char *dn);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_MODIFY_CALLBACK)(LDAP *ld, int msgid,
+                                                          unsigned long tag,
+                                                          const char *dn,
+                                                          LDAPMod **mods);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_MODRDN_CALLBACK)(LDAP *ld, int msgid,
+                                                          unsigned long tag,
+                                                          const char *dn,
+                                                          const char *newrdn,
+                                                          int deleteoldrdn);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_RESULT_CALLBACK)(
+    LDAP *ld, int msgid, int all, struct timeval *timeout,
+    LDAPMessage **result);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CF_FLUSH_CALLBACK)(LDAP *ld,
+                                                         const char *dn,
+                                                         const char *filter);
 
 struct ldap_cache_fns {
-        void    *lcf_private;
-        LDAP_CF_BIND_CALLBACK *lcf_bind;
-        LDAP_CF_UNBIND_CALLBACK *lcf_unbind;
-        LDAP_CF_SEARCH_CALLBACK *lcf_search;
-        LDAP_CF_COMPARE_CALLBACK *lcf_compare;
-        LDAP_CF_ADD_CALLBACK *lcf_add;
-        LDAP_CF_DELETE_CALLBACK *lcf_delete;
-        LDAP_CF_MODIFY_CALLBACK *lcf_modify;
-        LDAP_CF_MODRDN_CALLBACK *lcf_modrdn;
-        LDAP_CF_RESULT_CALLBACK *lcf_result;
-        LDAP_CF_FLUSH_CALLBACK *lcf_flush;
+  void *lcf_private;
+  LDAP_CF_BIND_CALLBACK *lcf_bind;
+  LDAP_CF_UNBIND_CALLBACK *lcf_unbind;
+  LDAP_CF_SEARCH_CALLBACK *lcf_search;
+  LDAP_CF_COMPARE_CALLBACK *lcf_compare;
+  LDAP_CF_ADD_CALLBACK *lcf_add;
+  LDAP_CF_DELETE_CALLBACK *lcf_delete;
+  LDAP_CF_MODIFY_CALLBACK *lcf_modify;
+  LDAP_CF_MODRDN_CALLBACK *lcf_modrdn;
+  LDAP_CF_RESULT_CALLBACK *lcf_result;
+  LDAP_CF_FLUSH_CALLBACK *lcf_flush;
 };
 
-LDAP_API(int) LDAP_CALL ldap_cache_flush( LDAP *ld, const char *dn,
-        const char *filter );
-
+LDAP_API(int)
+LDAP_CALL ldap_cache_flush(LDAP *ld, const char *dn, const char *filter);
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* _LDAP_DEPRECATED_H */
--- a/ldap/c-sdk/include/ldap-extension.h
+++ b/ldap/c-sdk/include/ldap-extension.h
@@ -39,90 +39,92 @@
 
 #ifndef _LDAP_EXTENSION_H
 #define _LDAP_EXTENSION_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define LDAP_PORT_MAX           65535           /* API extension */
-#define LDAP_VERSION1           1               /* API extension */
-#define LDAP_VERSION            LDAP_VERSION3   /* API extension */
+#define LDAP_PORT_MAX 65535        /* API extension */
+#define LDAP_VERSION1 1            /* API extension */
+#define LDAP_VERSION LDAP_VERSION3 /* API extension */
 
 /*
  * C LDAP features we support that are not (yet) part of the LDAP C API
  * Internet Draft.  Use the ldap_get_option() call with an option value of
  * LDAP_OPT_API_FEATURE_INFO to retrieve information about a feature.
  *
  * Note that this list is incomplete; it includes only the most widely
  * used extensions.  Also, the version is 1 for all of these for now.
  */
-#define LDAP_API_FEATURE_SERVER_SIDE_SORT       1
-#define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW      1
-#define LDAP_API_FEATURE_PERSISTENT_SEARCH      1
-#define LDAP_API_FEATURE_PROXY_AUTHORIZATION    1
-#define LDAP_API_FEATURE_X_LDERRNO              1
-#define LDAP_API_FEATURE_X_MEMCACHE             1
-#define LDAP_API_FEATURE_X_IO_FUNCTIONS         1
-#define LDAP_API_FEATURE_X_EXTIO_FUNCTIONS      1
-#define LDAP_API_FEATURE_X_DNS_FUNCTIONS        1
-#define LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS   1
-#define LDAP_API_FEATURE_X_THREAD_FUNCTIONS     1
-#define LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS   1
-#define LDAP_API_FEATURE_X_GETLANGVALUES        1
-#define LDAP_API_FEATURE_X_CLIENT_SIDE_SORT     1
-#define LDAP_API_FEATURE_X_URL_FUNCTIONS        1
-#define LDAP_API_FEATURE_X_FILTER_FUNCTIONS     1
+#define LDAP_API_FEATURE_SERVER_SIDE_SORT 1
+#define LDAP_API_FEATURE_VIRTUAL_LIST_VIEW 1
+#define LDAP_API_FEATURE_PERSISTENT_SEARCH 1
+#define LDAP_API_FEATURE_PROXY_AUTHORIZATION 1
+#define LDAP_API_FEATURE_X_LDERRNO 1
+#define LDAP_API_FEATURE_X_MEMCACHE 1
+#define LDAP_API_FEATURE_X_IO_FUNCTIONS 1
+#define LDAP_API_FEATURE_X_EXTIO_FUNCTIONS 1
+#define LDAP_API_FEATURE_X_DNS_FUNCTIONS 1
+#define LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS 1
+#define LDAP_API_FEATURE_X_THREAD_FUNCTIONS 1
+#define LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS 1
+#define LDAP_API_FEATURE_X_GETLANGVALUES 1
+#define LDAP_API_FEATURE_X_CLIENT_SIDE_SORT 1
+#define LDAP_API_FEATURE_X_URL_FUNCTIONS 1
+#define LDAP_API_FEATURE_X_FILTER_FUNCTIONS 1
 
-#define LDAP_ROOT_DSE           ""              /* API extension */
+#define LDAP_ROOT_DSE "" /* API extension */
 
-#define LDAP_OPT_DESC                   0x01    /*  1 */
+#define LDAP_OPT_DESC 0x01 /*  1 */
 
 #define NULLMSG ((LDAPMessage *)0)
 
 /*built-in SASL methods */
-#define LDAP_SASL_EXTERNAL      "EXTERNAL"      /* TLS/SSL extension */
+#define LDAP_SASL_EXTERNAL "EXTERNAL" /* TLS/SSL extension */
 
 /* possible error codes we can be returned */
-#define LDAP_PARTIAL_RESULTS            0x09    /* 9 (UMich LDAPv2 extn) */
-#define NAME_ERROR(n)   ((n & 0xf0) == 0x20)
+#define LDAP_PARTIAL_RESULTS 0x09 /* 9 (UMich LDAPv2 extn) */
+#define NAME_ERROR(n) ((n & 0xf0) == 0x20)
 
-#define LDAP_SORT_CONTROL_MISSING       0x3C    /* 60 (server side sort extn) */
-#define LDAP_INDEX_RANGE_ERROR          0x3D    /* 61 (VLV extn) */
+#define LDAP_SORT_CONTROL_MISSING 0x3C /* 60 (server side sort extn) */
+#define LDAP_INDEX_RANGE_ERROR 0x3D    /* 61 (VLV extn) */
 
 /*
  * LDAPv3 server controls we know about
  */
-#define LDAP_CONTROL_MANAGEDSAIT        "2.16.840.1.113730.3.4.2"
-#define LDAP_CONTROL_SORTREQUEST        "1.2.840.113556.1.4.473"
-#define LDAP_CONTROL_SORTRESPONSE       "1.2.840.113556.1.4.474"
-#define LDAP_CONTROL_PERSISTENTSEARCH   "2.16.840.1.113730.3.4.3"
-#define LDAP_CONTROL_ENTRYCHANGE        "2.16.840.1.113730.3.4.7"
-#define LDAP_CONTROL_VLVREQUEST         "2.16.840.1.113730.3.4.9"
-#define LDAP_CONTROL_VLVRESPONSE        "2.16.840.1.113730.3.4.10"
-#define LDAP_CONTROL_PROXYAUTH          "2.16.840.1.113730.3.4.12" /* version 1
-*/
-#define LDAP_CONTROL_PROXIEDAUTH        "2.16.840.1.113730.3.4.18" /* version 2
-*/
+#define LDAP_CONTROL_MANAGEDSAIT "2.16.840.1.113730.3.4.2"
+#define LDAP_CONTROL_SORTREQUEST "1.2.840.113556.1.4.473"
+#define LDAP_CONTROL_SORTRESPONSE "1.2.840.113556.1.4.474"
+#define LDAP_CONTROL_PERSISTENTSEARCH "2.16.840.1.113730.3.4.3"
+#define LDAP_CONTROL_ENTRYCHANGE "2.16.840.1.113730.3.4.7"
+#define LDAP_CONTROL_VLVREQUEST "2.16.840.1.113730.3.4.9"
+#define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10"
+#define LDAP_CONTROL_PROXYAUTH            \
+  "2.16.840.1.113730.3.4.12" /* version 1 \
+                              */
+#define LDAP_CONTROL_PROXIEDAUTH          \
+  "2.16.840.1.113730.3.4.18" /* version 2 \
+                              */
 
 /* Authorization Identity Request and Response Controls */
-#define LDAP_CONTROL_AUTHZID_REQ        "2.16.840.1.113730.3.4.16"
-#define LDAP_CONTROL_AUTHZID_RES        "2.16.840.1.113730.3.4.15"
+#define LDAP_CONTROL_AUTHZID_REQ "2.16.840.1.113730.3.4.16"
+#define LDAP_CONTROL_AUTHZID_RES "2.16.840.1.113730.3.4.15"
 
 /* Authentication request and response controls */
-#define LDAP_CONTROL_AUTH_REQUEST       LDAP_CONTROL_AUTHZID_REQ
-#define LDAP_CONTROL_AUTH_RESPONSE      LDAP_CONTROL_AUTHZID_RES
+#define LDAP_CONTROL_AUTH_REQUEST LDAP_CONTROL_AUTHZID_REQ
+#define LDAP_CONTROL_AUTH_RESPONSE LDAP_CONTROL_AUTHZID_RES
 
 /* Password information sent back to client */
-#define LDAP_CONTROL_PWEXPIRED          "2.16.840.1.113730.3.4.4"
-#define LDAP_CONTROL_PWEXPIRING         "2.16.840.1.113730.3.4.5"
+#define LDAP_CONTROL_PWEXPIRED "2.16.840.1.113730.3.4.4"
+#define LDAP_CONTROL_PWEXPIRING "2.16.840.1.113730.3.4.5"
 
 /* Password Policy Control */
-#define LDAP_CONTROL_PASSWD_POLICY      "1.3.6.1.4.1.42.2.27.8.5.1"
+#define LDAP_CONTROL_PASSWD_POLICY "1.3.6.1.4.1.42.2.27.8.5.1"
 
 /* Password Policy Control compatibility macros */
 #define LDAP_X_CONTROL_PWPOLICY_REQUEST LDAP_CONTROL_PASSWD_POLICY
 #define LDAP_X_CONTROL_PWPOLICY_RESPONSE LDAP_CONTROL_PASSWD_POLICY
 #define LDAP_CONTROL_PASSWORDPOLICYREQUEST LDAP_CONTROL_PASSWD_POLICY
 #define LDAP_CONTROL_PASSWORDPOLICYRESPONSE LDAP_CONTROL_PASSWD_POLICY
 
 /* Password Modify Extended Operation */
@@ -133,298 +135,333 @@ extern "C" {
 
 /* Only return virtual/inherited attribute values */
 #define LDAP_CONTROL_VIRTUAL_ATTRS_ONLY "2.16.840.1.113730.3.4.19"
 
 /* getEffectiveRights request */
 #define LDAP_CONTROL_GETEFFECTIVERIGHTS_REQUEST "1.3.6.1.4.1.42.2.27.9.5.2"
 
 /* Password Policy Control to get account availability */
-#define LDAP_CONTROL_ACCOUNT_USABLE     "1.3.6.1.4.1.42.2.27.9.5.8"
+#define LDAP_CONTROL_ACCOUNT_USABLE "1.3.6.1.4.1.42.2.27.9.5.8"
 
 /* "Who am I?" Extended Operation */
 #define LDAP_EXOP_WHO_AM_I "1.3.6.1.4.1.4203.1.11.3"
 
-LDAP_API(void) LDAP_CALL ldap_ber_free( BerElement *ber, int freebuf );
+LDAP_API(void) LDAP_CALL ldap_ber_free(BerElement *ber, int freebuf);
 
-LDAP_API(LDAPControl *) LDAP_CALL ldap_find_control( const char *oid,
-    LDAPControl **ctrls );
+LDAP_API(LDAPControl *)
+LDAP_CALL ldap_find_control(const char *oid, LDAPControl **ctrls);
 
 /*
  * Server side sorting of search results (an LDAPv3 extension --
  * LDAP_API_FEATURE_SERVER_SIDE_SORT)
  */
-typedef struct LDAPsortkey {    /* structure for a sort-key */
-        char *  sk_attrtype;
-        char *  sk_matchruleoid;
-        int     sk_reverseorder;
+typedef struct LDAPsortkey { /* structure for a sort-key */
+  char *sk_attrtype;
+  char *sk_matchruleoid;
+  int sk_reverseorder;
 } LDAPsortkey;
 
 /* where LDAP_CONTROL_ACCOUNT_USABLE control parse results */
-typedef struct LDAPuserstatus {     /* user account availability   */
-        unsigned int us_available;  /* availability status         */
-#define LDAP_US_ACCOUNT_USABLE      1
-#define LDAP_US_ACCOUNT_NOT_USABLE  0
-        int          us_expire;     /* will expire in seconds      */
-        int          us_inactive;   /* boolean inactivation status */
-#define LDAP_US_ACCOUNT_ACTIVE      0
-#define LDAP_US_ACCOUNT_INACTIVE    1
-        int          us_reset;      /* boolean password reset      */
-#define LDAP_US_ACCOUNT_NOT_RESET   0
-#define LDAP_US_ACCOUNT_RESET       1
-        int          us_expired;    /* boolean password expired    */
+typedef struct LDAPuserstatus { /* user account availability   */
+  unsigned int us_available;    /* availability status         */
+#define LDAP_US_ACCOUNT_USABLE 1
+#define LDAP_US_ACCOUNT_NOT_USABLE 0
+  int us_expire;   /* will expire in seconds      */
+  int us_inactive; /* boolean inactivation status */
+#define LDAP_US_ACCOUNT_ACTIVE 0
+#define LDAP_US_ACCOUNT_INACTIVE 1
+  int us_reset; /* boolean password reset      */
+#define LDAP_US_ACCOUNT_NOT_RESET 0
+#define LDAP_US_ACCOUNT_RESET 1
+  int us_expired; /* boolean password expired    */
 #define LDAP_US_ACCOUNT_NOT_EXPIRED 0
-#define LDAP_US_ACCOUNT_EXPIRED     1
-        int          us_remaining;  /* remaining logins            */
-        int          us_seconds;    /* will unlock in seconds      */
+#define LDAP_US_ACCOUNT_EXPIRED 1
+  int us_remaining; /* remaining logins            */
+  int us_seconds;   /* will unlock in seconds      */
 } LDAPuserstatus;
 
 /* LDAP_CONTROL_PASSWD_POLICY results */
 typedef enum passpolicyerror_enum {
-       PP_passwordExpired = 0,
-       PP_accountLocked = 1,
-       PP_changeAfterReset = 2,
-       PP_passwordModNotAllowed = 3,
-       PP_mustSupplyOldPassword = 4,
-       PP_insufficientPasswordQuality = 5,
-       PP_passwordTooShort = 6,
-       PP_passwordTooYoung = 7,
-       PP_passwordInHistory = 8,
-       PP_noError = 65535
+  PP_passwordExpired = 0,
+  PP_accountLocked = 1,
+  PP_changeAfterReset = 2,
+  PP_passwordModNotAllowed = 3,
+  PP_mustSupplyOldPassword = 4,
+  PP_insufficientPasswordQuality = 5,
+  PP_passwordTooShort = 6,
+  PP_passwordTooYoung = 7,
+  PP_passwordInHistory = 8,
+  PP_noError = 65535
 } LDAPPasswordPolicyError;
 
-LDAP_API(int) LDAP_CALL ldap_create_sort_control( LDAP *ld,
-        LDAPsortkey **sortKeyList, const char ctl_iscritical,
-        LDAPControl **ctrlp );
-LDAP_API(int) LDAP_CALL ldap_parse_sort_control( LDAP *ld,
-        LDAPControl **ctrls, ber_int_t *result, char **attribute );
+LDAP_API(int)
+LDAP_CALL
+    ldap_create_sort_control(LDAP *ld, LDAPsortkey **sortKeyList,
+                             const char ctl_iscritical, LDAPControl **ctrlp);
+LDAP_API(int)
+LDAP_CALL ldap_parse_sort_control(LDAP *ld, LDAPControl **ctrls,
+                                  ber_int_t *result, char **attribute);
 
-LDAP_API(void) LDAP_CALL ldap_free_sort_keylist( LDAPsortkey **sortKeyList );
-LDAP_API(int) LDAP_CALL ldap_create_sort_keylist( LDAPsortkey ***sortKeyList,
-        const char *string_rep );
+LDAP_API(void) LDAP_CALL ldap_free_sort_keylist(LDAPsortkey **sortKeyList);
+LDAP_API(int)
+LDAP_CALL ldap_create_sort_keylist(LDAPsortkey ***sortKeyList,
+                                   const char *string_rep);
 
-LDAP_API(int) LDAP_CALL ldap_create_userstatus_control(
-    LDAP *ld, const char ctl_iscritical, LDAPControl **ctrlp );
-LDAP_API(int) LDAP_CALL ldap_parse_userstatus_control( LDAP *ld,
-    LDAPControl **ctrlp, LDAPuserstatus *us );
+LDAP_API(int)
+LDAP_CALL ldap_create_userstatus_control(LDAP *ld, const char ctl_iscritical,
+                                         LDAPControl **ctrlp);
+LDAP_API(int)
+LDAP_CALL ldap_parse_userstatus_control(LDAP *ld, LDAPControl **ctrlp,
+                                        LDAPuserstatus *us);
 
-LDAP_API(int) LDAP_CALL ldap_create_passwordpolicy_control( LDAP *ld,
-    LDAPControl **ctrlp );
-LDAP_API(int) LDAP_CALL ldap_create_passwordpolicy_control_ext( LDAP *ld,
-    const char ctl_iscritical, LDAPControl **ctrlp );
-LDAP_API(int) LDAP_CALL ldap_parse_passwordpolicy_control( LDAP *ld,
-    LDAPControl *ctrlp, ber_int_t *expirep, ber_int_t *gracep,
-    LDAPPasswordPolicyError *errorp );
-LDAP_API(int) LDAP_CALL ldap_parse_passwordpolicy_control_ext ( LDAP *ld,
-    LDAPControl **ctrlp, ber_int_t *expirep, ber_int_t *gracep,
-    LDAPPasswordPolicyError *errorp );
-LDAP_API(const char *) LDAP_CALL ldap_passwordpolicy_err2txt(
-    LDAPPasswordPolicyError err );
+LDAP_API(int)
+LDAP_CALL ldap_create_passwordpolicy_control(LDAP *ld, LDAPControl **ctrlp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_create_passwordpolicy_control_ext(LDAP *ld, const char ctl_iscritical,
+                                           LDAPControl **ctrlp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_parse_passwordpolicy_control(LDAP *ld, LDAPControl *ctrlp,
+                                      ber_int_t *expirep, ber_int_t *gracep,
+                                      LDAPPasswordPolicyError *errorp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_parse_passwordpolicy_control_ext(LDAP *ld, LDAPControl **ctrlp,
+                                          ber_int_t *expirep, ber_int_t *gracep,
+                                          LDAPPasswordPolicyError *errorp);
+LDAP_API(const char *)
+LDAP_CALL ldap_passwordpolicy_err2txt(LDAPPasswordPolicyError err);
 
-LDAP_API(int) LDAP_CALL ldap_create_authzid_control( LDAP *ld,
-    const char ctl_iscritical, LDAPControl **ctrlp );
-LDAP_API(int) LDAP_CALL ldap_parse_authzid_control( LDAP *ld,
-    LDAPControl **ctrlp, char **authzid );
+LDAP_API(int)
+LDAP_CALL ldap_create_authzid_control(LDAP *ld, const char ctl_iscritical,
+                                      LDAPControl **ctrlp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_parse_authzid_control(LDAP *ld, LDAPControl **ctrlp, char **authzid);
 
-LDAP_API(int) LDAP_CALL ldap_whoami( LDAP *ld, LDAPControl **serverctrls,
-    LDAPControl **clientctrls, int *msgidp );
-LDAP_API(int) LDAP_CALL ldap_whoami_s( LDAP *ld, struct berval **authzid,
-    LDAPControl **serverctrls, LDAPControl **clientctrls );
-LDAP_API(int) LDAP_CALL ldap_parse_whoami( LDAP *ld, LDAPMessage *result,
-    struct berval **authzid );
+LDAP_API(int)
+LDAP_CALL ldap_whoami(LDAP *ld, LDAPControl **serverctrls,
+                      LDAPControl **clientctrls, int *msgidp);
+LDAP_API(int)
+LDAP_CALL ldap_whoami_s(LDAP *ld, struct berval **authzid,
+                        LDAPControl **serverctrls, LDAPControl **clientctrls);
+LDAP_API(int)
+LDAP_CALL
+    ldap_parse_whoami(LDAP *ld, LDAPMessage *result, struct berval **authzid);
 
-LDAP_API(int) LDAP_CALL ldap_create_geteffectiveRights_control( LDAP *ld,
-        const char *authzid, const char **attrlist,  const char ctl_iscritical,
-    LDAPControl **ctrlp );
+LDAP_API(int)
+LDAP_CALL ldap_create_geteffectiveRights_control(LDAP *ld, const char *authzid,
+                                                 const char **attrlist,
+                                                 const char ctl_iscritical,
+                                                 LDAPControl **ctrlp);
 
 /*
  * Virtual list view (an LDAPv3 extension -- LDAP_API_FEATURE_VIRTUAL_LIST_VIEW)
  */
 /*
  * structure that describes a VirtualListViewRequest control.
  * note that ldvlist_index and ldvlist_size are only relevant to
  * ldap_create_virtuallist_control() if ldvlist_attrvalue is NULL.
  */
 typedef struct ldapvirtuallist {
-    ber_int_t   ldvlist_before_count;       /* # entries before target */
-    ber_int_t   ldvlist_after_count;        /* # entries after target */
-    char        *ldvlist_attrvalue;         /* jump to this value */
-    ber_int_t   ldvlist_index;              /* list offset */
-    ber_int_t   ldvlist_size;               /* number of items in vlist */
-    void        *ldvlist_extradata;         /* for use by application */
+  ber_int_t ldvlist_before_count; /* # entries before target */
+  ber_int_t ldvlist_after_count;  /* # entries after target */
+  char *ldvlist_attrvalue;        /* jump to this value */
+  ber_int_t ldvlist_index;        /* list offset */
+  ber_int_t ldvlist_size;         /* number of items in vlist */
+  void *ldvlist_extradata;        /* for use by application */
 } LDAPVirtualList;
 
 /*
  * VLV functions:
  */
-LDAP_API(int) LDAP_CALL ldap_create_virtuallist_control( LDAP *ld,
-        LDAPVirtualList *ldvlistp, LDAPControl **ctrlp );
+LDAP_API(int)
+LDAP_CALL ldap_create_virtuallist_control(LDAP *ld, LDAPVirtualList *ldvlistp,
+                                          LDAPControl **ctrlp);
 
-LDAP_API(int) LDAP_CALL ldap_parse_virtuallist_control( LDAP *ld,
-        LDAPControl **ctrls, ber_int_t *target_posp,
-        ber_int_t *list_sizep, int *errcodep );
+LDAP_API(int)
+LDAP_CALL ldap_parse_virtuallist_control(LDAP *ld, LDAPControl **ctrls,
+                                         ber_int_t *target_posp,
+                                         ber_int_t *list_sizep, int *errcodep);
 
 /*
  * Routines for creating persistent search controls and for handling
  * "entry changed notification" controls (an LDAPv3 extension --
  * LDAP_API_FEATURE_PERSISTENT_SEARCH)
  */
-#define LDAP_CHANGETYPE_ADD             1
-#define LDAP_CHANGETYPE_DELETE          2
-#define LDAP_CHANGETYPE_MODIFY          4
-#define LDAP_CHANGETYPE_MODDN           8
-#define LDAP_CHANGETYPE_ANY             (1|2|4|8)
-LDAP_API(int) LDAP_CALL ldap_create_persistentsearch_control( LDAP *ld,
-        int changetypes, int changesonly, int return_echg_ctls,
-        char ctl_iscritical, LDAPControl **ctrlp );
-LDAP_API(int) LDAP_CALL ldap_parse_entrychange_control( LDAP *ld,
-        LDAPControl **ctrls, ber_int_t *chgtypep, char **prevdnp,
-        int *chgnumpresentp, ber_int_t *chgnump );
+#define LDAP_CHANGETYPE_ADD 1
+#define LDAP_CHANGETYPE_DELETE 2
+#define LDAP_CHANGETYPE_MODIFY 4
+#define LDAP_CHANGETYPE_MODDN 8
+#define LDAP_CHANGETYPE_ANY (1 | 2 | 4 | 8)
+LDAP_API(int)
+LDAP_CALL
+    ldap_create_persistentsearch_control(LDAP *ld, int changetypes,
+                                         int changesonly, int return_echg_ctls,
+                                         char ctl_iscritical,
+                                         LDAPControl **ctrlp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_parse_entrychange_control(LDAP *ld, LDAPControl **ctrls,
+                                   ber_int_t *chgtypep, char **prevdnp,
+                                   int *chgnumpresentp, ber_int_t *chgnump);
 
 /*
  * Routines for creating Proxied Authorization controls (an LDAPv3
  * extension -- LDAP_API_FEATURE_PROXY_AUTHORIZATION)
  * ldap_create_proxyauth_control() is for the old (version 1) control.
  * ldap_create_proxiedauth_control() is for the newer (version 2) control.
  */
-LDAP_API(int) LDAP_CALL ldap_create_proxyauth_control( LDAP *ld,
-        const char *dn, const char ctl_iscritical, LDAPControl **ctrlp );
-LDAP_API(int) LDAP_CALL ldap_create_proxiedauth_control( LDAP *ld,
-        const char *authzid, LDAPControl **ctrlp );
+LDAP_API(int)
+LDAP_CALL ldap_create_proxyauth_control(LDAP *ld, const char *dn,
+                                        const char ctl_iscritical,
+                                        LDAPControl **ctrlp);
+LDAP_API(int)
+LDAP_CALL ldap_create_proxiedauth_control(LDAP *ld, const char *authzid,
+                                          LDAPControl **ctrlp);
 
 /*
  * Functions to get and set LDAP error information (API extension --
  * LDAP_API_FEATURE_X_LDERRNO )
  *
  * By using LDAP_OPT_THREAD_FN_PTRS, you can arrange for the error info. to
  * be thread-specific.
  */
-LDAP_API(int) LDAP_CALL ldap_get_lderrno( LDAP *ld, char **m, char **s );
-LDAP_API(int) LDAP_CALL ldap_set_lderrno( LDAP *ld, int e, char *m, char *s );
-
+LDAP_API(int) LDAP_CALL ldap_get_lderrno(LDAP *ld, char **m, char **s);
+LDAP_API(int) LDAP_CALL ldap_set_lderrno(LDAP *ld, int e, char *m, char *s);
 
 /*
  * LDAP URL functions and definitions (an API extension --
  * LDAP_API_FEATURE_X_URL_FUNCTIONS)
  */
 /*
  * types for ldap URL handling
  */
 typedef struct ldap_url_desc {
-    char                *lud_host;
-    int                 lud_port;
-    char                *lud_dn;
-    char                **lud_attrs;
-    int                 lud_scope;
-    char                *lud_filter;
-    unsigned long       lud_options;
-#define LDAP_URL_OPT_SECURE     0x01
-    char        *lud_string;    /* for internal use only */
+  char *lud_host;
+  int lud_port;
+  char *lud_dn;
+  char **lud_attrs;
+  int lud_scope;
+  char *lud_filter;
+  unsigned long lud_options;
+#define LDAP_URL_OPT_SECURE 0x01
+  char *lud_string; /* for internal use only */
 } LDAPURLDesc;
 
 #define NULLLDAPURLDESC ((LDAPURLDesc *)NULL)
 
 /*
  * possible errors returned by ldap_url_parse()
  */
-#define LDAP_URL_ERR_NOTLDAP    1       /* URL doesn't begin with "ldap://" */
-#define LDAP_URL_ERR_NODN       2       /* URL has no DN (required) */
-#define LDAP_URL_ERR_BADSCOPE   3       /* URL scope string is invalid */
-#define LDAP_URL_ERR_MEM        4       /* can't allocate memory space */
-#define LDAP_URL_ERR_PARAM      5       /* bad parameter to an URL function */
+#define LDAP_URL_ERR_NOTLDAP 1  /* URL doesn't begin with "ldap://" */
+#define LDAP_URL_ERR_NODN 2     /* URL has no DN (required) */
+#define LDAP_URL_ERR_BADSCOPE 3 /* URL scope string is invalid */
+#define LDAP_URL_ERR_MEM 4      /* can't allocate memory space */
+#define LDAP_URL_ERR_PARAM 5    /* bad parameter to an URL function */
 #define LDAP_URL_UNRECOGNIZED_CRITICAL_EXTENSION 6
 
 /*
  * URL functions:
  */
-LDAP_API(int) LDAP_CALL ldap_is_ldap_url( const char *url );
-LDAP_API(int) LDAP_CALL ldap_url_parse( const char *url, LDAPURLDesc **ludpp );
-LDAP_API(int) LDAP_CALL ldap_url_parse_no_defaults( const char *url,
-        LDAPURLDesc **ludpp, int dn_required);
-LDAP_API(void) LDAP_CALL ldap_free_urldesc( LDAPURLDesc *ludp );
-LDAP_API(int) LDAP_CALL ldap_url_search( LDAP *ld, const char *url,
-        int attrsonly );
-LDAP_API(int) LDAP_CALL ldap_url_search_s( LDAP *ld, const char *url,
-        int attrsonly, LDAPMessage **res );
-LDAP_API(int) LDAP_CALL ldap_url_search_st( LDAP *ld, const char *url,
-        int attrsonly, struct timeval *timeout, LDAPMessage **res );
-
+LDAP_API(int) LDAP_CALL ldap_is_ldap_url(const char *url);
+LDAP_API(int) LDAP_CALL ldap_url_parse(const char *url, LDAPURLDesc **ludpp);
+LDAP_API(int)
+LDAP_CALL ldap_url_parse_no_defaults(const char *url, LDAPURLDesc **ludpp,
+                                     int dn_required);
+LDAP_API(void) LDAP_CALL ldap_free_urldesc(LDAPURLDesc *ludp);
+LDAP_API(int)
+LDAP_CALL ldap_url_search(LDAP *ld, const char *url, int attrsonly);
+LDAP_API(int)
+LDAP_CALL ldap_url_search_s(LDAP *ld, const char *url, int attrsonly,
+                            LDAPMessage **res);
+LDAP_API(int)
+LDAP_CALL ldap_url_search_st(LDAP *ld, const char *url, int attrsonly,
+                             struct timeval *timeout, LDAPMessage **res);
 
 /*
  * Function to dispose of an array of LDAPMod structures (an API extension).
  * Warning: don't use this unless the mods array was allocated using the
  * same memory allocator as is being used by libldap.
  */
-LDAP_API(void) LDAP_CALL ldap_mods_free( LDAPMod **mods, int freemods );
+LDAP_API(void) LDAP_CALL ldap_mods_free(LDAPMod **mods, int freemods);
 
 /*
  * SSL option (an API extension):
  */
-#define LDAP_OPT_SSL                    0x0A    /* 10 - API extension */
+#define LDAP_OPT_SSL 0x0A /* 10 - API extension */
 
 /*
  * Referral hop limit (an API extension):
  */
-#define LDAP_OPT_REFERRAL_HOP_LIMIT     0x10    /* 16 - API extension */
+#define LDAP_OPT_REFERRAL_HOP_LIMIT 0x10 /* 16 - API extension */
 
 /*
  * Rebind callback function (an API extension)
  */
-#define LDAP_OPT_REBIND_FN              0x06    /* 6 - API extension */
-#define LDAP_OPT_REBIND_ARG             0x07    /* 7 - API extension */
-typedef int (LDAP_CALL LDAP_CALLBACK LDAP_REBINDPROC_CALLBACK)( LDAP *ld,
-        char **dnp, char **passwdp, int *authmethodp, int freeit, void *arg);
-LDAP_API(void) LDAP_CALL ldap_set_rebind_proc( LDAP *ld,
-        LDAP_REBINDPROC_CALLBACK *rebindproc, void *arg );
+#define LDAP_OPT_REBIND_FN 0x06  /* 6 - API extension */
+#define LDAP_OPT_REBIND_ARG 0x07 /* 7 - API extension */
+typedef int(LDAP_CALL LDAP_CALLBACK LDAP_REBINDPROC_CALLBACK)(
+    LDAP *ld, char **dnp, char **passwdp, int *authmethodp, int freeit,
+    void *arg);
+LDAP_API(void)
+LDAP_CALL ldap_set_rebind_proc(LDAP *ld, LDAP_REBINDPROC_CALLBACK *rebindproc,
+                               void *arg);
 
 /*
  * Thread function callbacks (an API extension --
  * LDAP_API_FEATURE_X_THREAD_FUNCTIONS).
  */
-#define LDAP_OPT_THREAD_FN_PTRS         0x05    /* 5 - API extension */
+#define LDAP_OPT_THREAD_FN_PTRS 0x05 /* 5 - API extension */
 
 /*
  * Thread callback functions:
  */
-typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_ALLOC_CALLBACK)( void );
-typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_FREE_CALLBACK)( void *m );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_LOCK_CALLBACK)( void *m );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_UNLOCK_CALLBACK)( void *m );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_ERRNO_CALLBACK)( void );
-typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SET_ERRNO_CALLBACK)( int e );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_GET_LDERRNO_CALLBACK)(
-        char **matchedp, char **errmsgp, void *arg );
-typedef void    (LDAP_C LDAP_CALLBACK LDAP_TF_SET_LDERRNO_CALLBACK)( int err,
-        char *matched, char *errmsg, void *arg );
+typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_ALLOC_CALLBACK)(void);
+typedef void(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_FREE_CALLBACK)(void *m);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_LOCK_CALLBACK)(void *m);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_UNLOCK_CALLBACK)(void *m);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_TF_GET_ERRNO_CALLBACK)(void);
+typedef void(LDAP_C LDAP_CALLBACK LDAP_TF_SET_ERRNO_CALLBACK)(int e);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_TF_GET_LDERRNO_CALLBACK)(char **matchedp,
+                                                               char **errmsgp,
+                                                               void *arg);
+typedef void(LDAP_C LDAP_CALLBACK LDAP_TF_SET_LDERRNO_CALLBACK)(int err,
+                                                                char *matched,
+                                                                char *errmsg,
+                                                                void *arg);
 
 /*
  * Structure to hold thread function pointers:
  */
 struct ldap_thread_fns {
-        LDAP_TF_MUTEX_ALLOC_CALLBACK *ltf_mutex_alloc;
-        LDAP_TF_MUTEX_FREE_CALLBACK *ltf_mutex_free;
-        LDAP_TF_MUTEX_LOCK_CALLBACK *ltf_mutex_lock;
-        LDAP_TF_MUTEX_UNLOCK_CALLBACK *ltf_mutex_unlock;
-        LDAP_TF_GET_ERRNO_CALLBACK *ltf_get_errno;
-        LDAP_TF_SET_ERRNO_CALLBACK *ltf_set_errno;
-        LDAP_TF_GET_LDERRNO_CALLBACK *ltf_get_lderrno;
-        LDAP_TF_SET_LDERRNO_CALLBACK *ltf_set_lderrno;
-        void    *ltf_lderrno_arg;
+  LDAP_TF_MUTEX_ALLOC_CALLBACK *ltf_mutex_alloc;
+  LDAP_TF_MUTEX_FREE_CALLBACK *ltf_mutex_free;
+  LDAP_TF_MUTEX_LOCK_CALLBACK *ltf_mutex_lock;
+  LDAP_TF_MUTEX_UNLOCK_CALLBACK *ltf_mutex_unlock;
+  LDAP_TF_GET_ERRNO_CALLBACK *ltf_get_errno;
+  LDAP_TF_SET_ERRNO_CALLBACK *ltf_set_errno;
+  LDAP_TF_GET_LDERRNO_CALLBACK *ltf_get_lderrno;
+  LDAP_TF_SET_LDERRNO_CALLBACK *ltf_set_lderrno;
+  void *ltf_lderrno_arg;
 };
 
 /*
  * Extended I/O function callbacks option (an API extension --
  * LDAP_API_FEATURE_X_EXTIO_FUNCTIONS).
  */
-#define LDAP_X_OPT_EXTIO_FN_PTRS   (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F00)
-        /* 0x4000 + 0x0F00 = 0x4F00 = 20224 - API extension */
+#define LDAP_X_OPT_EXTIO_FN_PTRS (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F00)
+/* 0x4000 + 0x0F00 = 0x4F00 = 20224 - API extension */
 
-/* Additional Extended I/O function callback option (for Extended Socket Arg callback) */
+/* Additional Extended I/O function callback option (for Extended Socket Arg
+ * callback) */
 #define LDAP_X_OPT_SOCKETARG (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F02)
-        /* 0x4000 + 0x0F02 = 0x4F02 = 20226 - API extension */
+/* 0x4000 + 0x0F02 = 0x4F02 = 20226 - API extension */
 
 /*
  * These extended I/O function callbacks echo the BSD socket API but accept
  * an extra pointer parameter at the end of their argument list that can
  * be used by client applications for their own needs.  For some of the calls,
  * the pointer is a session argument of type struct lextiof_session_private *
  * that is associated with the LDAP session handle (LDAP *).  For others, the
  * pointer is a socket specific struct lextiof_socket_private * argument that
@@ -459,395 +496,404 @@ struct ldap_thread_fns {
  * A DISPOSEHANDLE callback function is also provided.  It is called right
  * before the LDAP session handle and its contents are destroyed, e.g.,
  * during ldap_unbind().
  */
 
 /*
  * Special timeout values for poll and connect:
  */
-#define LDAP_X_IO_TIMEOUT_NO_WAIT       0       /* return immediately */
-#define LDAP_X_IO_TIMEOUT_NO_TIMEOUT    (-1)    /* block indefinitely */
+#define LDAP_X_IO_TIMEOUT_NO_WAIT 0       /* return immediately */
+#define LDAP_X_IO_TIMEOUT_NO_TIMEOUT (-1) /* block indefinitely */
 
 /* LDAP poll()-like descriptor:
  */
-typedef struct ldap_x_pollfd {     /* used by LDAP_X_EXTIOF_POLL_CALLBACK */
-    int         lpoll_fd;          /* integer file descriptor / socket */
-    struct lextiof_socket_private
-                *lpoll_socketarg;
-                                   /* pointer socket and for use by */
-                                   /* application */
-    short       lpoll_events;      /* requested event */
-    short       lpoll_revents;     /* returned event */
+typedef struct ldap_x_pollfd { /* used by LDAP_X_EXTIOF_POLL_CALLBACK */
+  int lpoll_fd;                /* integer file descriptor / socket */
+  struct lextiof_socket_private *lpoll_socketarg;
+  /* pointer socket and for use by */
+  /* application */
+  short lpoll_events;  /* requested event */
+  short lpoll_revents; /* returned event */
 } LDAP_X_PollFD;
 
 /* Event flags for lpoll_events and lpoll_revents:
  */
-#define LDAP_X_POLLIN    0x01  /* regular data ready for reading */
-#define LDAP_X_POLLPRI   0x02  /* high priority data available */
-#define LDAP_X_POLLOUT   0x04  /* ready for writing */
-#define LDAP_X_POLLERR   0x08  /* error occurred -- only in lpoll_revents */
-#define LDAP_X_POLLHUP   0x10  /* connection closed -- only in lpoll_revents */
-#define LDAP_X_POLLNVAL  0x20  /* invalid lpoll_fd -- only in lpoll_revents */
+#define LDAP_X_POLLIN 0x01   /* regular data ready for reading */
+#define LDAP_X_POLLPRI 0x02  /* high priority data available */
+#define LDAP_X_POLLOUT 0x04  /* ready for writing */
+#define LDAP_X_POLLERR 0x08  /* error occurred -- only in lpoll_revents */
+#define LDAP_X_POLLHUP 0x10  /* connection closed -- only in lpoll_revents */
+#define LDAP_X_POLLNVAL 0x20 /* invalid lpoll_fd -- only in lpoll_revents */
 
 /* Options passed to LDAP_X_EXTIOF_CONNECT_CALLBACK to modify socket behavior:
  */
-#define LDAP_X_EXTIOF_OPT_NONBLOCKING   0x01  /* turn on non-blocking mode */
-#define LDAP_X_EXTIOF_OPT_SECURE        0x02  /* turn on 'secure' mode */
-
+#define LDAP_X_EXTIOF_OPT_NONBLOCKING 0x01 /* turn on non-blocking mode */
+#define LDAP_X_EXTIOF_OPT_SECURE 0x02      /* turn on 'secure' mode */
 
 /* extended I/O callback function prototypes:
  */
-typedef int     (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_CONNECT_CALLBACK )(
-            const char *hostlist, int port, /* host byte order */
-            int timeout /* milliseconds */,
-            unsigned long options, /* bitmapped options */
-            struct lextiof_session_private *sessionarg,
-            struct lextiof_socket_private **socketargp );
-typedef int     (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_CLOSE_CALLBACK )(
-            int s, struct lextiof_socket_private *socketarg );
-typedef int     (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_POLL_CALLBACK)(
-            LDAP_X_PollFD fds[], int nfds, int timeout /* milliseconds */,
-            struct lextiof_session_private *sessionarg );
-typedef int     (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_NEWHANDLE_CALLBACK)(
-            LDAP *ld, struct lextiof_session_private *sessionarg );
-typedef void    (LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK)(
-            LDAP *ld, struct lextiof_session_private *sessionarg );
-
+typedef int(LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_CONNECT_CALLBACK)(
+    const char *hostlist, int port, /* host byte order */
+    int timeout /* milliseconds */,
+    unsigned long options, /* bitmapped options */
+    struct lextiof_session_private *sessionarg,
+    struct lextiof_socket_private **socketargp);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_CLOSE_CALLBACK)(
+    int s, struct lextiof_socket_private *socketarg);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_POLL_CALLBACK)(
+    LDAP_X_PollFD fds[], int nfds, int timeout /* milliseconds */,
+    struct lextiof_session_private *sessionarg);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_NEWHANDLE_CALLBACK)(
+    LDAP *ld, struct lextiof_session_private *sessionarg);
+typedef void(LDAP_C LDAP_CALLBACK LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK)(
+    LDAP *ld, struct lextiof_session_private *sessionarg);
 
 /* Structure to hold extended I/O function pointers:
  */
 struct ldap_x_ext_io_fns {
-        /* lextiof_size should always be set to LDAP_X_EXTIO_FNS_SIZE */
-        int                                     lextiof_size;
-        LDAP_X_EXTIOF_CONNECT_CALLBACK          *lextiof_connect;
-        LDAP_X_EXTIOF_CLOSE_CALLBACK            *lextiof_close;
-        LDAP_X_EXTIOF_READ_CALLBACK             *lextiof_read;
-        LDAP_X_EXTIOF_WRITE_CALLBACK            *lextiof_write;
-        LDAP_X_EXTIOF_POLL_CALLBACK             *lextiof_poll;
-        LDAP_X_EXTIOF_NEWHANDLE_CALLBACK        *lextiof_newhandle;
-        LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK    *lextiof_disposehandle;
-        void                                    *lextiof_session_arg;
-        LDAP_X_EXTIOF_WRITEV_CALLBACK           *lextiof_writev;
+  /* lextiof_size should always be set to LDAP_X_EXTIO_FNS_SIZE */
+  int lextiof_size;
+  LDAP_X_EXTIOF_CONNECT_CALLBACK *lextiof_connect;
+  LDAP_X_EXTIOF_CLOSE_CALLBACK *lextiof_close;
+  LDAP_X_EXTIOF_READ_CALLBACK *lextiof_read;
+  LDAP_X_EXTIOF_WRITE_CALLBACK *lextiof_write;
+  LDAP_X_EXTIOF_POLL_CALLBACK *lextiof_poll;
+  LDAP_X_EXTIOF_NEWHANDLE_CALLBACK *lextiof_newhandle;
+  LDAP_X_EXTIOF_DISPOSEHANDLE_CALLBACK *lextiof_disposehandle;
+  void *lextiof_session_arg;
+  LDAP_X_EXTIOF_WRITEV_CALLBACK *lextiof_writev;
 };
-#define LDAP_X_EXTIO_FNS_SIZE   sizeof(struct ldap_x_ext_io_fns)
+#define LDAP_X_EXTIO_FNS_SIZE sizeof(struct ldap_x_ext_io_fns)
 
 /*
  * Utility functions for parsing space-separated host lists (useful for
  * implementing an extended I/O CONNECT callback function).
  */
 struct ldap_x_hostlist_status;
-LDAP_API(int) LDAP_CALL ldap_x_hostlist_first( const char *hostlist,
-        int defport, char **hostp, int *portp /* host byte order */,
-        struct ldap_x_hostlist_status **statusp );
-LDAP_API(int) LDAP_CALL ldap_x_hostlist_next( char **hostp,
-        int *portp /* host byte order */, struct ldap_x_hostlist_status *status
-);
-LDAP_API(void) LDAP_CALL ldap_x_hostlist_statusfree(
-        struct ldap_x_hostlist_status *status );
+LDAP_API(int)
+LDAP_CALL ldap_x_hostlist_first(const char *hostlist, int defport, char **hostp,
+                                int *portp /* host byte order */,
+                                struct ldap_x_hostlist_status **statusp);
+LDAP_API(int)
+LDAP_CALL ldap_x_hostlist_next(char **hostp, int *portp /* host byte order */,
+                               struct ldap_x_hostlist_status *status);
+LDAP_API(void)
+LDAP_CALL ldap_x_hostlist_statusfree(struct ldap_x_hostlist_status *status);
 
 /*
  * Client side sorting of entries (an API extension --
  * LDAP_API_FEATURE_X_CLIENT_SIDE_SORT)
  */
 /*
  * Client side sorting callback functions:
  */
-typedef const struct berval* (LDAP_C LDAP_CALLBACK
-        LDAP_KEYGEN_CALLBACK)( void *arg, LDAP *ld, LDAPMessage *entry );
-typedef int (LDAP_C LDAP_CALLBACK
-        LDAP_KEYCMP_CALLBACK)( void *arg, const struct berval*,
-        const struct berval* );
-typedef void (LDAP_C LDAP_CALLBACK
-        LDAP_KEYFREE_CALLBACK)( void *arg, const struct berval* );
-typedef int (LDAP_C LDAP_CALLBACK
-        LDAP_CMP_CALLBACK)(const char *val1, const char *val2);
-typedef int (LDAP_C LDAP_CALLBACK
-        LDAP_VALCMP_CALLBACK)(const char **val1p, const char **val2p);
+typedef const struct berval *(LDAP_C LDAP_CALLBACK LDAP_KEYGEN_CALLBACK)(
+    void *arg, LDAP *ld, LDAPMessage *entry);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_KEYCMP_CALLBACK)(void *arg,
+                                                       const struct berval *,
+                                                       const struct berval *);
+typedef void(LDAP_C LDAP_CALLBACK LDAP_KEYFREE_CALLBACK)(void *arg,
+                                                         const struct berval *);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CMP_CALLBACK)(const char *val1,
+                                                    const char *val2);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_VALCMP_CALLBACK)(const char **val1p,
+                                                       const char **val2p);
 
 /*
  * Client side sorting functions:
  */
-LDAP_API(int) LDAP_CALL ldap_keysort_entries( LDAP *ld, LDAPMessage **chain,
-        void *arg, LDAP_KEYGEN_CALLBACK *gen, LDAP_KEYCMP_CALLBACK *cmp,
-        LDAP_KEYFREE_CALLBACK *fre );
-LDAP_API(int) LDAP_CALL ldap_multisort_entries( LDAP *ld, LDAPMessage **chain,
-        char **attr, LDAP_CMP_CALLBACK *cmp );
-LDAP_API(int) LDAP_CALL ldap_sort_entries( LDAP *ld, LDAPMessage **chain,
-        char *attr, LDAP_CMP_CALLBACK *cmp );
-LDAP_API(int) LDAP_CALL ldap_sort_values( LDAP *ld, char **vals,
-        LDAP_VALCMP_CALLBACK *cmp );
-LDAP_API(int) LDAP_C LDAP_CALLBACK ldap_sort_strcasecmp( const char **a,
-        const char **b );
-
+LDAP_API(int)
+LDAP_CALL
+    ldap_keysort_entries(LDAP *ld, LDAPMessage **chain, void *arg,
+                         LDAP_KEYGEN_CALLBACK *gen, LDAP_KEYCMP_CALLBACK *cmp,
+                         LDAP_KEYFREE_CALLBACK *fre);
+LDAP_API(int)
+LDAP_CALL ldap_multisort_entries(LDAP *ld, LDAPMessage **chain, char **attr,
+                                 LDAP_CMP_CALLBACK *cmp);
+LDAP_API(int)
+LDAP_CALL ldap_sort_entries(LDAP *ld, LDAPMessage **chain, char *attr,
+                            LDAP_CMP_CALLBACK *cmp);
+LDAP_API(int)
+LDAP_CALL ldap_sort_values(LDAP *ld, char **vals, LDAP_VALCMP_CALLBACK *cmp);
+LDAP_API(int)
+LDAP_C LDAP_CALLBACK ldap_sort_strcasecmp(const char **a, const char **b);
 
 /*
  * Filter functions and definitions (an API extension --
  * LDAP_API_FEATURE_X_FILTER_FUNCTIONS)
  */
 /*
  * Structures, constants, and types for filter utility routines:
  */
 typedef struct ldap_filt_info {
-        char                    *lfi_filter;
-        char                    *lfi_desc;
-        int                     lfi_scope;      /* LDAP_SCOPE_BASE, etc */
-        int                     lfi_isexact;    /* exact match filter? */
-        struct ldap_filt_info   *lfi_next;
+  char *lfi_filter;
+  char *lfi_desc;
+  int lfi_scope;   /* LDAP_SCOPE_BASE, etc */
+  int lfi_isexact; /* exact match filter? */
+  struct ldap_filt_info *lfi_next;
 } LDAPFiltInfo;
 
-#define LDAP_FILT_MAXSIZ        1024
+#define LDAP_FILT_MAXSIZ 1024
 
 typedef struct ldap_filt_list LDAPFiltList; /* opaque filter list handle */
 typedef struct ldap_filt_desc LDAPFiltDesc; /* opaque filter desc handle */
 
 /*
  * Filter utility functions:
  */
-LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_init_getfilter( char *fname );
-LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_init_getfilter_buf( char *buf,
-        long buflen );
-LDAP_API(LDAPFiltInfo *) LDAP_CALL ldap_getfirstfilter( LDAPFiltDesc *lfdp,
-        char *tagpat, char *value );
-LDAP_API(LDAPFiltInfo *) LDAP_CALL ldap_getnextfilter( LDAPFiltDesc *lfdp );
-LDAP_API(int) LDAP_CALL ldap_set_filter_additions( LDAPFiltDesc *lfdp,
-        char *prefix, char *suffix );
-LDAP_API(int) LDAP_CALL ldap_create_filter( char *buf, unsigned long buflen,
-        char *pattern, char *prefix, char *suffix, char *attr,
-        char *value, char **valwords );
-LDAP_API(void) LDAP_CALL ldap_getfilter_free( LDAPFiltDesc *lfdp );
+LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_init_getfilter(char *fname);
+LDAP_API(LDAPFiltDesc *)
+LDAP_CALL ldap_init_getfilter_buf(char *buf, long buflen);
+LDAP_API(LDAPFiltInfo *)
+LDAP_CALL ldap_getfirstfilter(LDAPFiltDesc *lfdp, char *tagpat, char *value);
+LDAP_API(LDAPFiltInfo *) LDAP_CALL ldap_getnextfilter(LDAPFiltDesc *lfdp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_set_filter_additions(LDAPFiltDesc *lfdp, char *prefix, char *suffix);
+LDAP_API(int)
+LDAP_CALL ldap_create_filter(char *buf, unsigned long buflen, char *pattern,
+                             char *prefix, char *suffix, char *attr,
+                             char *value, char **valwords);
+LDAP_API(void) LDAP_CALL ldap_getfilter_free(LDAPFiltDesc *lfdp);
 
 /*
  * Friendly mapping structure and routines (an API extension)
  */
 typedef struct friendly {
-        char    *f_unfriendly;
-        char    *f_friendly;
-} *FriendlyMap;
-LDAP_API(char *) LDAP_CALL ldap_friendly_name( char *filename, char *name,
-        FriendlyMap *map );
-LDAP_API(void) LDAP_CALL ldap_free_friendlymap( FriendlyMap *map );
+  char *f_unfriendly;
+  char *f_friendly;
+} * FriendlyMap;
+LDAP_API(char *)
+LDAP_CALL ldap_friendly_name(char *filename, char *name, FriendlyMap *map);
+LDAP_API(void) LDAP_CALL ldap_free_friendlymap(FriendlyMap *map);
 
 /*
  * In Memory Cache (an API extension -- LDAP_API_FEATURE_X_MEMCACHE)
  */
-typedef struct ldapmemcache  LDAPMemCache;  /* opaque in-memory cache handle */
+typedef struct ldapmemcache LDAPMemCache; /* opaque in-memory cache handle */
 
-LDAP_API(int) LDAP_CALL ldap_memcache_init( unsigned long ttl,
-        unsigned long size, char **baseDNs, struct ldap_thread_fns *thread_fns,
-        LDAPMemCache **cachep );
-LDAP_API(int) LDAP_CALL ldap_memcache_set( LDAP *ld, LDAPMemCache *cache );
-LDAP_API(int) LDAP_CALL ldap_memcache_get( LDAP *ld, LDAPMemCache **cachep );
-LDAP_API(void) LDAP_CALL ldap_memcache_flush( LDAPMemCache *cache, char *dn,
-        int scope );
-LDAP_API(void) LDAP_CALL ldap_memcache_flush_results( LDAPMemCache *cache,
-        char *dn, int scope );
-LDAP_API(void) LDAP_CALL ldap_memcache_destroy( LDAPMemCache *cache );
-LDAP_API(void) LDAP_CALL ldap_memcache_update( LDAPMemCache *cache );
+LDAP_API(int)
+LDAP_CALL ldap_memcache_init(unsigned long ttl, unsigned long size,
+                             char **baseDNs, struct ldap_thread_fns *thread_fns,
+                             LDAPMemCache **cachep);
+LDAP_API(int) LDAP_CALL ldap_memcache_set(LDAP *ld, LDAPMemCache *cache);
+LDAP_API(int) LDAP_CALL ldap_memcache_get(LDAP *ld, LDAPMemCache **cachep);
+LDAP_API(void)
+LDAP_CALL ldap_memcache_flush(LDAPMemCache *cache, char *dn, int scope);
+LDAP_API(void)
+LDAP_CALL ldap_memcache_flush_results(LDAPMemCache *cache, char *dn, int scope);
+LDAP_API(void) LDAP_CALL ldap_memcache_destroy(LDAPMemCache *cache);
+LDAP_API(void) LDAP_CALL ldap_memcache_update(LDAPMemCache *cache);
 
 /*
  * Timeout value for nonblocking connect call
  */
-#define LDAP_X_OPT_CONNECT_TIMEOUT    (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F01)
-        /* 0x4000 + 0x0F01 = 0x4F01 = 20225 - API extension */
+#define LDAP_X_OPT_CONNECT_TIMEOUT (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F01)
+/* 0x4000 + 0x0F01 = 0x4F01 = 20225 - API extension */
 
 /*
  * Socket buffer structure associated to the LDAP connection
  */
-#define LDAP_X_OPT_SOCKBUF            (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F03)
-  /* 0x4000 + 0x0F03 = 0x4F03 = 20227 - API extension */
+#define LDAP_X_OPT_SOCKBUF (LDAP_OPT_PRIVATE_EXTENSION_BASE + 0x0F03)
+/* 0x4000 + 0x0F03 = 0x4F03 = 20227 - API extension */
 
 /*
  * Memory allocation callback functions (an API extension --
  * LDAP_API_FEATURE_X_MEMALLOC_FUNCTIONS).  These are global and can
  * not be set on a per-LDAP session handle basis.  Install your own
  * functions by making a call like this:
  *    ldap_set_option( NULL, LDAP_OPT_MEMALLOC_FN_PTRS, &memalloc_fns );
  *
  * look in lber.h for the function typedefs themselves.
  */
-#define LDAP_OPT_MEMALLOC_FN_PTRS       0x61    /* 97 - API extension */
+#define LDAP_OPT_MEMALLOC_FN_PTRS 0x61 /* 97 - API extension */
 
 struct ldap_memalloc_fns {
-        LDAP_MALLOC_CALLBACK    *ldapmem_malloc;
-        LDAP_CALLOC_CALLBACK    *ldapmem_calloc;
-        LDAP_REALLOC_CALLBACK   *ldapmem_realloc;
-        LDAP_FREE_CALLBACK      *ldapmem_free;
+  LDAP_MALLOC_CALLBACK *ldapmem_malloc;
+  LDAP_CALLOC_CALLBACK *ldapmem_calloc;
+  LDAP_REALLOC_CALLBACK *ldapmem_realloc;
+  LDAP_FREE_CALLBACK *ldapmem_free;
 };
 
-
 /*
  * Memory allocation functions (an API extension)
  */
-void *ldap_x_malloc( size_t size );
-void *ldap_x_calloc( size_t nelem, size_t elsize );
-void *ldap_x_realloc( void *ptr, size_t size );
-void ldap_x_free( void *ptr );
+void *ldap_x_malloc(size_t size);
+void *ldap_x_calloc(size_t nelem, size_t elsize);
+void *ldap_x_realloc(void *ptr, size_t size);
+void ldap_x_free(void *ptr);
 
 /*
  * Server reconnect (an API extension).
  */
-#define LDAP_OPT_RECONNECT              0x62    /* 98 - API extension */
-
+#define LDAP_OPT_RECONNECT 0x62 /* 98 - API extension */
 
 /*
  * Extra thread callback functions (an API extension --
  * LDAP_API_FEATURE_X_EXTHREAD_FUNCTIONS)
  */
-#define LDAP_OPT_EXTRA_THREAD_FN_PTRS  0x65     /* 101 - API extension */
+#define LDAP_OPT_EXTRA_THREAD_FN_PTRS 0x65 /* 101 - API extension */
 
 /*
  * When bind is called, don't bind if there's a connection open with the same DN
  */
-#define LDAP_OPT_NOREBIND               0x66    /* 102 - API extension */
+#define LDAP_OPT_NOREBIND 0x66 /* 102 - API extension */
 
-typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_TRYLOCK_CALLBACK)( void *m );
-typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_ALLOC_CALLBACK)( void );
-typedef void (LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_FREE_CALLBACK)( void *s );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_WAIT_CALLBACK)( void *s );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_POST_CALLBACK)( void *s );
+typedef int(LDAP_C LDAP_CALLBACK LDAP_TF_MUTEX_TRYLOCK_CALLBACK)(void *m);
+typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_ALLOC_CALLBACK)(void);
+typedef void(LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_FREE_CALLBACK)(void *s);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_WAIT_CALLBACK)(void *s);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_TF_SEMA_POST_CALLBACK)(void *s);
 typedef void *(LDAP_C LDAP_CALLBACK LDAP_TF_THREADID_CALLBACK)(void);
 
 struct ldap_extra_thread_fns {
-        LDAP_TF_MUTEX_TRYLOCK_CALLBACK *ltf_mutex_trylock;
-        LDAP_TF_SEMA_ALLOC_CALLBACK *ltf_sema_alloc;
-        LDAP_TF_SEMA_FREE_CALLBACK *ltf_sema_free;
-        LDAP_TF_SEMA_WAIT_CALLBACK *ltf_sema_wait;
-        LDAP_TF_SEMA_POST_CALLBACK *ltf_sema_post;
-        LDAP_TF_THREADID_CALLBACK *ltf_threadid_fn;
+  LDAP_TF_MUTEX_TRYLOCK_CALLBACK *ltf_mutex_trylock;
+  LDAP_TF_SEMA_ALLOC_CALLBACK *ltf_sema_alloc;
+  LDAP_TF_SEMA_FREE_CALLBACK *ltf_sema_free;
+  LDAP_TF_SEMA_WAIT_CALLBACK *ltf_sema_wait;
+  LDAP_TF_SEMA_POST_CALLBACK *ltf_sema_post;
+  LDAP_TF_THREADID_CALLBACK *ltf_threadid_fn;
 };
 
 /*
  * Debugging level (an API extension)
  */
-#define LDAP_OPT_DEBUG_LEVEL            0x6E    /* 110 - API extension */
+#define LDAP_OPT_DEBUG_LEVEL 0x6E /* 110 - API extension */
 /* On UNIX, there's only one copy of ldap_debug */
 /* On NT, each dll keeps its own module_ldap_debug, which */
 /* points to the process' ldap_debug and needs initializing after load */
 #ifdef _WIN32
-extern int              *module_ldap_debug;
-typedef void (*set_debug_level_fn_t)(int*);
+extern int *module_ldap_debug;
+typedef void (*set_debug_level_fn_t)(int *);
 #endif
 
 #ifdef LDAP_DNS
-#define LDAP_OPT_DNS                    0x0C    /* 12 - API extension */
+#  define LDAP_OPT_DNS 0x0C /* 12 - API extension */
 #endif
 
 /*
  * UTF-8 routines (should these move into libnls?)
  */
 /* number of bytes in character */
-LDAP_API(int) LDAP_CALL ldap_utf8len( const char* );
+LDAP_API(int) LDAP_CALL ldap_utf8len(const char *);
 /* find next character */
-LDAP_API(char*) LDAP_CALL ldap_utf8next( char* );
+LDAP_API(char *) LDAP_CALL ldap_utf8next(char *);
 /* find previous character */
-LDAP_API(char*) LDAP_CALL ldap_utf8prev( char* );
+LDAP_API(char *) LDAP_CALL ldap_utf8prev(char *);
 /* copy one character */
-LDAP_API(int) LDAP_CALL ldap_utf8copy( char* dst, const char* src );
+LDAP_API(int) LDAP_CALL ldap_utf8copy(char *dst, const char *src);
 /* total number of characters */
-LDAP_API(size_t) LDAP_CALL ldap_utf8characters( const char* );
+LDAP_API(size_t) LDAP_CALL ldap_utf8characters(const char *);
 /* get one UCS-4 character, and move *src to the next character */
-LDAP_API(unsigned long) LDAP_CALL ldap_utf8getcc( const char** src );
+LDAP_API(unsigned long) LDAP_CALL ldap_utf8getcc(const char **src);
 /* UTF-8 aware strtok_r() */
-LDAP_API(char*) LDAP_CALL ldap_utf8strtok_r( char* src, const char* brk, char**
-next);
+LDAP_API(char *)
+LDAP_CALL ldap_utf8strtok_r(char *src, const char *brk, char **next);
 
 /* like isalnum(*s) in the C locale */
-LDAP_API(int) LDAP_CALL ldap_utf8isalnum( char* s );
+LDAP_API(int) LDAP_CALL ldap_utf8isalnum(char *s);
 /* like isalpha(*s) in the C locale */
-LDAP_API(int) LDAP_CALL ldap_utf8isalpha( char* s );
+LDAP_API(int) LDAP_CALL ldap_utf8isalpha(char *s);
 /* like isdigit(*s) in the C locale */
-LDAP_API(int) LDAP_CALL ldap_utf8isdigit( char* s );
+LDAP_API(int) LDAP_CALL ldap_utf8isdigit(char *s);
 /* like isxdigit(*s) in the C locale */
-LDAP_API(int) LDAP_CALL ldap_utf8isxdigit(char* s );
+LDAP_API(int) LDAP_CALL ldap_utf8isxdigit(char *s);
 /* like isspace(*s) in the C locale */
-LDAP_API(int) LDAP_CALL ldap_utf8isspace( char* s );
+LDAP_API(int) LDAP_CALL ldap_utf8isspace(char *s);
 
-#define LDAP_UTF8LEN(s)  ((0x80 & *(unsigned char*)(s)) ?   ldap_utf8len (s) : 1)
-#define LDAP_UTF8NEXT(s) ((0x80 & *(unsigned char*)(s)) ?   ldap_utf8next(s) : ( s)+1)
-#define LDAP_UTF8INC(s)  ((0x80 & *(unsigned char*)(s)) ? s=ldap_utf8next(s) : ++s)
+#define LDAP_UTF8LEN(s) ((0x80 & *(unsigned char *)(s)) ? ldap_utf8len(s) : 1)
+#define LDAP_UTF8NEXT(s) \
+  ((0x80 & *(unsigned char *)(s)) ? ldap_utf8next(s) : (s) + 1)
+#define LDAP_UTF8INC(s) \
+  ((0x80 & *(unsigned char *)(s)) ? s = ldap_utf8next(s) : ++s)
 
-#define LDAP_UTF8PREV(s)   ldap_utf8prev(s)
-#define LDAP_UTF8DEC(s) (s=ldap_utf8prev(s))
+#define LDAP_UTF8PREV(s) ldap_utf8prev(s)
+#define LDAP_UTF8DEC(s) (s = ldap_utf8prev(s))
 
-#define LDAP_UTF8COPY(d,s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8copy(d,s) : ((*(d) = *(s)), 1))
-#define LDAP_UTF8GETCC(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8getcc (&s) : *s++)
-#define LDAP_UTF8GETC(s) ((0x80 & *(unsigned char*)(s)) ? ldap_utf8getcc ((const char**)&s) : *s++)
+#define LDAP_UTF8COPY(d, s) \
+  ((0x80 & *(unsigned char *)(s)) ? ldap_utf8copy(d, s) : ((*(d) = *(s)), 1))
+#define LDAP_UTF8GETCC(s) \
+  ((0x80 & *(unsigned char *)(s)) ? ldap_utf8getcc(&s) : *s++)
+#define LDAP_UTF8GETC(s) \
+  ((0x80 & *(unsigned char *)(s)) ? ldap_utf8getcc((const char **)&s) : *s++)
 
 /* SASL options */
-#define LDAP_OPT_X_SASL_MECH            0x6100
-#define LDAP_OPT_X_SASL_REALM           0x6101
-#define LDAP_OPT_X_SASL_AUTHCID         0x6102
-#define LDAP_OPT_X_SASL_AUTHZID         0x6103
-#define LDAP_OPT_X_SASL_SSF             0x6104 /* read-only */
-#define LDAP_OPT_X_SASL_SSF_EXTERNAL    0x6105 /* write-only */
-#define LDAP_OPT_X_SASL_SECPROPS        0x6106 /* write-only */
-#define LDAP_OPT_X_SASL_SSF_MIN         0x6107
-#define LDAP_OPT_X_SASL_SSF_MAX         0x6108
-#define LDAP_OPT_X_SASL_MAXBUFSIZE      0x6109
+#define LDAP_OPT_X_SASL_MECH 0x6100
+#define LDAP_OPT_X_SASL_REALM 0x6101
+#define LDAP_OPT_X_SASL_AUTHCID 0x6102
+#define LDAP_OPT_X_SASL_AUTHZID 0x6103
+#define LDAP_OPT_X_SASL_SSF 0x6104          /* read-only */
+#define LDAP_OPT_X_SASL_SSF_EXTERNAL 0x6105 /* write-only */
+#define LDAP_OPT_X_SASL_SECPROPS 0x6106     /* write-only */
+#define LDAP_OPT_X_SASL_SSF_MIN 0x6107
+#define LDAP_OPT_X_SASL_SSF_MAX 0x6108
+#define LDAP_OPT_X_SASL_MAXBUFSIZE 0x6109
 
 /* ldap_interactive_bind_s Interaction flags
  *  Interactive: prompt always - REQUIRED
  */
-#define LDAP_SASL_AUTOMATIC     0U /* only prompt for missing items not supplied as defaults */
-#define LDAP_SASL_INTERACTIVE   1U /* prompt for everything and print defaults, if any */
-#define LDAP_SASL_QUIET         2U /* no prompts - only use defaults (e.g. for non-interactive apps) */
+#define LDAP_SASL_AUTOMATIC \
+  0U /* only prompt for missing items not supplied as defaults */
+#define LDAP_SASL_INTERACTIVE \
+  1U /* prompt for everything and print defaults, if any */
+#define LDAP_SASL_QUIET \
+  2U /* no prompts - only use defaults (e.g. for non-interactive apps) */
 
 /*
  * V3 SASL Interaction Function Callback Prototype
  *      when using Cyrus SASL, interact is pointer to sasl_interact_t
  *  should likely passed in a control (and provided controls)
  */
-typedef int (LDAP_SASL_INTERACT_PROC)
-        (LDAP *ld, unsigned flags, void* defaults, void *interact );
+typedef int(LDAP_SASL_INTERACT_PROC)(LDAP *ld, unsigned flags, void *defaults,
+                                     void *interact);
 
-LDAP_API(int) LDAP_CALL ldap_sasl_interactive_bind_s (
-        LDAP *ld,
-        const char *dn, /* usually NULL */
-        const char *saslMechanism,
-        LDAPControl **serverControls,
-        LDAPControl **clientControls,
+LDAP_API(int)
+LDAP_CALL
+    ldap_sasl_interactive_bind_s(LDAP *ld, const char *dn, /* usually NULL */
+                                 const char *saslMechanism,
+                                 LDAPControl **serverControls,
+                                 LDAPControl **clientControls,
 
-        /* should be client controls */
-        unsigned flags,
-        LDAP_SASL_INTERACT_PROC *proc,
-        void *defaults );
+                                 /* should be client controls */
+                                 unsigned flags, LDAP_SASL_INTERACT_PROC *proc,
+                                 void *defaults);
 
-LDAP_API(int) LDAP_CALL ldap_sasl_interactive_bind_ext_s (
-        LDAP *ld,
-        const char *dn, /* usually NULL */
-        const char *saslMechanism,
-        LDAPControl **serverControls,
-        LDAPControl **clientControls,
+LDAP_API(int)
+LDAP_CALL ldap_sasl_interactive_bind_ext_s(
+    LDAP *ld, const char *dn, /* usually NULL */
+    const char *saslMechanism, LDAPControl **serverControls,
+    LDAPControl **clientControls,
 
-        /* should be client controls */
-        unsigned flags,
-        LDAP_SASL_INTERACT_PROC *proc,
-        void *defaults,
-        LDAPControl ***responseControls );
+    /* should be client controls */
+    unsigned flags, LDAP_SASL_INTERACT_PROC *proc, void *defaults,
+    LDAPControl ***responseControls);
 
 /*
  * Password modify functions
  */
-LDAP_API(int) LDAP_CALL ldap_passwd( LDAP *ld, struct berval *userid,
-  struct berval *oldpasswd, struct berval *newpasswd,
-  LDAPControl **serverctrls, LDAPControl **clientctrls,
-  int *msgidp );
+LDAP_API(int)
+LDAP_CALL ldap_passwd(LDAP *ld, struct berval *userid, struct berval *oldpasswd,
+                      struct berval *newpasswd, LDAPControl **serverctrls,
+                      LDAPControl **clientctrls, int *msgidp);
 
-LDAP_API(int) LDAP_CALL ldap_passwd_s( LDAP *ld, struct berval *userid,
-  struct berval *oldpasswd, struct berval *newpasswd,
-  struct berval *genpasswd, LDAPControl **serverctrls,
-  LDAPControl **clientctrls );
+LDAP_API(int)
+LDAP_CALL
+    ldap_passwd_s(LDAP *ld, struct berval *userid, struct berval *oldpasswd,
+                  struct berval *newpasswd, struct berval *genpasswd,
+                  LDAPControl **serverctrls, LDAPControl **clientctrls);
 
-LDAP_API(int) LDAP_CALL ldap_parse_passwd( LDAP *ld, LDAPMessage *result,
-  struct berval *genpasswd );
+LDAP_API(int)
+LDAP_CALL
+    ldap_parse_passwd(LDAP *ld, LDAPMessage *result, struct berval *genpasswd);
 
 /*
  * in reslist.c
  */
-LDAP_API(LDAPMessage *) LDAP_CALL ldap_delete_result_entry( LDAPMessage **list, LDAPMessage *e );
-LDAP_API(void) LDAP_CALL ldap_add_result_entry( LDAPMessage **list, LDAPMessage *e );
+LDAP_API(LDAPMessage *)
+LDAP_CALL ldap_delete_result_entry(LDAPMessage **list, LDAPMessage *e);
+LDAP_API(void)
+LDAP_CALL ldap_add_result_entry(LDAPMessage **list, LDAPMessage *e);
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* _LDAP_EXTENSION_H */
-
--- a/ldap/c-sdk/include/ldap-platform.h
+++ b/ldap/c-sdk/include/ldap-platform.h
@@ -39,53 +39,53 @@
 
 #ifndef _LDAP_PLATFORM_H
 #define _LDAP_PLATFORM_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#if defined (WIN32) || defined (_WIN32) || defined( _CONSOLE )
-#include <windows.h>
-#  if defined( _WINDOWS )
-#  include <winsock.h>
+#if defined(WIN32) || defined(_WIN32) || defined(_CONSOLE)
+#  include <windows.h>
+#  if defined(_WINDOWS)
+#    include <winsock.h>
 #  endif
 #elif defined(macintosh)
-#ifndef LDAP_TYPE_TIMEVAL_DEFINED
-#include <utime.h>
-#endif
-#ifndef LDAP_TYPE_SOCKET_DEFINED  /* API extension */
-#include "macsocket.h"
-#endif
+#  ifndef LDAP_TYPE_TIMEVAL_DEFINED
+#    include <utime.h>
+#  endif
+#  ifndef LDAP_TYPE_SOCKET_DEFINED /* API extension */
+#    include "macsocket.h"
+#  endif
 #else /* everything else, e.g., Unix */
-#ifndef LDAP_TYPE_TIMEVAL_DEFINED
-#include <sys/time.h>
-#endif
-#ifndef LDAP_TYPE_SOCKET_DEFINED  /* API extension */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
+#  ifndef LDAP_TYPE_TIMEVAL_DEFINED
+#    include <sys/time.h>
+#  endif
+#  ifndef LDAP_TYPE_SOCKET_DEFINED /* API extension */
+#    include <sys/types.h>
+#    include <sys/socket.h>
+#  endif
 #endif
 
 #ifdef _AIX
-#include <sys/select.h>
+#  include <sys/select.h>
 #endif /* _AIX */
 
 #ifdef XP_OS2
-#include <sys/select.h>
+#  include <sys/select.h>
 #endif /* XP_OS2 */
 
 /*
  * LDAP_API macro definition:
  */
 #ifndef LDAP_API
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#define LDAP_API(rt) rt
-#else /* _WINDOWS */
-#define LDAP_API(rt) rt
-#endif /* _WINDOWS */
-#endif /* LDAP_API */
+#  if defined(_WINDOWS) || defined(_WIN32)
+#    define LDAP_API(rt) rt
+#  else /* _WINDOWS */
+#    define LDAP_API(rt) rt
+#  endif /* _WINDOWS */
+#endif   /* LDAP_API */
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* _LDAP_PLATFORM_H */
--- a/ldap/c-sdk/include/ldap-standard.h
+++ b/ldap/c-sdk/include/ldap-standard.h
@@ -52,17 +52,17 @@ extern "C" {
 
 #define LDAP_PORT 389
 #define LDAPS_PORT 636
 #define LDAP_VERSION2 2
 #define LDAP_VERSION3 3
 #define LDAP_VERSION_MIN LDAP_VERSION1
 #define LDAP_VERSION_MAX LDAP_VERSION3
 
-#define LDAP_VENDOR_VERSION 607  /* version # * 100 */
+#define LDAP_VENDOR_VERSION 607 /* version # * 100 */
 #define LDAP_VENDOR_NAME "mozilla.org"
 /*
  * The following will be an RFC number once the LDAP C API Internet Draft
  * is published as a Proposed Standard RFC.  For now we use 2000 + the
  * draft revision number (currently 5) since we are close to compliance
  * with revision 5 of the draft.
  */
 #define LDAP_API_VERSION 2005
@@ -70,207 +70,203 @@ extern "C" {
 /* special values that may appear in the attributes field of a SearchRequest.
  */
 #define LDAP_NO_ATTRS "1.1"
 #define LDAP_ALL_USER_ATTRS "*"
 
 /*
  * Standard options (used with ldap_set_option() and ldap_get_option):
  */
-#define LDAP_OPT_API_INFO         0x00  /*  0 */
-#define LDAP_OPT_DEREF            0x02  /*  2 */
-#define LDAP_OPT_SIZELIMIT        0x03  /*  3 */
-#define LDAP_OPT_TIMELIMIT        0x04  /*  4 */
-#define LDAP_OPT_REFERRALS        0x08  /*  8 */
-#define LDAP_OPT_RESTART          0x09  /*  9 */
-#define LDAP_OPT_PROTOCOL_VERSION 0x11  /* 17 */
-#define LDAP_OPT_SERVER_CONTROLS  0x12  /* 18 */
-#define LDAP_OPT_CLIENT_CONTROLS  0x13  /* 19 */
-#define LDAP_OPT_API_FEATURE_INFO 0x15  /* 21 */
-#define LDAP_OPT_HOST_NAME        0x30  /* 48 */
-#define LDAP_OPT_ERROR_NUMBER     0x31  /* 49 */
-#define LDAP_OPT_ERROR_STRING     0x32  /* 50 */
-#define LDAP_OPT_MATCHED_DN       0x33  /* 51 */
+#define LDAP_OPT_API_INFO 0x00         /*  0 */
+#define LDAP_OPT_DEREF 0x02            /*  2 */
+#define LDAP_OPT_SIZELIMIT 0x03        /*  3 */
+#define LDAP_OPT_TIMELIMIT 0x04        /*  4 */
+#define LDAP_OPT_REFERRALS 0x08        /*  8 */
+#define LDAP_OPT_RESTART 0x09          /*  9 */
+#define LDAP_OPT_PROTOCOL_VERSION 0x11 /* 17 */
+#define LDAP_OPT_SERVER_CONTROLS 0x12  /* 18 */
+#define LDAP_OPT_CLIENT_CONTROLS 0x13  /* 19 */
+#define LDAP_OPT_API_FEATURE_INFO 0x15 /* 21 */
+#define LDAP_OPT_HOST_NAME 0x30        /* 48 */
+#define LDAP_OPT_ERROR_NUMBER 0x31     /* 49 */
+#define LDAP_OPT_ERROR_STRING 0x32     /* 50 */
+#define LDAP_OPT_MATCHED_DN 0x33       /* 51 */
 
 /*
  * Well-behaved private and experimental extensions will use option values
  * between 0x4000 (16384) and 0x7FFF (32767) inclusive.
  */
-#define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x4000  /* to 0x7FFF inclusive */
+#define LDAP_OPT_PRIVATE_EXTENSION_BASE 0x4000 /* to 0x7FFF inclusive */
 
 /* for on/off options */
-#define LDAP_OPT_ON  ((void *)1)
+#define LDAP_OPT_ON ((void *)1)
 #define LDAP_OPT_OFF ((void *)0)
 
-typedef struct ldap     LDAP;         /* opaque connection handle */
-typedef struct ldapmsg  LDAPMessage;  /* opaque result/entry handle */
+typedef struct ldap LDAP;           /* opaque connection handle */
+typedef struct ldapmsg LDAPMessage; /* opaque result/entry handle */
 
 /* structure representing an LDAP modification */
 typedef struct ldapmod {
-  int mod_op;  /* kind of mod + form of values*/
-#define LDAP_MOD_ADD     0x00
-#define LDAP_MOD_DELETE  0x01
+  int mod_op; /* kind of mod + form of values*/
+#define LDAP_MOD_ADD 0x00
+#define LDAP_MOD_DELETE 0x01
 #define LDAP_MOD_REPLACE 0x02
 #define LDAP_MOD_BVALUES 0x80
-  char *mod_type;  /* attribute name to modify */
+  char *mod_type; /* attribute name to modify */
   union mod_vals_u {
-    char            **modv_strvals;
-    struct berval   **modv_bvals;
-  } mod_vals;  /* values to add/delete/replace */
-#define mod_values  mod_vals.modv_strvals
+    char **modv_strvals;
+    struct berval **modv_bvals;
+  } mod_vals; /* values to add/delete/replace */
+#define mod_values mod_vals.modv_strvals
 #define mod_bvalues mod_vals.modv_bvals
 } LDAPMod;
 
-
 /*
  * structure for holding ldapv3 controls
  */
 typedef struct ldapcontrol {
-    char            *ldctl_oid;
-    struct berval   ldctl_value;
-    char            ldctl_iscritical;
+  char *ldctl_oid;
+  struct berval ldctl_value;
+  char ldctl_iscritical;
 } LDAPControl;
 
-
 /*
  * LDAP API information.  Can be retrieved by using a sequence like:
  *
  *    LDAPAPIInfo ldai;
  *    ldai.ldapai_info_version = LDAP_API_INFO_VERSION;
  *    if ( ldap_get_option( NULL, LDAP_OPT_API_INFO, &ldia ) == 0 ) ...
  */
 #define LDAP_API_INFO_VERSION 1
 typedef struct ldapapiinfo {
-    int  ldapai_info_version;     /* version of this struct (1) */
-    int  ldapai_api_version;      /* revision of API supported */
-    int  ldapai_protocol_version; /* highest LDAP version supported */
-    char **ldapai_extensions;     /* names of API extensions */
-    char *ldapai_vendor_name;     /* name of supplier */
-    int  ldapai_vendor_version;   /* supplier-specific version times 100 */
+  int ldapai_info_version;     /* version of this struct (1) */
+  int ldapai_api_version;      /* revision of API supported */
+  int ldapai_protocol_version; /* highest LDAP version supported */
+  char **ldapai_extensions;    /* names of API extensions */
+  char *ldapai_vendor_name;    /* name of supplier */
+  int ldapai_vendor_version;   /* supplier-specific version times 100 */
 } LDAPAPIInfo;
 
-
 /*
  * LDAP API extended features info.  Can be retrieved by using a sequence like:
  *
  *    LDAPAPIFeatureInfo ldfi;
  *    ldfi.ldapaif_info_version = LDAP_FEATURE_INFO_VERSION;
  *    ldfi.ldapaif_name = "VIRTUAL_LIST_VIEW";
  *    if ( ldap_get_option( NULL, LDAP_OPT_API_FEATURE_INFO, &ldfi ) == 0 ) ...
  */
 #define LDAP_FEATURE_INFO_VERSION 1
 typedef struct ldap_apifeature_info {
-    int   ldapaif_info_version;  /* version of this struct (1) */
-    char  *ldapaif_name;  /* name of supported feature */
-    int   ldapaif_version;  /* revision of supported feature */
+  int ldapaif_info_version; /* version of this struct (1) */
+  char *ldapaif_name;       /* name of supported feature */
+  int ldapaif_version;      /* revision of supported feature */
 } LDAPAPIFeatureInfo;
 
-
 /* possible result types a server can return */
-#define LDAP_RES_BIND             0x61L  /* 97 */
-#define LDAP_RES_SEARCH_ENTRY     0x64L  /* 100 */
-#define LDAP_RES_SEARCH_RESULT    0x65L  /* 101 */
-#define LDAP_RES_MODIFY           0x67L  /* 103 */
-#define LDAP_RES_ADD              0x69L  /* 105 */
-#define LDAP_RES_DELETE           0x6BL  /* 107 */
-#define LDAP_RES_MODDN            0x6DL  /* 109 */
-#define LDAP_RES_COMPARE          0x6FL  /* 111 */
-#define LDAP_RES_SEARCH_REFERENCE 0x73L  /* 115 */
-#define LDAP_RES_EXTENDED         0x78L  /* 120 */
+#define LDAP_RES_BIND 0x61L             /* 97 */
+#define LDAP_RES_SEARCH_ENTRY 0x64L     /* 100 */
+#define LDAP_RES_SEARCH_RESULT 0x65L    /* 101 */
+#define LDAP_RES_MODIFY 0x67L           /* 103 */
+#define LDAP_RES_ADD 0x69L              /* 105 */
+#define LDAP_RES_DELETE 0x6BL           /* 107 */
+#define LDAP_RES_MODDN 0x6DL            /* 109 */
+#define LDAP_RES_COMPARE 0x6FL          /* 111 */
+#define LDAP_RES_SEARCH_REFERENCE 0x73L /* 115 */
+#define LDAP_RES_EXTENDED 0x78L         /* 120 */
 
 /* Special values for ldap_result() "msgid" parameter */
-#define LDAP_RES_ANY                (-1)
+#define LDAP_RES_ANY (-1)
 #define LDAP_RES_UNSOLICITED 0
 
 /* built-in SASL methods */
-#define LDAP_SASL_SIMPLE 0  /* special value used for simple bind */
+#define LDAP_SASL_SIMPLE 0 /* special value used for simple bind */
 
 /* search scopes */
-#define LDAP_SCOPE_BASE      0x00
-#define LDAP_SCOPE_ONELEVEL  0x01
-#define LDAP_SCOPE_SUBTREE   0x02
+#define LDAP_SCOPE_BASE 0x00
+#define LDAP_SCOPE_ONELEVEL 0x01
+#define LDAP_SCOPE_SUBTREE 0x02
 
 /* alias dereferencing */
-#define LDAP_DEREF_NEVER     0x00
+#define LDAP_DEREF_NEVER 0x00
 #define LDAP_DEREF_SEARCHING 0x01
-#define LDAP_DEREF_FINDING   0x02
-#define LDAP_DEREF_ALWAYS    0x03
+#define LDAP_DEREF_FINDING 0x02
+#define LDAP_DEREF_ALWAYS 0x03
 
 /* predefined size/time limits */
-#define LDAP_NO_LIMIT           0
+#define LDAP_NO_LIMIT 0
 
 /* allowed values for "all" ldap_result() parameter */
 #define LDAP_MSG_ONE 0x00
 #define LDAP_MSG_ALL 0x01
 #define LDAP_MSG_RECEIVED 0x02
 
 /* possible error codes we can be returned */
-#define LDAP_SUCCESS                    0x00  /* 0 */
-#define LDAP_OPERATIONS_ERROR           0x01  /* 1 */
-#define LDAP_PROTOCOL_ERROR             0x02  /* 2 */
-#define LDAP_TIMELIMIT_EXCEEDED         0x03  /* 3 */
-#define LDAP_SIZELIMIT_EXCEEDED         0x04  /* 4 */
-#define LDAP_COMPARE_FALSE              0x05  /* 5 */
-#define LDAP_COMPARE_TRUE               0x06  /* 6 */
-#define LDAP_STRONG_AUTH_NOT_SUPPORTED  0x07  /* 7 */
-#define LDAP_STRONG_AUTH_REQUIRED       0x08  /* 8 */
-#define LDAP_REFERRAL                   0x0a  /* 10 - LDAPv3 */
-#define LDAP_ADMINLIMIT_EXCEEDED        0x0b  /* 11 - LDAPv3 */
-#define LDAP_UNAVAILABLE_CRITICAL_EXTENSION  0x0c /* 12 - LDAPv3 */
-#define LDAP_CONFIDENTIALITY_REQUIRED   0x0d  /* 13 */
-#define LDAP_SASL_BIND_IN_PROGRESS      0x0e  /* 14 - LDAPv3 */
+#define LDAP_SUCCESS 0x00                        /* 0 */
+#define LDAP_OPERATIONS_ERROR 0x01               /* 1 */
+#define LDAP_PROTOCOL_ERROR 0x02                 /* 2 */
+#define LDAP_TIMELIMIT_EXCEEDED 0x03             /* 3 */
+#define LDAP_SIZELIMIT_EXCEEDED 0x04             /* 4 */
+#define LDAP_COMPARE_FALSE 0x05                  /* 5 */
+#define LDAP_COMPARE_TRUE 0x06                   /* 6 */
+#define LDAP_STRONG_AUTH_NOT_SUPPORTED 0x07      /* 7 */
+#define LDAP_STRONG_AUTH_REQUIRED 0x08           /* 8 */
+#define LDAP_REFERRAL 0x0a                       /* 10 - LDAPv3 */
+#define LDAP_ADMINLIMIT_EXCEEDED 0x0b            /* 11 - LDAPv3 */
+#define LDAP_UNAVAILABLE_CRITICAL_EXTENSION 0x0c /* 12 - LDAPv3 */
+#define LDAP_CONFIDENTIALITY_REQUIRED 0x0d       /* 13 */
+#define LDAP_SASL_BIND_IN_PROGRESS 0x0e          /* 14 - LDAPv3 */
 
-#define LDAP_NO_SUCH_ATTRIBUTE          0x10  /* 16 */
-#define LDAP_UNDEFINED_TYPE             0x11  /* 17 */
-#define LDAP_INAPPROPRIATE_MATCHING     0x12  /* 18 */
-#define LDAP_CONSTRAINT_VIOLATION       0x13  /* 19 */
-#define LDAP_TYPE_OR_VALUE_EXISTS       0x14  /* 20 */
-#define LDAP_INVALID_SYNTAX             0x15  /* 21 */
+#define LDAP_NO_SUCH_ATTRIBUTE 0x10      /* 16 */
+#define LDAP_UNDEFINED_TYPE 0x11         /* 17 */
+#define LDAP_INAPPROPRIATE_MATCHING 0x12 /* 18 */
+#define LDAP_CONSTRAINT_VIOLATION 0x13   /* 19 */
+#define LDAP_TYPE_OR_VALUE_EXISTS 0x14   /* 20 */
+#define LDAP_INVALID_SYNTAX 0x15         /* 21 */
 
-#define LDAP_NO_SUCH_OBJECT             0x20  /* 32 */
-#define LDAP_ALIAS_PROBLEM              0x21  /* 33 */
-#define LDAP_INVALID_DN_SYNTAX          0x22  /* 34 */
-#define LDAP_IS_LEAF                    0x23  /* 35 (not used in LDAPv3) */
-#define LDAP_ALIAS_DEREF_PROBLEM        0x24  /* 36 */
+#define LDAP_NO_SUCH_OBJECT 0x20      /* 32 */
+#define LDAP_ALIAS_PROBLEM 0x21       /* 33 */
+#define LDAP_INVALID_DN_SYNTAX 0x22   /* 34 */
+#define LDAP_IS_LEAF 0x23             /* 35 (not used in LDAPv3) */
+#define LDAP_ALIAS_DEREF_PROBLEM 0x24 /* 36 */
 
-#define LDAP_INAPPROPRIATE_AUTH         0x30  /* 48 */
-#define LDAP_INVALID_CREDENTIALS        0x31  /* 49 */
-#define LDAP_INSUFFICIENT_ACCESS        0x32  /* 50 */
-#define LDAP_BUSY                       0x33  /* 51 */
-#define LDAP_UNAVAILABLE                0x34  /* 52 */
-#define LDAP_UNWILLING_TO_PERFORM       0x35  /* 53 */
-#define LDAP_LOOP_DETECT                0x36  /* 54 */
+#define LDAP_INAPPROPRIATE_AUTH 0x30   /* 48 */
+#define LDAP_INVALID_CREDENTIALS 0x31  /* 49 */
+#define LDAP_INSUFFICIENT_ACCESS 0x32  /* 50 */
+#define LDAP_BUSY 0x33                 /* 51 */
+#define LDAP_UNAVAILABLE 0x34          /* 52 */
+#define LDAP_UNWILLING_TO_PERFORM 0x35 /* 53 */
+#define LDAP_LOOP_DETECT 0x36          /* 54 */
 
-#define LDAP_NAMING_VIOLATION           0x40  /* 64 */
-#define LDAP_OBJECT_CLASS_VIOLATION     0x41  /* 65 */
-#define LDAP_NOT_ALLOWED_ON_NONLEAF     0x42  /* 66 */
-#define LDAP_NOT_ALLOWED_ON_RDN         0x43  /* 67 */
-#define LDAP_ALREADY_EXISTS             0x44  /* 68 */
-#define LDAP_NO_OBJECT_CLASS_MODS       0x45  /* 69 */
-#define LDAP_RESULTS_TOO_LARGE          0x46  /* 70 - CLDAP */
-#define LDAP_AFFECTS_MULTIPLE_DSAS      0x47  /* 71 */
+#define LDAP_NAMING_VIOLATION 0x40       /* 64 */
+#define LDAP_OBJECT_CLASS_VIOLATION 0x41 /* 65 */
+#define LDAP_NOT_ALLOWED_ON_NONLEAF 0x42 /* 66 */
+#define LDAP_NOT_ALLOWED_ON_RDN 0x43     /* 67 */
+#define LDAP_ALREADY_EXISTS 0x44         /* 68 */
+#define LDAP_NO_OBJECT_CLASS_MODS 0x45   /* 69 */
+#define LDAP_RESULTS_TOO_LARGE 0x46      /* 70 - CLDAP */
+#define LDAP_AFFECTS_MULTIPLE_DSAS 0x47  /* 71 */
 
-#define LDAP_OTHER                      0x50  /* 80 */
-#define LDAP_SERVER_DOWN                0x51  /* 81 */
-#define LDAP_LOCAL_ERROR                0x52  /* 82 */
-#define LDAP_ENCODING_ERROR             0x53  /* 83 */
-#define LDAP_DECODING_ERROR             0x54  /* 84 */
-#define LDAP_TIMEOUT                    0x55  /* 85 */
-#define LDAP_AUTH_UNKNOWN               0x56  /* 86 */
-#define LDAP_FILTER_ERROR               0x57  /* 87 */
-#define LDAP_USER_CANCELLED             0x58  /* 88 */
-#define LDAP_PARAM_ERROR                0x59  /* 89 */
-#define LDAP_NO_MEMORY                  0x5a  /* 90 */
-#define LDAP_CONNECT_ERROR              0x5b  /* 91 */
-#define LDAP_NOT_SUPPORTED              0x5c  /* 92 - LDAPv3 */
-#define LDAP_CONTROL_NOT_FOUND          0x5d  /* 93 - LDAPv3 */
-#define LDAP_NO_RESULTS_RETURNED        0x5e  /* 94 - LDAPv3 */
-#define LDAP_MORE_RESULTS_TO_RETURN     0x5f  /* 95 - LDAPv3 */
-#define LDAP_CLIENT_LOOP                0x60  /* 96 - LDAPv3 */
-#define LDAP_REFERRAL_LIMIT_EXCEEDED    0x61  /* 97 - LDAPv3 */
+#define LDAP_OTHER 0x50                   /* 80 */
+#define LDAP_SERVER_DOWN 0x51             /* 81 */
+#define LDAP_LOCAL_ERROR 0x52             /* 82 */
+#define LDAP_ENCODING_ERROR 0x53          /* 83 */
+#define LDAP_DECODING_ERROR 0x54          /* 84 */
+#define LDAP_TIMEOUT 0x55                 /* 85 */
+#define LDAP_AUTH_UNKNOWN 0x56            /* 86 */
+#define LDAP_FILTER_ERROR 0x57            /* 87 */
+#define LDAP_USER_CANCELLED 0x58          /* 88 */
+#define LDAP_PARAM_ERROR 0x59             /* 89 */
+#define LDAP_NO_MEMORY 0x5a               /* 90 */
+#define LDAP_CONNECT_ERROR 0x5b           /* 91 */
+#define LDAP_NOT_SUPPORTED 0x5c           /* 92 - LDAPv3 */
+#define LDAP_CONTROL_NOT_FOUND 0x5d       /* 93 - LDAPv3 */
+#define LDAP_NO_RESULTS_RETURNED 0x5e     /* 94 - LDAPv3 */
+#define LDAP_MORE_RESULTS_TO_RETURN 0x5f  /* 95 - LDAPv3 */
+#define LDAP_CLIENT_LOOP 0x60             /* 96 - LDAPv3 */
+#define LDAP_REFERRAL_LIMIT_EXCEEDED 0x61 /* 97 - LDAPv3 */
 
 /*
  * LDAPv3 unsolicited notification messages we know about
  */
 #define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036"
 
 /*
  * Client controls we know about
@@ -280,178 +276,210 @@ typedef struct ldap_apifeature_info {
 /*
  * Initializing an ldap session, set session handle options, and
  * closing an ldap session functions
  *
  * NOTE: If you want to use IPv6, you must use prldap creating a LDAP handle
  * with prldap_init instead of ldap_init. Or install the NSPR functions
  * by calling prldap_install_routines. (See the nspr samples in examples)
  */
-LDAP_API(LDAP *) LDAP_CALL ldap_init( const char *defhost, int defport );
-LDAP_API(int) LDAP_CALL ldap_set_option( LDAP *ld, int option,
-  const void *optdata );
-LDAP_API(int) LDAP_CALL ldap_get_option( LDAP *ld, int option, void *optdata );
-LDAP_API(int) LDAP_CALL ldap_unbind( LDAP *ld );
-LDAP_API(int) LDAP_CALL ldap_unbind_s( LDAP *ld );
+LDAP_API(LDAP *) LDAP_CALL ldap_init(const char *defhost, int defport);
+LDAP_API(int)
+LDAP_CALL ldap_set_option(LDAP *ld, int option, const void *optdata);
+LDAP_API(int) LDAP_CALL ldap_get_option(LDAP *ld, int option, void *optdata);
+LDAP_API(int) LDAP_CALL ldap_unbind(LDAP *ld);
+LDAP_API(int) LDAP_CALL ldap_unbind_s(LDAP *ld);
 
 /*
  * perform ldap operations
  */
-LDAP_API(int) LDAP_CALL ldap_abandon( LDAP *ld, int msgid );
-LDAP_API(int) LDAP_CALL ldap_add( LDAP *ld, const char *dn, LDAPMod **attrs );
-LDAP_API(int) LDAP_CALL ldap_add_s( LDAP *ld, const char *dn, LDAPMod **attrs );
-LDAP_API(int) LDAP_CALL ldap_simple_bind( LDAP *ld, const char *who,
-  const char *passwd );
-LDAP_API(int) LDAP_CALL ldap_simple_bind_s( LDAP *ld, const char *who,
-  const char *passwd );
-LDAP_API(int) LDAP_CALL ldap_modify( LDAP *ld, const char *dn, LDAPMod **mods );
-LDAP_API(int) LDAP_CALL ldap_modify_s( LDAP *ld, const char *dn,
-  LDAPMod **mods );
-LDAP_API(int) LDAP_CALL ldap_compare( LDAP *ld, const char *dn,
-  const char *attr, const char *value );
-LDAP_API(int) LDAP_CALL ldap_compare_s( LDAP *ld, const char *dn,
-  const char *attr, const char *value );
-LDAP_API(int) LDAP_CALL ldap_delete( LDAP *ld, const char *dn );
-LDAP_API(int) LDAP_CALL ldap_delete_s( LDAP *ld, const char *dn );
-LDAP_API(int) LDAP_CALL ldap_search( LDAP *ld, const char *base, int scope,
-  const char *filter, char **attrs, int attrsonly );
-LDAP_API(int) LDAP_CALL ldap_search_s( LDAP *ld, const char *base, int scope,
-  const char *filter, char **attrs, int attrsonly, LDAPMessage **res );
-LDAP_API(int) LDAP_CALL ldap_search_st( LDAP *ld, const char *base, int scope,
-  const char *filter, char **attrs, int attrsonly,
-  struct timeval *timeout, LDAPMessage **res );
+LDAP_API(int) LDAP_CALL ldap_abandon(LDAP *ld, int msgid);
+LDAP_API(int) LDAP_CALL ldap_add(LDAP *ld, const char *dn, LDAPMod **attrs);
+LDAP_API(int) LDAP_CALL ldap_add_s(LDAP *ld, const char *dn, LDAPMod **attrs);
+LDAP_API(int)
+LDAP_CALL ldap_simple_bind(LDAP *ld, const char *who, const char *passwd);
+LDAP_API(int)
+LDAP_CALL ldap_simple_bind_s(LDAP *ld, const char *who, const char *passwd);
+LDAP_API(int) LDAP_CALL ldap_modify(LDAP *ld, const char *dn, LDAPMod **mods);
+LDAP_API(int) LDAP_CALL ldap_modify_s(LDAP *ld, const char *dn, LDAPMod **mods);
+LDAP_API(int)
+LDAP_CALL
+    ldap_compare(LDAP *ld, const char *dn, const char *attr, const char *value);
+LDAP_API(int)
+LDAP_CALL ldap_compare_s(LDAP *ld, const char *dn, const char *attr,
+                         const char *value);
+LDAP_API(int) LDAP_CALL ldap_delete(LDAP *ld, const char *dn);
+LDAP_API(int) LDAP_CALL ldap_delete_s(LDAP *ld, const char *dn);
+LDAP_API(int)
+LDAP_CALL ldap_search(LDAP *ld, const char *base, int scope, const char *filter,
+                      char **attrs, int attrsonly);
+LDAP_API(int)
+LDAP_CALL
+    ldap_search_s(LDAP *ld, const char *base, int scope, const char *filter,
+                  char **attrs, int attrsonly, LDAPMessage **res);
+LDAP_API(int)
+LDAP_CALL ldap_search_st(LDAP *ld, const char *base, int scope,
+                         const char *filter, char **attrs, int attrsonly,
+                         struct timeval *timeout, LDAPMessage **res);
 
 /*
  * obtain result from ldap operation
  */
-LDAP_API(int) LDAP_CALL ldap_result( LDAP *ld, int msgid, int all,
-  struct timeval *timeout, LDAPMessage **result );
+LDAP_API(int)
+LDAP_CALL ldap_result(LDAP *ld, int msgid, int all, struct timeval *timeout,
+                      LDAPMessage **result);
 
 /*
  * peeking inside LDAP Messages and deallocating LDAP Messages
  */
-LDAP_API(int) LDAP_CALL ldap_msgfree( LDAPMessage *lm );
-LDAP_API(int) LDAP_CALL ldap_msgid( LDAPMessage *lm );
-LDAP_API(int) LDAP_CALL ldap_msgtype( LDAPMessage *lm );
-
+LDAP_API(int) LDAP_CALL ldap_msgfree(LDAPMessage *lm);
+LDAP_API(int) LDAP_CALL ldap_msgid(LDAPMessage *lm);
+LDAP_API(int) LDAP_CALL ldap_msgtype(LDAPMessage *lm);
 
 /*
  * Routines to parse/deal with results and errors returned
  */
-LDAP_API(char *) LDAP_CALL ldap_err2string( int err );
-LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_entry( LDAP *ld,
-  LDAPMessage *chain );
-LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_entry( LDAP *ld,
-  LDAPMessage *entry );
-LDAP_API(int) LDAP_CALL ldap_count_entries( LDAP *ld, LDAPMessage *chain );
-LDAP_API(char *) LDAP_CALL ldap_get_dn( LDAP *ld, LDAPMessage *entry );
-LDAP_API(char *) LDAP_CALL ldap_dn2ufn( const char *dn );
-LDAP_API(char **) LDAP_CALL ldap_explode_dn( const char *dn,
-  const int notypes );
-LDAP_API(char **) LDAP_CALL ldap_explode_rdn( const char *rdn,
-  const int notypes );
-LDAP_API(char *) LDAP_CALL ldap_first_attribute( LDAP *ld, LDAPMessage *entry,
-  BerElement **ber );
-LDAP_API(char *) LDAP_CALL ldap_next_attribute( LDAP *ld, LDAPMessage *entry,
-  BerElement *ber );
-LDAP_API(char **) LDAP_CALL ldap_get_values( LDAP *ld, LDAPMessage *entry,
-  const char *target );
-LDAP_API(struct berval **) LDAP_CALL ldap_get_values_len( LDAP *ld,
-  LDAPMessage *entry, const char *target );
-LDAP_API(int) LDAP_CALL ldap_count_values( char **vals );
-LDAP_API(int) LDAP_CALL ldap_count_values_len( struct berval **vals );
-LDAP_API(void) LDAP_CALL ldap_value_free( char **vals );
-LDAP_API(void) LDAP_CALL ldap_value_free_len( struct berval **vals );
-LDAP_API(void) LDAP_CALL ldap_memfree( void *p );
-
+LDAP_API(char *) LDAP_CALL ldap_err2string(int err);
+LDAP_API(LDAPMessage *)
+LDAP_CALL ldap_first_entry(LDAP *ld, LDAPMessage *chain);
+LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_entry(LDAP *ld, LDAPMessage *entry);
+LDAP_API(int) LDAP_CALL ldap_count_entries(LDAP *ld, LDAPMessage *chain);
+LDAP_API(char *) LDAP_CALL ldap_get_dn(LDAP *ld, LDAPMessage *entry);
+LDAP_API(char *) LDAP_CALL ldap_dn2ufn(const char *dn);
+LDAP_API(char **) LDAP_CALL ldap_explode_dn(const char *dn, const int notypes);
+LDAP_API(char **)
+LDAP_CALL ldap_explode_rdn(const char *rdn, const int notypes);
+LDAP_API(char *)
+LDAP_CALL ldap_first_attribute(LDAP *ld, LDAPMessage *entry, BerElement **ber);
+LDAP_API(char *)
+LDAP_CALL ldap_next_attribute(LDAP *ld, LDAPMessage *entry, BerElement *ber);
+LDAP_API(char **)
+LDAP_CALL ldap_get_values(LDAP *ld, LDAPMessage *entry, const char *target);
+LDAP_API(struct berval **)
+LDAP_CALL ldap_get_values_len(LDAP *ld, LDAPMessage *entry, const char *target);
+LDAP_API(int) LDAP_CALL ldap_count_values(char **vals);
+LDAP_API(int) LDAP_CALL ldap_count_values_len(struct berval **vals);
+LDAP_API(void) LDAP_CALL ldap_value_free(char **vals);
+LDAP_API(void) LDAP_CALL ldap_value_free_len(struct berval **vals);
+LDAP_API(void) LDAP_CALL ldap_memfree(void *p);
 
 /*
  * LDAPv3 extended operation calls
  */
 /*
  * Note: all of the new asynchronous calls return an LDAP error code,
  * not a message id.  A message id is returned via the int *msgidp
  * parameter (usually the last parameter) if appropriate.
  */
-LDAP_API(int) LDAP_CALL ldap_abandon_ext( LDAP *ld, int msgid,
-  LDAPControl **serverctrls, LDAPControl **clientctrls );
-LDAP_API(int) LDAP_CALL ldap_add_ext( LDAP *ld, const char *dn, LDAPMod **attrs,
-  LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp );
-LDAP_API(int) LDAP_CALL ldap_add_ext_s( LDAP *ld, const char *dn,
-  LDAPMod **attrs, LDAPControl **serverctrls, LDAPControl **clientctrls );
-LDAP_API(int) LDAP_CALL ldap_sasl_bind( LDAP *ld, const char *dn,
-  const char *mechanism, const struct berval *cred,
-  LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp );
-LDAP_API(int) LDAP_CALL ldap_sasl_bind_s( LDAP *ld, const char *dn,
-  const char *mechanism, const struct berval *cred,
-  LDAPControl **serverctrls, LDAPControl **clientctrls,
-  struct berval **servercredp );
-LDAP_API(int) LDAP_CALL ldap_modify_ext( LDAP *ld, const char *dn,
-  LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls,
-  int *msgidp );
-LDAP_API(int) LDAP_CALL ldap_modify_ext_s( LDAP *ld, const char *dn,
-  LDAPMod **mods, LDAPControl **serverctrls, LDAPControl **clientctrls );
-LDAP_API(int) LDAP_CALL ldap_rename( LDAP *ld, const char *dn,
-  const char *newrdn, const char *newparent, int deleteoldrdn,
-  LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp );
-LDAP_API(int) LDAP_CALL ldap_rename_s( LDAP *ld, const char *dn,
-  const char *newrdn, const char *newparent, int deleteoldrdn,
-  LDAPControl **serverctrls, LDAPControl **clientctrls );
-LDAP_API(int) LDAP_CALL ldap_compare_ext( LDAP *ld, const char *dn,
-  const char *attr, const struct berval *bvalue,
-  LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp );
-LDAP_API(int) LDAP_CALL ldap_compare_ext_s( LDAP *ld, const char *dn,
-  const char *attr, const struct berval *bvalue,
-  LDAPControl **serverctrls, LDAPControl **clientctrls );
-LDAP_API(int) LDAP_CALL ldap_delete_ext( LDAP *ld, const char *dn,
-  LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp );
-LDAP_API(int) LDAP_CALL ldap_delete_ext_s( LDAP *ld, const char *dn,
-  LDAPControl **serverctrls, LDAPControl **clientctrls );
-LDAP_API(int) LDAP_CALL ldap_search_ext( LDAP *ld, const char *base,
-  int scope, const char *filter, char **attrs, int attrsonly,
-  LDAPControl **serverctrls, LDAPControl **clientctrls,
-  struct timeval *timeoutp, int sizelimit, int *msgidp );
-LDAP_API(int) LDAP_CALL ldap_search_ext_s( LDAP *ld, const char *base,
-  int scope, const char *filter, char **attrs, int attrsonly,
-  LDAPControl **serverctrls, LDAPControl **clientctrls,
-  struct timeval *timeoutp, int sizelimit, LDAPMessage **res );
-LDAP_API(int) LDAP_CALL ldap_extended_operation( LDAP *ld,
-  const char *requestoid, const struct berval *requestdata,
-  LDAPControl **serverctrls, LDAPControl **clientctrls, int *msgidp );
-LDAP_API(int) LDAP_CALL ldap_extended_operation_s( LDAP *ld,
-  const char *requestoid, const struct berval *requestdata,
-  LDAPControl **serverctrls, LDAPControl **clientctrls,
-  char **retoidp, struct berval **retdatap );
-LDAP_API(int) LDAP_CALL ldap_unbind_ext( LDAP *ld, LDAPControl **serverctrls,
-  LDAPControl **clientctrls );
-
+LDAP_API(int)
+LDAP_CALL ldap_abandon_ext(LDAP *ld, int msgid, LDAPControl **serverctrls,
+                           LDAPControl **clientctrls);
+LDAP_API(int)
+LDAP_CALL ldap_add_ext(LDAP *ld, const char *dn, LDAPMod **attrs,
+                       LDAPControl **serverctrls, LDAPControl **clientctrls,
+                       int *msgidp);
+LDAP_API(int)
+LDAP_CALL ldap_add_ext_s(LDAP *ld, const char *dn, LDAPMod **attrs,
+                         LDAPControl **serverctrls, LDAPControl **clientctrls);
+LDAP_API(int)
+LDAP_CALL ldap_sasl_bind(LDAP *ld, const char *dn, const char *mechanism,
+                         const struct berval *cred, LDAPControl **serverctrls,
+                         LDAPControl **clientctrls, int *msgidp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_sasl_bind_s(LDAP *ld, const char *dn, const char *mechanism,
+                     const struct berval *cred, LDAPControl **serverctrls,
+                     LDAPControl **clientctrls, struct berval **servercredp);
+LDAP_API(int)
+LDAP_CALL ldap_modify_ext(LDAP *ld, const char *dn, LDAPMod **mods,
+                          LDAPControl **serverctrls, LDAPControl **clientctrls,
+                          int *msgidp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_modify_ext_s(LDAP *ld, const char *dn, LDAPMod **mods,
+                      LDAPControl **serverctrls, LDAPControl **clientctrls);
+LDAP_API(int)
+LDAP_CALL ldap_rename(LDAP *ld, const char *dn, const char *newrdn,
+                      const char *newparent, int deleteoldrdn,
+                      LDAPControl **serverctrls, LDAPControl **clientctrls,
+                      int *msgidp);
+LDAP_API(int)
+LDAP_CALL ldap_rename_s(LDAP *ld, const char *dn, const char *newrdn,
+                        const char *newparent, int deleteoldrdn,
+                        LDAPControl **serverctrls, LDAPControl **clientctrls);
+LDAP_API(int)
+LDAP_CALL
+    ldap_compare_ext(LDAP *ld, const char *dn, const char *attr,
+                     const struct berval *bvalue, LDAPControl **serverctrls,
+                     LDAPControl **clientctrls, int *msgidp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_compare_ext_s(LDAP *ld, const char *dn, const char *attr,
+                       const struct berval *bvalue, LDAPControl **serverctrls,
+                       LDAPControl **clientctrls);
+LDAP_API(int)
+LDAP_CALL ldap_delete_ext(LDAP *ld, const char *dn, LDAPControl **serverctrls,
+                          LDAPControl **clientctrls, int *msgidp);
+LDAP_API(int)
+LDAP_CALL ldap_delete_ext_s(LDAP *ld, const char *dn, LDAPControl **serverctrls,
+                            LDAPControl **clientctrls);
+LDAP_API(int)
+LDAP_CALL ldap_search_ext(LDAP *ld, const char *base, int scope,
+                          const char *filter, char **attrs, int attrsonly,
+                          LDAPControl **serverctrls, LDAPControl **clientctrls,
+                          struct timeval *timeoutp, int sizelimit, int *msgidp);
+LDAP_API(int)
+LDAP_CALL
+    ldap_search_ext_s(LDAP *ld, const char *base, int scope, const char *filter,
+                      char **attrs, int attrsonly, LDAPControl **serverctrls,
+                      LDAPControl **clientctrls, struct timeval *timeoutp,
+                      int sizelimit, LDAPMessage **res);
+LDAP_API(int)
+LDAP_CALL ldap_extended_operation(LDAP *ld, const char *requestoid,
+                                  const struct berval *requestdata,
+                                  LDAPControl **serverctrls,
+                                  LDAPControl **clientctrls, int *msgidp);
+LDAP_API(int)
+LDAP_CALL ldap_extended_operation_s(LDAP *ld, const char *requestoid,
+                                    const struct berval *requestdata,
+                                    LDAPControl **serverctrls,
+                                    LDAPControl **clientctrls, char **retoidp,
+                                    struct berval **retdatap);
+LDAP_API(int)
+LDAP_CALL ldap_unbind_ext(LDAP *ld, LDAPControl **serverctrls,
+                          LDAPControl **clientctrls);
 
 /*
  * LDAPv3 extended parsing / result handling calls
  */
-LDAP_API(int) LDAP_CALL ldap_parse_sasl_bind_result( LDAP *ld,
-  LDAPMessage *res, struct berval **servercredp, int freeit );
-LDAP_API(int) LDAP_CALL ldap_parse_result( LDAP *ld, LDAPMessage *res,
-  int *errcodep, char **matcheddnp, char **errmsgp, char ***referralsp,
-  LDAPControl ***serverctrlsp, int freeit );
-LDAP_API(int) LDAP_CALL ldap_parse_extended_result( LDAP *ld, LDAPMessage *res,
-  char **retoidp, struct berval **retdatap, int freeit );
-LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_message( LDAP *ld,
-  LDAPMessage *res );
-LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_message( LDAP *ld,
-  LDAPMessage *msg );
-LDAP_API(int) LDAP_CALL ldap_count_messages( LDAP *ld, LDAPMessage *res );
-LDAP_API(LDAPMessage *) LDAP_CALL ldap_first_reference( LDAP *ld,
-  LDAPMessage *res );
-LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_reference( LDAP *ld,
-  LDAPMessage *ref );
-LDAP_API(int) LDAP_CALL ldap_count_references( LDAP *ld, LDAPMessage *res );
-LDAP_API(int) LDAP_CALL ldap_parse_reference( LDAP *ld, LDAPMessage *ref,
-  char ***referralsp, LDAPControl ***serverctrlsp, int freeit );
-LDAP_API(int) LDAP_CALL ldap_get_entry_controls( LDAP *ld, LDAPMessage *entry,
-  LDAPControl ***serverctrlsp );
-LDAP_API(void) LDAP_CALL ldap_control_free( LDAPControl *ctrl );
-LDAP_API(void) LDAP_CALL ldap_controls_free( LDAPControl **ctrls );
+LDAP_API(int)
+LDAP_CALL ldap_parse_sasl_bind_result(LDAP *ld, LDAPMessage *res,
+                                      struct berval **servercredp, int freeit);
+LDAP_API(int)
+LDAP_CALL
+    ldap_parse_result(LDAP *ld, LDAPMessage *res, int *errcodep,
+                      char **matcheddnp, char **errmsgp, char ***referralsp,
+                      LDAPControl ***serverctrlsp, int freeit);
+LDAP_API(int)
+LDAP_CALL ldap_parse_extended_result(LDAP *ld, LDAPMessage *res, char **retoidp,
+                                     struct berval **retdatap, int freeit);
+LDAP_API(LDAPMessage *)
+LDAP_CALL ldap_first_message(LDAP *ld, LDAPMessage *res);
+LDAP_API(LDAPMessage *) LDAP_CALL ldap_next_message(LDAP *ld, LDAPMessage *msg);
+LDAP_API(int) LDAP_CALL ldap_count_messages(LDAP *ld, LDAPMessage *res);
+LDAP_API(LDAPMessage *)
+LDAP_CALL ldap_first_reference(LDAP *ld, LDAPMessage *res);
+LDAP_API(LDAPMessage *)
+LDAP_CALL ldap_next_reference(LDAP *ld, LDAPMessage *ref);
+LDAP_API(int) LDAP_CALL ldap_count_references(LDAP *ld, LDAPMessage *res);
+LDAP_API(int)
+LDAP_CALL ldap_parse_reference(LDAP *ld, LDAPMessage *ref, char ***referralsp,
+                               LDAPControl ***serverctrlsp, int freeit);
+LDAP_API(int)
+LDAP_CALL ldap_get_entry_controls(LDAP *ld, LDAPMessage *entry,
+                                  LDAPControl ***serverctrlsp);
+LDAP_API(void) LDAP_CALL ldap_control_free(LDAPControl *ctrl);
+LDAP_API(void) LDAP_CALL ldap_controls_free(LDAPControl **ctrls);
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* _LDAP_STANDARD_H */
--- a/ldap/c-sdk/include/ldap-to-be-deprecated.h
+++ b/ldap/c-sdk/include/ldap-to-be-deprecated.h
@@ -57,35 +57,33 @@
 extern "C" {
 #endif
 
 /*
  * I/O function callbacks option (an API extension --
  * LDAP_API_FEATURE_X_IO_FUNCTIONS).
  * Use of the extended I/O functions instead is recommended
  */
-#define LDAP_OPT_IO_FN_PTRS 0x0B  /* 11 - API extension */
+#define LDAP_OPT_IO_FN_PTRS 0x0B /* 11 - API extension */
 
 /*
  * I/O callback functions (note that types for the read and write callbacks
  * are actually in lber.h):
  */
-typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_SELECT_CALLBACK)( int nfds,
-  fd_set *readfds, fd_set *writefds, fd_set *errorfds,
-  struct timeval *timeout );
-typedef LBER_SOCKET (LDAP_C LDAP_CALLBACK LDAP_IOF_SOCKET_CALLBACK)(
-  int domain, int type, int protocol );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_IOCTL_CALLBACK)( LBER_SOCKET s,
-  int option, ... );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_CONNECT_CALLBACK )(
-  LBER_SOCKET s, struct sockaddr *name, int namelen );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_CLOSE_CALLBACK )(
-  LBER_SOCKET s );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_IOF_SSL_ENABLE_CALLBACK )(
-  LBER_SOCKET s );
+typedef int(LDAP_C LDAP_CALLBACK LDAP_IOF_SELECT_CALLBACK)(
+    int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds,
+    struct timeval *timeout);
+typedef LBER_SOCKET(LDAP_C LDAP_CALLBACK LDAP_IOF_SOCKET_CALLBACK)(
+    int domain, int type, int protocol);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_IOF_IOCTL_CALLBACK)(LBER_SOCKET s,
+                                                          int option, ...);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_IOF_CONNECT_CALLBACK)(
+    LBER_SOCKET s, struct sockaddr *name, int namelen);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_IOF_CLOSE_CALLBACK)(LBER_SOCKET s);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_IOF_SSL_ENABLE_CALLBACK)(LBER_SOCKET s);
 
 /*
  * Structure to hold I/O function pointers:
  */
 struct ldap_io_fns {
   LDAP_IOF_READ_CALLBACK *liof_read;
   LDAP_IOF_WRITE_CALLBACK *liof_write;
   LDAP_IOF_SELECT_CALLBACK *liof_select;
@@ -95,99 +93,108 @@ struct ldap_io_fns {
   LDAP_IOF_CLOSE_CALLBACK *liof_close;
   LDAP_IOF_SSL_ENABLE_CALLBACK *liof_ssl_enable;
 };
 
 /*
  * DNS resolver callbacks (an API extension --LDAP_API_FEATURE_X_DNS_FUNCTIONS).
  * Note that gethostbyaddr() is not currently used.
  */
-#define LDAP_OPT_DNS_FN_PTRS            0x60    /* 96 - API extension */
+#define LDAP_OPT_DNS_FN_PTRS 0x60 /* 96 - API extension */
 
 typedef struct LDAPHostEnt {
-    char        *ldaphe_name;           /* official name of host */
-    char        **ldaphe_aliases;       /* alias list */
-    int         ldaphe_addrtype;        /* host address type */
-    int         ldaphe_length;          /* length of address */
-    char        **ldaphe_addr_list;     /* list of addresses from name server */
+  char *ldaphe_name;       /* official name of host */
+  char **ldaphe_aliases;   /* alias list */
+  int ldaphe_addrtype;     /* host address type */
+  int ldaphe_length;       /* length of address */
+  char **ldaphe_addr_list; /* list of addresses from name server */
 } LDAPHostEnt;
 
-typedef LDAPHostEnt * (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYNAME)(
-        const char *name, LDAPHostEnt *result, char *buffer,
-        int buflen, int *statusp, void *extradata );
-typedef LDAPHostEnt * (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYADDR)(
-        const char *addr, int length, int type, LDAPHostEnt *result,
-        char *buffer, int buflen, int *statusp, void *extradata );
-typedef int (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETPEERNAME)(
-        LDAP *ld, struct sockaddr *netaddr, char *buffer, int buflen);
+typedef LDAPHostEnt *(LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYNAME)(
+    const char *name, LDAPHostEnt *result, char *buffer, int buflen,
+    int *statusp, void *extradata);
+typedef LDAPHostEnt *(LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYADDR)(
+    const char *addr, int length, int type, LDAPHostEnt *result, char *buffer,
+    int buflen, int *statusp, void *extradata);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETPEERNAME)(
+    LDAP *ld, struct sockaddr *netaddr, char *buffer, int buflen);
 
 struct ldap_dns_fns {
-        void                            *lddnsfn_extradata;
-        int                             lddnsfn_bufsize;
-        LDAP_DNSFN_GETHOSTBYNAME        *lddnsfn_gethostbyname;
-        LDAP_DNSFN_GETHOSTBYADDR        *lddnsfn_gethostbyaddr;
-        LDAP_DNSFN_GETPEERNAME          *lddnsfn_getpeername;
+  void *lddnsfn_extradata;
+  int lddnsfn_bufsize;
+  LDAP_DNSFN_GETHOSTBYNAME *lddnsfn_gethostbyname;
+  LDAP_DNSFN_GETHOSTBYADDR *lddnsfn_gethostbyaddr;
+  LDAP_DNSFN_GETPEERNAME *lddnsfn_getpeername;
 };
 
 /*
  * experimental DN format support
  */
-LDAP_API(char **) LDAP_CALL ldap_explode_dns( const char *dn );
-LDAP_API(int) LDAP_CALL ldap_is_dns_dn( const char *dn );
-
+LDAP_API(char **) LDAP_CALL ldap_explode_dns(const char *dn);
+LDAP_API(int) LDAP_CALL ldap_is_dns_dn(const char *dn);
 
 /*
  * user friendly naming/searching routines
  */
-typedef int (LDAP_C LDAP_CALLBACK LDAP_CANCELPROC_CALLBACK)( void *cl );
-LDAP_API(int) LDAP_CALL ldap_ufn_search_c( LDAP *ld, char *ufn,
-        char **attrs, int attrsonly, LDAPMessage **res,
-        LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm );
-LDAP_API(int) LDAP_CALL ldap_ufn_search_ct( LDAP *ld, char *ufn,
-        char **attrs, int attrsonly, LDAPMessage **res,
-        LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm,
-        char *tag1, char *tag2, char *tag3 );
-LDAP_API(int) LDAP_CALL ldap_ufn_search_s( LDAP *ld, char *ufn,
-        char **attrs, int attrsonly, LDAPMessage **res );
-LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_ufn_setfilter( LDAP *ld, char *fname );
-LDAP_API(void) LDAP_CALL ldap_ufn_setprefix( LDAP *ld, char *prefix );
-LDAP_API(int) LDAP_C ldap_ufn_timeout( void *tvparam );
+typedef int(LDAP_C LDAP_CALLBACK LDAP_CANCELPROC_CALLBACK)(void *cl);
+LDAP_API(int)
+LDAP_CALL
+    ldap_ufn_search_c(LDAP *ld, char *ufn, char **attrs, int attrsonly,
+                      LDAPMessage **res, LDAP_CANCELPROC_CALLBACK *cancelproc,
+                      void *cancelparm);
+LDAP_API(int)
+LDAP_CALL
+    ldap_ufn_search_ct(LDAP *ld, char *ufn, char **attrs, int attrsonly,
+                       LDAPMessage **res, LDAP_CANCELPROC_CALLBACK *cancelproc,
+                       void *cancelparm, char *tag1, char *tag2, char *tag3);
+LDAP_API(int)
+LDAP_CALL ldap_ufn_search_s(LDAP *ld, char *ufn, char **attrs, int attrsonly,
+                            LDAPMessage **res);
+LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_ufn_setfilter(LDAP *ld, char *fname);
+LDAP_API(void) LDAP_CALL ldap_ufn_setprefix(LDAP *ld, char *prefix);
+LDAP_API(int) LDAP_C ldap_ufn_timeout(void *tvparam);
 
 /*
  * utility routines
  */
-LDAP_API(int) LDAP_CALL ldap_charray_add( char ***a, char *s );
-LDAP_API(int) LDAP_CALL ldap_charray_merge( char ***a, char **s );
-LDAP_API(void) LDAP_CALL ldap_charray_free( char **array );
-LDAP_API(int) LDAP_CALL ldap_charray_inlist( char **a, char *s );
-LDAP_API(char **) LDAP_CALL ldap_charray_dup( char **a );
-LDAP_API(char **) LDAP_CALL ldap_str2charray( char *str, char *brkstr );
-LDAP_API(int) LDAP_CALL ldap_charray_position( char **a, char *s );
+LDAP_API(int) LDAP_CALL ldap_charray_add(char ***a, char *s);
+LDAP_API(int) LDAP_CALL ldap_charray_merge(char ***a, char **s);
+LDAP_API(void) LDAP_CALL ldap_charray_free(char **array);
+LDAP_API(int) LDAP_CALL ldap_charray_inlist(char **a, char *s);
+LDAP_API(char **) LDAP_CALL ldap_charray_dup(char **a);
+LDAP_API(char **) LDAP_CALL ldap_str2charray(char *str, char *brkstr);
+LDAP_API(int) LDAP_CALL ldap_charray_position(char **a, char *s);
 
 /* from ldap_ssl.h - the pkcs function and declaration */
-typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_TOKEN_CALLBACK)(void *context, char **tokenname);
-typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_PIN_CALLBACK)(void *context, const char *tokenname, char **tokenpin);
-typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTPATH_CALLBACK)(void *context, char **certpath);
-typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_KEYPATH_CALLBACK)(void *context,char **keypath);
-typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_MODPATH_CALLBACK)(void *context, char **modulepath);
-typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTNAME_CALLBACK)(void *context, char **certname);
-typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK)(void *context, char **filename);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_TOKEN_CALLBACK)(
+    void *context, char **tokenname);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_PIN_CALLBACK)(
+    void *context, const char *tokenname, char **tokenpin);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTPATH_CALLBACK)(
+    void *context, char **certpath);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_KEYPATH_CALLBACK)(
+    void *context, char **keypath);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_MODPATH_CALLBACK)(
+    void *context, char **modulepath);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTNAME_CALLBACK)(
+    void *context, char **certname);
+typedef int(LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK)(
+    void *context, char **filename);
 
 #define PKCS_STRUCTURE_ID 1
 struct ldapssl_pkcs_fns {
-    int local_structure_id;
-    void *local_data;
-    LDAP_PKCS_GET_CERTPATH_CALLBACK *pkcs_getcertpath;
-    LDAP_PKCS_GET_CERTNAME_CALLBACK *pkcs_getcertname;
-    LDAP_PKCS_GET_KEYPATH_CALLBACK *pkcs_getkeypath;
-    LDAP_PKCS_GET_MODPATH_CALLBACK *pkcs_getmodpath;
-    LDAP_PKCS_GET_PIN_CALLBACK *pkcs_getpin;
-    LDAP_PKCS_GET_TOKEN_CALLBACK *pkcs_gettokenname;
-    LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK *pkcs_getdonglefilename;
-
+  int local_structure_id;
+  void *local_data;
+  LDAP_PKCS_GET_CERTPATH_CALLBACK *pkcs_getcertpath;
+  LDAP_PKCS_GET_CERTNAME_CALLBACK *pkcs_getcertname;
+  LDAP_PKCS_GET_KEYPATH_CALLBACK *pkcs_getkeypath;
+  LDAP_PKCS_GET_MODPATH_CALLBACK *pkcs_getmodpath;
+  LDAP_PKCS_GET_PIN_CALLBACK *pkcs_getpin;
+  LDAP_PKCS_GET_TOKEN_CALLBACK *pkcs_gettokenname;
+  LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK *pkcs_getdonglefilename;
 };
 
-LDAP_API(int) LDAP_CALL ldapssl_pkcs_init( const struct ldapssl_pkcs_fns *pfns);
+LDAP_API(int) LDAP_CALL ldapssl_pkcs_init(const struct ldapssl_pkcs_fns *pfns);
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* _LDAP_TOBE_DEPRECATED_H */
--- a/ldap/c-sdk/include/ldap.h
+++ b/ldap/c-sdk/include/ldap.h
@@ -54,9 +54,8 @@
 
 /* Soon-to-be deprecated functions and declarations */
 #include "ldap-to-be-deprecated.h"
 
 /* Deprecated functions and declarations */
 #include "ldap-deprecated.h"
 
 #endif /* _LDAP_H */
-
--- a/ldap/c-sdk/include/ldap_ssl.h
+++ b/ldap/c-sdk/include/ldap_ssl.h
@@ -31,65 +31,63 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #if !defined(LDAP_SSL_H)
-#define LDAP_SSL_H
+#  define LDAP_SSL_H
 
 /* ldap_ssl.h - prototypes for LDAP over SSL functions */
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 extern "C" {
-#endif
+#  endif
 
 /*
  * these three defines resolve the SSL strength
  * setting auth weak, disables all cert checking
  * the CNCHECK tests for the man in the middle hack
  */
-#define LDAPSSL_AUTH_WEAK       0
-#define LDAPSSL_AUTH_CERT       1
-#define LDAPSSL_AUTH_CNCHECK    2
+#  define LDAPSSL_AUTH_WEAK 0
+#  define LDAPSSL_AUTH_CERT 1
+#  define LDAPSSL_AUTH_CNCHECK 2
 
 /*
  * an ExtendedRequest [LDAPv3] specifying the OID for the
  * Start TLS operation: RFC 2830
  */
-#define LDAP_EXOP_START_TLS "1.3.6.1.4.1.1466.20037"
+#  define LDAP_EXOP_START_TLS "1.3.6.1.4.1.1466.20037"
 
 /*
  * Initialize LDAP library for SSL
  */
-LDAP * LDAP_CALL ldapssl_init( const char *defhost, int defport,
-  int defsecure );
+LDAP *LDAP_CALL ldapssl_init(const char *defhost, int defport, int defsecure);
 
 /*
  * Shutdown LDAP library for SSL :
  * Perform necessary cleanup and attempt to shutdown NSS. All existing
  * ld session handles should be ldap_unbind(ld) prior to calling this.
  */
 int LDAP_CALL ldapssl_shutdown();
 
 /* Initialize LDAP library for TLS(SSL) and sends StartTLS extended
  * operation to the Directory Server.
  * Returns LDAP_SUCCESS if all goes well.
  */
-int LDAP_CALL ldap_start_tls_s( LDAP *ld, LDAPControl **serverctrls,
-                                LDAPControl **clientctrls );
+int LDAP_CALL ldap_start_tls_s(LDAP *ld, LDAPControl **serverctrls,
+                               LDAPControl **clientctrls);
 /*
  * Install I/O routines to make SSL over LDAP possible.
  * Use this after ldap_init() or just use ldapssl_init() instead.
  * Returns 0 if all goes well.
  */
-int LDAP_CALL ldapssl_install_routines( LDAP *ld );
-
+int LDAP_CALL ldapssl_install_routines(LDAP *ld);
 
 /* The next four functions initialize the security code for SSL
  * The first one ldapssl_client_init() does initialization for SSL only
  * The next one supports server authentication using clientauth_init()
  * and allows the caller to specify the ssl strength to use in order to
  * verify the servers's certificate.
  * The next one supports ldapssl_clientauth_init() initializes security
  * for SSL for client authentication.  The third function initializes
@@ -111,25 +109,23 @@ int LDAP_CALL ldapssl_install_routines( 
  * char *secmodpath - path to the secmod.  This can be a shortcut to the
  *    directory name, if so secmod.db will be postfixed to the string.
  *
  *  These three functions are mutually exclusive.  You can only call
  *     one.  This means that, for a given process, you must call the
  *     appropriate initialization function for the life of the process.
  */
 
-
 /*
  * Initialize the secure parts (Security and SSL) of the runtime for use
  * by a client application.  This is only called once.
  * Returns 0 if all goes well.
  */
 
-int LDAP_CALL ldapssl_client_init(
-    const char *certdbpath, void *certdbhandle );
+int LDAP_CALL ldapssl_client_init(const char *certdbpath, void *certdbhandle);
 
 /*
  * Initialize the secure parts (Security and SSL) of the runtime for use
  * by a client application using server authentication.  This is only
  * called once.
  *
  * ldapssl_serverauth_init() is a server-authentication only version of
  * ldapssl_clientauth_init().  This function allows the sslstrength
@@ -153,102 +149,98 @@ int LDAP_CALL ldapssl_client_init(
  *                         one hostname and not a list of hosts.
  *                         Furthermore, the port number must be passed
  *                         via the "defport" parameter, and cannot
  *                         be passed via a host:port option.
  *
  * Returns 0 if all goes well.
  */
 
-int LDAP_CALL ldapssl_serverauth_init(
-    const char *certdbpath, void *certdbhandle, const int sslstrength );
+int LDAP_CALL ldapssl_serverauth_init(const char *certdbpath,
+                                      void *certdbhandle,
+                                      const int sslstrength);
 
 /*
  * Initialize the secure parts (Security and SSL) of the runtime for use
  * by a client application that may want to do SSL client authentication.
  * Returns 0 if all goes well.
  */
 
-int LDAP_CALL ldapssl_clientauth_init(
-    const char *certdbpath, void *certdbhandle,
-    const int needkeydb, const char *keydbpath, void *keydbhandle );
+int LDAP_CALL ldapssl_clientauth_init(const char *certdbpath,
+                                      void *certdbhandle, const int needkeydb,
+                                      const char *keydbpath, void *keydbhandle);
 
 /*
  * Initialize the secure parts (Security and SSL) of the runtime for use
  * by a client application that may want to do SSL client authentication.
  *
  * Please see the description of the sslstrength value in the
  * ldapssl_serverauth_init() function above and note the potential
  * problems which can be caused by passing in wrong host & portname
  * values.  The same warning applies to the ldapssl_advclientauth_init()
  * function.
  *
  * Returns 0 if all goes well.
  */
 
 int LDAP_CALL ldapssl_advclientauth_init(
-    const char *certdbpath, void *certdbhandle,
-    const int needkeydb, const char *keydbpath, void *keydbhandle,
-    const int needsecmoddb, const char *secmoddbpath,
-    const int sslstrength );
-
-
+    const char *certdbpath, void *certdbhandle, const int needkeydb,
+    const char *keydbpath, void *keydbhandle, const int needsecmoddb,
+    const char *secmoddbpath, const int sslstrength);
 
 /*
  * get a meaningful error string back from the security library
  * this function should be called, if ldap_err2string doesn't
  * identify the error code.
  */
-const char * LDAP_CALL ldapssl_err2string( const int prerrno );
-
+const char *LDAP_CALL ldapssl_err2string(const int prerrno);
 
 /*
  * Enable SSL client authentication on the given ld.
  * Returns 0 if all goes well.
  */
-int LDAP_CALL ldapssl_enable_clientauth( LDAP *ld, char *keynickname,
-  char *keypasswd, char *certnickname );
+int LDAP_CALL ldapssl_enable_clientauth(LDAP *ld, char *keynickname,
+                                        char *keypasswd, char *certnickname);
 
 /*
  * Set the SSL strength for an existing SSL-enabled LDAP session handle.
  *
  * See the description of ldapssl_serverauth_init() above for valid
  * sslstrength values. If ld is NULL, the default for new LDAP session
  * handles is set.
  *
  * Returns 0 if all goes well.
  */
-int LDAP_CALL ldapssl_set_strength( LDAP *ld, int sslstrength );
-
+int LDAP_CALL ldapssl_set_strength(LDAP *ld, int sslstrength);
 
 /*
  * Set or get SSL options for an existing SSL-enabled LDAP session handle.
  * If ld is NULL, the default options used for all future LDAP SSL sessions
  * are the ones affected. The option values are specific to the underlying
  * SSL provider; see ssl.h within the Network Security Services (NSS)
  * distribution for the options supported by NSS (the default SSL provider).
  *
  * The ldapssl_set_option() function should be called before any LDAP
  * connections are created.
  *
  * Both functions return 0 if all goes well.
  */
-int LDAP_CALL ldapssl_set_option( LDAP *ld, int option, int on );
-int LDAP_CALL ldapssl_get_option( LDAP *ld, int option, int *onp );
+int LDAP_CALL ldapssl_set_option(LDAP *ld, int option, int on);
+int LDAP_CALL ldapssl_get_option(LDAP *ld, int option, int *onp);
 
 /*
  * Import the file descriptor corresponding to the socket of an already
  * open LDAP connection into SSL, and update the socket and session
  * information accordingly. Returns 0 if all goes well.
  */
-int LDAP_CALL ldapssl_import_fd ( LDAP *ld, int secure );
+int LDAP_CALL ldapssl_import_fd(LDAP *ld, int secure);
 
 /*
  * Reset an LDAP session from SSL to a non-secure status. Basically,
  * this function undoes the work done by ldapssl_install_routines.
  * Returns 0 if all goes well.
  */
-int LDAP_CALL ldapssl_reset_to_nonsecure ( LDAP *ld );
+int LDAP_CALL ldapssl_reset_to_nonsecure(LDAP *ld);
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 }
-#endif
+#  endif
 #endif /* !defined(LDAP_SSL_H) */
--- a/ldap/c-sdk/include/ldaplog.h
+++ b/ldap/c-sdk/include/ldaplog.h
@@ -49,58 +49,58 @@ extern "C" {
 #define LDAP_DEBUG_BER 0x00010
 #define LDAP_DEBUG_FILTER 0x00020
 #define LDAP_DEBUG_CONFIG 0x00040
 #define LDAP_DEBUG_ACL 0x00080
 #define LDAP_DEBUG_STATS 0x00100
 #define LDAP_DEBUG_STATS2 0x00200
 #define LDAP_DEBUG_SHELL 0x00400
 #define LDAP_DEBUG_PARSE 0x00800
-#define LDAP_DEBUG_HOUSE        0x01000
-#define LDAP_DEBUG_REPL         0x02000
-#define LDAP_DEBUG_ANY          0x04000
-#define LDAP_DEBUG_CACHE        0x08000
+#define LDAP_DEBUG_HOUSE 0x01000
+#define LDAP_DEBUG_REPL 0x02000
+#define LDAP_DEBUG_ANY 0x04000
+#define LDAP_DEBUG_CACHE 0x08000
 #define LDAP_DEBUG_PLUGIN 0x10000
 
 /* debugging stuff */
 /* Disable by default */
-#define LDAPDebug( level, fmt, arg1, arg2, arg3 )
+#define LDAPDebug(level, fmt, arg1, arg2, arg3)
 
 #ifdef LDAP_DEBUG
 #  undef LDAPDebug
 
 /* SLAPD_LOGGING should not be on for WINSOCK (16-bit Windows) */
 #  if defined(SLAPD_LOGGING)
 #    ifdef _WIN32
-       extern int *module_ldap_debug;
-#      define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
-       { \
-    if ( *module_ldap_debug & level ) { \
-            slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
-      } \
-       }
+extern int *module_ldap_debug;
+#      define LDAPDebug(level, fmt, arg1, arg2, arg3)          \
+        {                                                      \
+          if (*module_ldap_debug & level) {                    \
+            slapd_log_error_proc(NULL, fmt, arg1, arg2, arg3); \
+          }                                                    \
+        }
 #    else /* _WIN32 */
-       extern int ldap_debug;
-#      define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
-       { \
-    if ( ldap_debug & level ) { \
-            slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
-      } \
-       }
+extern int ldap_debug;
+#      define LDAPDebug(level, fmt, arg1, arg2, arg3)          \
+        {                                                      \
+          if (ldap_debug & level) {                            \
+            slapd_log_error_proc(NULL, fmt, arg1, arg2, arg3); \
+          }                                                    \
+        }
 #    endif /* Win32 */
-#  else /* no SLAPD_LOGGING */
-     extern void ber_err_print( char * );
-     extern int ldap_debug;
-#    define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
-    if ( ldap_debug & level ) { \
-      char msg[1024]; \
-      snprintf( msg, sizeof(msg), fmt, arg1, arg2, arg3 ); \
-      msg[sizeof(msg)-1] = '\0'; \
-      ber_err_print( msg ); \
-    }
+#  else    /* no SLAPD_LOGGING */
+extern void ber_err_print(char*);
+extern int ldap_debug;
+#    define LDAPDebug(level, fmt, arg1, arg2, arg3)        \
+      if (ldap_debug & level) {                            \
+        char msg[1024];                                    \
+        snprintf(msg, sizeof(msg), fmt, arg1, arg2, arg3); \
+        msg[sizeof(msg) - 1] = '\0';                       \
+        ber_err_print(msg);                                \
+      }
 #  endif /* SLAPD_LOGGING */
-#endif /* LDAP_DEBUG */
+#endif   /* LDAP_DEBUG */
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* _LDAP_H */
--- a/ldap/c-sdk/include/ldappr.h
+++ b/ldap/c-sdk/include/ldappr.h
@@ -59,67 +59,63 @@ extern "C" {
  * this LDAP * handle from more than one thread.
  *
  * Returns an LDAP session handle (or NULL if an error occurs).
  *
  * NOTE: If you want to use IPv6, you must use prldap creating a LDAP handle
  * with this function prldap_init.  Prldap_init installs the appropriate
  * set of NSPR functions and prevents calling deprecated functions accidentally.
  */
-LDAP * LDAP_CALL prldap_init( const char *defhost, int defport, int shared );
-
+LDAP *LDAP_CALL prldap_init(const char *defhost, int defport, int shared);
 
 /*
  * Function: prldap_install_routines().
  *
  * Install NSPR I/O, threading, and DNS functions so they will be used by
  * 'ld'.
  *
  * If 'ld' is NULL, the functions are installed as the default functions
  * for all new LDAP * handles).
  *
  * Pass a non-zero value for the 'shared' parameter if you plan to use
  * this LDAP * handle from more than one thread.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well).
  */
-int LDAP_CALL prldap_install_routines( LDAP *ld, int shared );
-
+int LDAP_CALL prldap_install_routines(LDAP *ld, int shared);
 
 /*
  * Function: prldap_set_session_option().
  *
  * Given an LDAP session handle or a session argument such is passed to
  * CONNECT, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks, set
  * an option that affects the prldap layer.
  *
  * If 'ld' and 'session" are both NULL, the option is set as the default
  * for all new prldap sessions.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well).
  */
-int LDAP_CALL prldap_set_session_option( LDAP *ld, void *sessionarg,
-  int option, ... );
-
+int LDAP_CALL prldap_set_session_option(LDAP *ld, void *sessionarg, int option,
+                                        ...);
 
 /*
  * Function: prldap_get_session_option().
  *
  * Given an LDAP session handle or a session argument such is passed to
  * CONNECT, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks, retrieve
  * the setting for an option that affects the prldap layer.
  *
  * If 'ld' and 'session" are both NULL, the default option value for all new
  * new prldap sessions is retrieved.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well).
  */
-int LDAP_CALL prldap_get_session_option( LDAP *ld, void *sessionarg,
-  int option, ... );
-
+int LDAP_CALL prldap_get_session_option(LDAP *ld, void *sessionarg, int option,
+                                        ...);
 
 /*
  * Available options.
  */
 /*
  * PRLDAP_OPT_IO_MAX_TIMEOUT: the maximum time in milliseconds to
  * block waiting for a network I/O operation to complete.
  *
@@ -127,17 +123,16 @@ int LDAP_CALL prldap_get_session_option(
  *
  * These two special values from ldap-extension.h can also be used;
  *
  *    LDAP_X_IO_TIMEOUT_NO_TIMEOUT
  *    LDAP_X_IO_TIMEOUT_NO_WAIT
  */
 #define PRLDAP_OPT_IO_MAX_TIMEOUT 1
 
-
 /**
  ** Note: the types and functions below are only useful for developers
  ** who need to layer one or more custom extended I/O functions on top of
  ** the standard NSPR I/O functions installed by a call to prldap_init()
  ** or prldap_install_routines().  Layering can be accomplished after
  ** prldap_init() or prldap_install_routines() has completed successfully
  ** by:
  **
@@ -156,118 +151,114 @@ int LDAP_CALL prldap_get_session_option(
  * seinfo_size should be set to PRLDAP_SESSIONINFO_SIZE before use.
  */
 struct prldap_session_private;
 
 typedef struct prldap_session_info {
   int seinfo_size;
   struct prldap_session_private *seinfo_appdata;
 } PRLDAPSessionInfo;
-#define PRLDAP_SESSIONINFO_SIZE sizeof( PRLDAPSessionInfo )
-
+#define PRLDAP_SESSIONINFO_SIZE sizeof(PRLDAPSessionInfo)
 
 /*
  * Function: prldap_set_session_info().
  *
  * Given an LDAP session handle or a session argument such is passed to
  * CONNECT, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks,
  * set some application-specific data.  If ld is NULL, arg is used.  If
  * both ld and arg are NULL, LDAP_PARAM_ERROR is returned.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well).
  */
-int LDAP_CALL prldap_set_session_info( LDAP *ld, void *sessionarg,
-  PRLDAPSessionInfo *seip );
-
+int LDAP_CALL prldap_set_session_info(LDAP *ld, void *sessionarg,
+                                      PRLDAPSessionInfo *seip);
 
 /*
  * Function: prldap_get_session_info().
  *
  * Given an LDAP session handle or a session argument such is passed to
  * CONNECT, POLL, NEWHANDLE, or DISPOSEHANDLE extended I/O callbacks,
  * retrieve some application-specific data.  If ld is NULL, arg is used.  If
  * both ld and arg are NULL, LDAP_PARAM_ERROR is returned.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in
  * which case the fields in the structure that seip points to are filled in).
  */
-int LDAP_CALL prldap_get_session_info( LDAP *ld, void *sessionarg,
-  PRLDAPSessionInfo *seip );
-
+int LDAP_CALL prldap_get_session_info(LDAP *ld, void *sessionarg,
+                                      PRLDAPSessionInfo *seip);
 
 /*
  * Data structure for socket specific information.
  * Note: soinfo_size should be set to PRLDAP_SOCKETINFO_SIZE before use.
  */
 struct prldap_socket_private;
 typedef struct prldap_socket_info {
   int soinfo_size;
   PRFileDesc *soinfo_prfd;
   struct prldap_socket_private *soinfo_appdata;
 } PRLDAPSocketInfo;
-#define PRLDAP_SOCKETINFO_SIZE sizeof( PRLDAPSocketInfo )
-
+#define PRLDAP_SOCKETINFO_SIZE sizeof(PRLDAPSocketInfo)
 
 /*
  * Function: prldap_set_socket_info().
  *
  * Given an integer fd and a socket argument such as those passed to the
  * extended I/O callback functions, set socket specific information.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well).
  *
  * Note: it is only safe to change soinfo_prfd from within the CONNECT
  * extended I/O callback function.
  */
-int LDAP_CALL prldap_set_socket_info( int fd, void *socketarg,
-                                      PRLDAPSocketInfo *soip );
+int LDAP_CALL prldap_set_socket_info(int fd, void *socketarg,
+                                     PRLDAPSocketInfo *soip);
 
 /*
  * Function: prldap_get_socket_info().
  *
  * Given an integer fd and a socket argument such as those passed to the
  * extended I/O callback functions, retrieve socket specific information.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in
  * which case the fields in the structure that soip points to are filled in).
  */
-int LDAP_CALL prldap_get_socket_info( int fd, void *socketarg,
-                                      PRLDAPSocketInfo *soip );
+int LDAP_CALL prldap_get_socket_info(int fd, void *socketarg,
+                                     PRLDAPSocketInfo *soip);
 
 /*
  * Function: prldap_get_default_socket_info().
  *
  * Given an LDAP session handle, retrieve socket specific information.
  * If ld is NULL, LDAP_PARAM_ERROR is returned.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in
  * which case the fields in the structure that soip points to are filled in).
  */
-int LDAP_CALL prldap_get_default_socket_info( LDAP *ld, PRLDAPSocketInfo *soip );
+int LDAP_CALL prldap_get_default_socket_info(LDAP *ld, PRLDAPSocketInfo *soip);
 
 /*
  * Function: prldap_set_default_socket_info().
  *
  * Given an LDAP session handle, set socket specific information.
  * If ld is NULL, LDAP_PARAM_ERROR is returned.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well, in
  * which case the fields in the structure that soip points to are filled in).
  */
-int LDAP_CALL prldap_set_default_socket_info( LDAP *ld, PRLDAPSocketInfo *soip );
+int LDAP_CALL prldap_set_default_socket_info(LDAP *ld, PRLDAPSocketInfo *soip);
 
 /* Function: prldap_is_installed()
  * Check if NSPR routine is installed
  */
-PRBool prldap_is_installed( LDAP *ld );
+PRBool prldap_is_installed(LDAP *ld);
 
 /* Function: prldap_import_connection().
  * Given a ldap handle with connection already done with ldap_init()
  * installs NSPR routines and imports the original connection info.
  *
  * Returns an LDAP API error code (LDAP_SUCCESS if all goes well).
  */
-int LDAP_CALL prldap_import_connection (LDAP *ld);
+int LDAP_CALL prldap_import_connection(LDAP *ld);
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* !defined(LDAP_PR_H) */
--- a/ldap/c-sdk/include/ldaprot.h
+++ b/ldap/c-sdk/include/ldaprot.h
@@ -45,159 +45,159 @@ extern "C" {
 #define LDAP_VERSION1 1
 #define LDAP_VERSION2 2
 #define LDAP_VERSION3 3
 #define LDAP_VERSION LDAP_VERSION3
 
 #define COMPAT20
 #define COMPAT30
 #if defined(COMPAT20) || defined(COMPAT30)
-#define COMPAT
+#  define COMPAT
 #endif
 
-#define LDAP_URL_PREFIX      "ldap://"
-#define LDAP_URL_PREFIX_LEN  7
-#define LDAPS_URL_PREFIX     "ldaps://"
+#define LDAP_URL_PREFIX "ldap://"
+#define LDAP_URL_PREFIX_LEN 7
+#define LDAPS_URL_PREFIX "ldaps://"
 #define LDAPS_URL_PREFIX_LEN 8
-#define LDAP_REF_STR         "Referral:\n"
-#define LDAP_REF_STR_LEN     10
+#define LDAP_REF_STR "Referral:\n"
+#define LDAP_REF_STR_LEN 10
 
 /*
  * specific LDAP instantiations of BER types we know about
  */
 
 /* general stuff */
-#define LDAP_TAG_MESSAGE        0x30L  /* tag is 16 + constructed bit */
-#define OLD_LDAP_TAG_MESSAGE    0x10L  /* forgot the constructed bit  */
-#define LDAP_TAG_MSGID          0x02L  /* INTEGER */
-#define LDAP_TAG_LDAPDN         0x04L  /* OCTET STRING */
-#define LDAP_TAG_CONTROLS       0xa0L  /* context specific + constructed + 0 */
-#define LDAP_TAG_REFERRAL       0xa3L  /* context specific + constructed + 3 */
-#define LDAP_TAG_NEWSUPERIOR    0x80L  /* context specific + primitive + 0 */
-#define LDAP_TAG_MRA_OID        0x81L  /* context specific + primitive + 1 */
-#define LDAP_TAG_MRA_TYPE       0x82L  /* context specific + primitive + 2 */
-#define LDAP_TAG_MRA_VALUE      0x83L  /* context specific + primitive + 3 */
-#define LDAP_TAG_MRA_DNATTRS    0x84L  /* context specific + primitive + 4 */
-#define LDAP_TAG_EXOP_REQ_OID   0x80L  /* context specific + primitive + 0 */
-#define LDAP_TAG_EXOP_REQ_VALUE 0x81L  /* context specific + primitive + 1 */
-#define LDAP_TAG_EXOP_RES_OID   0x8aL  /* context specific + primitive + 10 */
-#define LDAP_TAG_EXOP_RES_VALUE 0x8bL  /* context specific + primitive + 11 */
-#define LDAP_TAG_SK_MATCHRULE   0x80L  /* context specific + primitive + 0 */
-#define LDAP_TAG_SK_REVERSE     0x81L  /* context specific + primitive + 1 */
-#define LDAP_TAG_SR_ATTRTYPE    0x80L  /* context specific + primitive + 0 */
-#define LDAP_TAG_SASL_RES_CREDS 0x87L  /* context specific + primitive + 7 */
-#define LDAP_TAG_VLV_BY_INDEX   0xa0L  /* context specific + constructed + 0 */
-#define LDAP_TAG_VLV_BY_VALUE   0x81L  /* context specific + primitive + 1 */
-#define LDAP_TAG_PWP_WARNING    0xA0L  /* context specific + constructed */
-#define LDAP_TAG_PWP_SECSLEFT   0x80L  /* context specific + primitive */
-#define LDAP_TAG_PWP_GRCLOGINS  0x81L  /* context specific + primitive + 1 */
-#define LDAP_TAG_PWP_ERROR      0x81L  /* context specific + primitive + 1 */
-#define LDAP_TAG_PWDMOD_REQ_ID  0x80L  /* context specific + primitive + 0 */
-#define LDAP_TAG_PWDMOD_REQ_OLD 0x81L  /* context specific + primitive + 1 */
-#define LDAP_TAG_PWDMOD_REQ_NEW 0x82L  /* context specific + primitive + 2 */
-#define LDAP_TAG_PWDMOD_RES_GEN 0x80L  /* context specific + primitive + 0 */
+#define LDAP_TAG_MESSAGE 0x30L        /* tag is 16 + constructed bit */
+#define OLD_LDAP_TAG_MESSAGE 0x10L    /* forgot the constructed bit  */
+#define LDAP_TAG_MSGID 0x02L          /* INTEGER */
+#define LDAP_TAG_LDAPDN 0x04L         /* OCTET STRING */
+#define LDAP_TAG_CONTROLS 0xa0L       /* context specific + constructed + 0 */
+#define LDAP_TAG_REFERRAL 0xa3L       /* context specific + constructed + 3 */
+#define LDAP_TAG_NEWSUPERIOR 0x80L    /* context specific + primitive + 0 */
+#define LDAP_TAG_MRA_OID 0x81L        /* context specific + primitive + 1 */
+#define LDAP_TAG_MRA_TYPE 0x82L       /* context specific + primitive + 2 */
+#define LDAP_TAG_MRA_VALUE 0x83L      /* context specific + primitive + 3 */
+#define LDAP_TAG_MRA_DNATTRS 0x84L    /* context specific + primitive + 4 */
+#define LDAP_TAG_EXOP_REQ_OID 0x80L   /* context specific + primitive + 0 */
+#define LDAP_TAG_EXOP_REQ_VALUE 0x81L /* context specific + primitive + 1 */
+#define LDAP_TAG_EXOP_RES_OID 0x8aL   /* context specific + primitive + 10 */
+#define LDAP_TAG_EXOP_RES_VALUE 0x8bL /* context specific + primitive + 11 */
+#define LDAP_TAG_SK_MATCHRULE 0x80L   /* context specific + primitive + 0 */
+#define LDAP_TAG_SK_REVERSE 0x81L     /* context specific + primitive + 1 */
+#define LDAP_TAG_SR_ATTRTYPE 0x80L    /* context specific + primitive + 0 */
+#define LDAP_TAG_SASL_RES_CREDS 0x87L /* context specific + primitive + 7 */
+#define LDAP_TAG_VLV_BY_INDEX 0xa0L   /* context specific + constructed + 0 */
+#define LDAP_TAG_VLV_BY_VALUE 0x81L   /* context specific + primitive + 1 */
+#define LDAP_TAG_PWP_WARNING 0xA0L    /* context specific + constructed */
+#define LDAP_TAG_PWP_SECSLEFT 0x80L   /* context specific + primitive */
+#define LDAP_TAG_PWP_GRCLOGINS 0x81L  /* context specific + primitive + 1 */
+#define LDAP_TAG_PWP_ERROR 0x81L      /* context specific + primitive + 1 */
+#define LDAP_TAG_PWDMOD_REQ_ID 0x80L  /* context specific + primitive + 0 */
+#define LDAP_TAG_PWDMOD_REQ_OLD 0x81L /* context specific + primitive + 1 */
+#define LDAP_TAG_PWDMOD_REQ_NEW 0x82L /* context specific + primitive + 2 */
+#define LDAP_TAG_PWDMOD_RES_GEN 0x80L /* context specific + primitive + 0 */
 
 /* possible operations a client can invoke */
-#define LDAP_REQ_BIND     0x60L  /* application + constructed + 0 */
-#define LDAP_REQ_UNBIND   0x42L  /* application + primitive   + 2 */
-#define LDAP_REQ_SEARCH   0x63L  /* application + constructed + 3 */
-#define LDAP_REQ_MODIFY   0x66L  /* application + constructed + 6 */
-#define LDAP_REQ_ADD      0x68L  /* application + constructed + 8 */
-#define LDAP_REQ_DELETE   0x4aL  /* application + primitive   + 10 */
-#define LDAP_REQ_MODRDN   0x6cL  /* application + constructed + 12 */
-#define LDAP_REQ_MODDN    0x6cL  /* application + constructed + 12 */
-#define LDAP_REQ_RENAME   0x6cL  /* application + constructed + 12 */
-#define LDAP_REQ_COMPARE  0x6eL  /* application + constructed + 14 */
-#define LDAP_REQ_ABANDON  0x50L  /* application + primitive   + 16 */
-#define LDAP_REQ_EXTENDED 0x77L  /* application + constructed + 23 */
+#define LDAP_REQ_BIND 0x60L     /* application + constructed + 0 */
+#define LDAP_REQ_UNBIND 0x42L   /* application + primitive   + 2 */
+#define LDAP_REQ_SEARCH 0x63L   /* application + constructed + 3 */
+#define LDAP_REQ_MODIFY 0x66L   /* application + constructed + 6 */
+#define LDAP_REQ_ADD 0x68L      /* application + constructed + 8 */
+#define LDAP_REQ_DELETE 0x4aL   /* application + primitive   + 10 */
+#define LDAP_REQ_MODRDN 0x6cL   /* application + constructed + 12 */
+#define LDAP_REQ_MODDN 0x6cL    /* application + constructed + 12 */
+#define LDAP_REQ_RENAME 0x6cL   /* application + constructed + 12 */
+#define LDAP_REQ_COMPARE 0x6eL  /* application + constructed + 14 */
+#define LDAP_REQ_ABANDON 0x50L  /* application + primitive   + 16 */
+#define LDAP_REQ_EXTENDED 0x77L /* application + constructed + 23 */
 
 /* U-M LDAP release 3.0 compatibility stuff */
-#define LDAP_REQ_UNBIND_30  0x62L
-#define LDAP_REQ_DELETE_30  0x6aL
+#define LDAP_REQ_UNBIND_30 0x62L
+#define LDAP_REQ_DELETE_30 0x6aL
 #define LDAP_REQ_ABANDON_30 0x70L
 
 /*
  * old broken stuff for backwards compatibility - forgot application tag
  * and constructed/primitive bit
  */
-#define OLD_LDAP_REQ_BIND    0x00L
-#define OLD_LDAP_REQ_UNBIND  0x02L
-#define OLD_LDAP_REQ_SEARCH  0x03L
-#define OLD_LDAP_REQ_MODIFY  0x06L
-#define OLD_LDAP_REQ_ADD     0x08L
-#define OLD_LDAP_REQ_DELETE  0x0aL
-#define OLD_LDAP_REQ_MODRDN  0x0cL
-#define OLD_LDAP_REQ_MODDN   0x0cL
+#define OLD_LDAP_REQ_BIND 0x00L
+#define OLD_LDAP_REQ_UNBIND 0x02L
+#define OLD_LDAP_REQ_SEARCH 0x03L
+#define OLD_LDAP_REQ_MODIFY 0x06L
+#define OLD_LDAP_REQ_ADD 0x08L
+#define OLD_LDAP_REQ_DELETE 0x0aL
+#define OLD_LDAP_REQ_MODRDN 0x0cL
+#define OLD_LDAP_REQ_MODDN 0x0cL
 #define OLD_LDAP_REQ_COMPARE 0x0eL
 #define OLD_LDAP_REQ_ABANDON 0x10L
 
 /* old broken stuff for backwards compatibility */
 #define OLD_LDAP_RES_BIND 0x01L
-#define OLD_LDAP_RES_SEARCH_ENTRY  0x04L
+#define OLD_LDAP_RES_SEARCH_ENTRY 0x04L
 #define OLD_LDAP_RES_SEARCH_RESULT 0x05L
-#define OLD_LDAP_RES_MODIFY        0x07L
-#define OLD_LDAP_RES_ADD           0x09L
-#define OLD_LDAP_RES_DELETE        0x0bL
-#define OLD_LDAP_RES_MODRDN        0x0dL
-#define OLD_LDAP_RES_MODDN         0x0dL
-#define OLD_LDAP_RES_COMPARE       0x0fL
+#define OLD_LDAP_RES_MODIFY 0x07L
+#define OLD_LDAP_RES_ADD 0x09L
+#define OLD_LDAP_RES_DELETE 0x0bL
+#define OLD_LDAP_RES_MODRDN 0x0dL
+#define OLD_LDAP_RES_MODDN 0x0dL
+#define OLD_LDAP_RES_COMPARE 0x0fL
 
 /* U-M LDAP 3.0 compatibility auth methods */
-#define LDAP_AUTH_SIMPLE_30 0xa0L  /* context specific + constructed */
-#define LDAP_AUTH_KRBV41_30 0xa1L  /* context specific + constructed */
-#define LDAP_AUTH_KRBV42_30 0xa2L  /* context specific + constructed */
+#define LDAP_AUTH_SIMPLE_30 0xa0L /* context specific + constructed */
+#define LDAP_AUTH_KRBV41_30 0xa1L /* context specific + constructed */
+#define LDAP_AUTH_KRBV42_30 0xa2L /* context specific + constructed */
 
 /* old broken stuff */
 #define OLD_LDAP_AUTH_SIMPLE 0x00L
-#define OLD_LDAP_AUTH_KRBV4  0x01L
+#define OLD_LDAP_AUTH_KRBV4 0x01L
 #define OLD_LDAP_AUTH_KRBV42 0x02L
 
 /* U-M LDAP 3.0 compatibility filter types */
-#define LDAP_FILTER_PRESENT_30 0xa7L  /* context specific + constructed */
+#define LDAP_FILTER_PRESENT_30 0xa7L /* context specific + constructed */
 
 /* filter types */
-#define LDAP_FILTER_AND        0xa0L  /* context specific + constructed + 0 */
-#define LDAP_FILTER_OR         0xa1L  /* context specific + constructed + 1 */
-#define LDAP_FILTER_NOT        0xa2L  /* context specific + constructed + 2 */
-#define LDAP_FILTER_EQUALITY   0xa3L  /* context specific + constructed + 3 */
-#define LDAP_FILTER_SUBSTRINGS 0xa4L  /* context specific + constructed + 4 */
-#define LDAP_FILTER_GE         0xa5L  /* context specific + constructed + 5 */
-#define LDAP_FILTER_LE         0xa6L  /* context specific + constructed + 6 */
-#define LDAP_FILTER_PRESENT    0x87L  /* context specific + primitive   + 7 */
-#define LDAP_FILTER_APPROX     0xa8L  /* context specific + constructed + 8 */
-#define LDAP_FILTER_EXTENDED   0xa9L  /* context specific + constructed + 0 */
+#define LDAP_FILTER_AND 0xa0L        /* context specific + constructed + 0 */
+#define LDAP_FILTER_OR 0xa1L         /* context specific + constructed + 1 */
+#define LDAP_FILTER_NOT 0xa2L        /* context specific + constructed + 2 */
+#define LDAP_FILTER_EQUALITY 0xa3L   /* context specific + constructed + 3 */
+#define LDAP_FILTER_SUBSTRINGS 0xa4L /* context specific + constructed + 4 */
+#define LDAP_FILTER_GE 0xa5L         /* context specific + constructed + 5 */
+#define LDAP_FILTER_LE 0xa6L         /* context specific + constructed + 6 */
+#define LDAP_FILTER_PRESENT 0x87L    /* context specific + primitive   + 7 */
+#define LDAP_FILTER_APPROX 0xa8L     /* context specific + constructed + 8 */
+#define LDAP_FILTER_EXTENDED 0xa9L   /* context specific + constructed + 0 */
 
 /* old broken stuff */
-#define OLD_LDAP_FILTER_AND        0x00L
-#define OLD_LDAP_FILTER_OR         0x01L
-#define OLD_LDAP_FILTER_NOT        0x02L
-#define OLD_LDAP_FILTER_EQUALITY   0x03L
+#define OLD_LDAP_FILTER_AND 0x00L
+#define OLD_LDAP_FILTER_OR 0x01L
+#define OLD_LDAP_FILTER_NOT 0x02L
+#define OLD_LDAP_FILTER_EQUALITY 0x03L
 #define OLD_LDAP_FILTER_SUBSTRINGS 0x04L
-#define OLD_LDAP_FILTER_GE         0x05L
-#define OLD_LDAP_FILTER_LE         0x06L
-#define OLD_LDAP_FILTER_PRESENT    0x07L
-#define OLD_LDAP_FILTER_APPROX     0x08L
+#define OLD_LDAP_FILTER_GE 0x05L
+#define OLD_LDAP_FILTER_LE 0x06L
+#define OLD_LDAP_FILTER_PRESENT 0x07L
+#define OLD_LDAP_FILTER_APPROX 0x08L
 
 /* substring filter component types */
-#define LDAP_SUBSTRING_INITIAL     0x80L  /* context specific + primitive + 0 */
-#define LDAP_SUBSTRING_ANY         0x81L  /* context specific + primitive + 1 */
-#define LDAP_SUBSTRING_FINAL       0x82L  /* context specific + primitive + 2 */
+#define LDAP_SUBSTRING_INITIAL 0x80L /* context specific + primitive + 0 */
+#define LDAP_SUBSTRING_ANY 0x81L     /* context specific + primitive + 1 */
+#define LDAP_SUBSTRING_FINAL 0x82L   /* context specific + primitive + 2 */
 
 /* extended filter component types */
-#define LDAP_FILTER_EXTENDED_OID     0x81L  /* context spec. + prim. + 1 */
-#define LDAP_FILTER_EXTENDED_TYPE    0x82L  /* context spec. + prim. + 2 */
-#define LDAP_FILTER_EXTENDED_VALUE   0x83L  /* context spec. + prim. + 3 */
-#define LDAP_FILTER_EXTENDED_DNATTRS 0x84L  /* context spec. + prim. + 4 */
+#define LDAP_FILTER_EXTENDED_OID 0x81L     /* context spec. + prim. + 1 */
+#define LDAP_FILTER_EXTENDED_TYPE 0x82L    /* context spec. + prim. + 2 */
+#define LDAP_FILTER_EXTENDED_VALUE 0x83L   /* context spec. + prim. + 3 */
+#define LDAP_FILTER_EXTENDED_DNATTRS 0x84L /* context spec. + prim. + 4 */
 
 /* U-M LDAP 3.0 compatibility substring filter component types */
-#define LDAP_SUBSTRING_INITIAL_30 0xa0L  /* context specific */
-#define LDAP_SUBSTRING_ANY_30     0xa1L  /* context specific */
-#define LDAP_SUBSTRING_FINAL_30   0xa2L  /* context specific */
+#define LDAP_SUBSTRING_INITIAL_30 0xa0L /* context specific */
+#define LDAP_SUBSTRING_ANY_30 0xa1L     /* context specific */
+#define LDAP_SUBSTRING_FINAL_30 0xa2L   /* context specific */
 
 /* old broken stuff */
 #define OLD_LDAP_SUBSTRING_INITIAL 0x00L
-#define OLD_LDAP_SUBSTRING_ANY     0x01L
-#define OLD_LDAP_SUBSTRING_FINAL   0x02L
+#define OLD_LDAP_SUBSTRING_ANY 0x01L
+#define OLD_LDAP_SUBSTRING_FINAL 0x02L
 
 #ifdef __cplusplus
 }
 #endif
 #endif /* _LDAPROT_H */
--- a/ldap/c-sdk/include/ldif.h
+++ b/ldap/c-sdk/include/ldif.h
@@ -56,59 +56,58 @@
 
 #ifndef _LDIF_H
 #define _LDIF_H
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-#define LDIF_VERSION_ONE        1  /* LDIF standard version */
+#define LDIF_VERSION_ONE 1 /* LDIF standard version */
 
-#define LDIF_MAX_LINE_WIDTH      76      /* maximum length of LDIF lines */
+#define LDIF_MAX_LINE_WIDTH 76 /* maximum length of LDIF lines */
 
 /*
  * Macro to calculate maximum number of bytes that the base64 equivalent
  * of an item that is "vlen" bytes long will take up.  Base64 encoding
  * uses one byte for every six bits in the value plus up to two pad bytes.
  */
-#define LDIF_BASE64_LEN(vlen) (((vlen) * 4 / 3 ) + 3)
+#define LDIF_BASE64_LEN(vlen) (((vlen)*4 / 3) + 3)
 
 /*
  * Macro to calculate maximum size that an LDIF-encoded type (length
  * tlen) and value (length vlen) will take up:  room for type + ":: " +
  * first newline + base64 value + continued lines.  Each continued line
  * needs room for a newline and a leading space character.
  */
-#define LDIF_SIZE_NEEDED(tlen,vlen) \
-    ((tlen) + 4 + LDIF_BASE64_LEN(vlen) \
-    + ((LDIF_BASE64_LEN(vlen) + tlen + 3) / LDIF_MAX_LINE_WIDTH * 2 ))
+#define LDIF_SIZE_NEEDED(tlen, vlen)    \
+  ((tlen) + 4 + LDIF_BASE64_LEN(vlen) + \
+   ((LDIF_BASE64_LEN(vlen) + tlen + 3) / LDIF_MAX_LINE_WIDTH * 2))
 
 /*
  * Options for ldif_put_type_and_value_with_options() and
  * ldif_type_and_value_with_options().
  */
 #define LDIF_OPT_NOWRAP 0x01UL
 #define LDIF_OPT_VALUE_IS_URL 0x02UL
 #define LDIF_OPT_MINIMAL_ENCODING 0x04UL
 
-int ldif_parse_line( char *line, char **type, char **value, int *vlen);
-char * ldif_getline( char **next );
-void ldif_put_type_and_value( char **out, char *t, char *val, int vlen );
-void ldif_put_type_and_value_nowrap( char **out, char *t, char *val, int vlen );
-void ldif_put_type_and_value_with_options( char **out, char *t, char *val,
-  int vlen, unsigned long options );
-char *ldif_type_and_value( char *type, char *val, int vlen );
-char *ldif_type_and_value_nowrap( char *type, char *val, int vlen );
-char *ldif_type_and_value_with_options( char *type, char *val, int vlen,
-  unsigned long options );
-int ldif_base64_decode( char *src, unsigned char *dst );
-int ldif_base64_encode( unsigned char *src, char *dst, int srclen,
-  int lenused );
-int ldif_base64_encode_nowrap( unsigned char *src, char *dst, int srclen,
-  int lenused );
-char *ldif_get_entry( FILE *fp, int *lineno );
+int ldif_parse_line(char *line, char **type, char **value, int *vlen);
+char *ldif_getline(char **next);
+void ldif_put_type_and_value(char **out, char *t, char *val, int vlen);
+void ldif_put_type_and_value_nowrap(char **out, char *t, char *val, int vlen);
+void ldif_put_type_and_value_with_options(char **out, char *t, char *val,
+                                          int vlen, unsigned long options);
+char *ldif_type_and_value(char *type, char *val, int vlen);
+char *ldif_type_and_value_nowrap(char *type, char *val, int vlen);
+char *ldif_type_and_value_with_options(char *type, char *val, int vlen,
+                                       unsigned long options);
+int ldif_base64_decode(char *src, unsigned char *dst);
+int ldif_base64_encode(unsigned char *src, char *dst, int srclen, int lenused);
+int ldif_base64_encode_nowrap(unsigned char *src, char *dst, int srclen,
+                              int lenused);
+char *ldif_get_entry(FILE *fp, int *lineno);
 
 #ifdef __cplusplus
 }
 #endif
 
 #endif /* _LDIF_H */
--- a/ldap/c-sdk/include/portable.h
+++ b/ldap/c-sdk/include/portable.h
@@ -54,331 +54,335 @@
  * portable.h for LDAP -- this is where we define common stuff to make
  * life easier on various Unix systems.
  *
  * Unless you are porting LDAP to a new platform, you should not need to
  * edit this file.
  */
 
 #ifndef SYSV
-#if defined( hpux ) || defined( SOLARIS ) || defined ( sgi ) || defined( SVR4 )
-#define SYSV
-#endif
+#  if defined(hpux) || defined(SOLARIS) || defined(sgi) || defined(SVR4)
+#    define SYSV
+#  endif
 #endif
 
 /*
  * under System V, use sysconf() instead of getdtablesize
  */
-#if !defined( USE_SYSCONF ) && defined( SYSV )
-#define USE_SYSCONF
+#if !defined(USE_SYSCONF) && defined(SYSV)
+#  define USE_SYSCONF
 #endif
 
 /*
  * under System V, daemons should use setsid() instead of detaching from their
  * tty themselves
  */
-#if !defined( USE_SETSID ) && defined( SYSV )
-#define USE_SETSID
+#if !defined(USE_SETSID) && defined(SYSV)
+#  define USE_SETSID
 #endif
 
 /*
  * System V has socket options in filio.h
  */
-#if !defined( NEED_FILIO ) && defined( SYSV ) && !defined( hpux ) && !defined( AIX )
-#define NEED_FILIO
+#if !defined(NEED_FILIO) && defined(SYSV) && !defined(hpux) && !defined(AIX)
+#  define NEED_FILIO
 #endif
 
 /*
  * use lockf() under System V
  */
-#if !defined( USE_LOCKF ) && ( defined( SYSV ) || defined( aix ))
-#define USE_LOCKF
+#if !defined(USE_LOCKF) && (defined(SYSV) || defined(aix))
+#  define USE_LOCKF
 #endif
 
 /*
  * on many systems, we should use waitpid() instead of waitN()
  */
-#if !defined( USE_WAITPID ) && ( defined( SYSV ) || defined( sunos4 ) || defined( ultrix ) || defined( aix ))
-#define USE_WAITPID
+#if !defined(USE_WAITPID) && \
+    (defined(SYSV) || defined(sunos4) || defined(ultrix) || defined(aix))
+#  define USE_WAITPID
 #endif
 
 /*
  * define the wait status argument type
  */
-#if ( defined( SunOS ) && SunOS < 40 ) || defined( nextstep )
-#define WAITSTATUSTYPE union wait
+#if (defined(SunOS) && SunOS < 40) || defined(nextstep)
+#  define WAITSTATUSTYPE union wait
 #else
-#define WAITSTATUSTYPE int
+#  define WAITSTATUSTYPE int
 #endif
 
 /*
  * defined the options for openlog (syslog)
  */
 #ifdef ultrix
-#define OPENLOG_OPTIONS LOG_PID
+#  define OPENLOG_OPTIONS LOG_PID
 #else
-#define OPENLOG_OPTIONS ( LOG_PID | LOG_NOWAIT )
+#  define OPENLOG_OPTIONS (LOG_PID | LOG_NOWAIT)
 #endif
 
 /*
  * some systems don't have the BSD re_comp and re_exec routines
  */
 #ifndef NEED_BSDREGEX
-#if ( defined( SYSV ) || defined( NETBSD ) || defined( FREEBSD ) || defined(__OpenBSD__) || defined( linux ) || defined( DARWIN )) && !defined(sgi)
-#define NEED_BSDREGEX
-#endif
+#  if (defined(SYSV) || defined(NETBSD) || defined(FREEBSD) ||       \
+       defined(__OpenBSD__) || defined(linux) || defined(DARWIN)) && \
+      !defined(sgi)
+#    define NEED_BSDREGEX
+#  endif
 #endif
 
 /*
  * many systems do not have the setpwfile() library routine... we just
  * enable use for those systems we know have it.
  */
 #ifndef HAVE_SETPWFILE
-#if defined( sunos4 ) || defined( ultrix ) || defined( OSF1 )
-#define HAVE_SETPWFILE
-#endif
+#  if defined(sunos4) || defined(ultrix) || defined(OSF1)
+#    define HAVE_SETPWFILE
+#  endif
 #endif
 
 /*
  * Are sys_errlist and sys_nerr declared in stdio.h?
  */
 #ifndef SYSERRLIST_IN_STDIO
-#if defined( freebsd )
-#define SYSERRLIST_IN_STDIO
+#  if defined(freebsd)
+#    define SYSERRLIST_IN_STDIO
+#  endif
 #endif
-#endif
-
 
 /*
  * Is snprintf() part of the standard C runtime library?
  */
 #if defined(_WINDOWS)
-#define snprintf _snprintf
+#  define snprintf _snprintf
 #endif
 
-
 /*
  * Async IO.  Use a non blocking implementation of connect() and
  * dns functions
  */
 #if !defined(LDAP_ASYNC_IO)
-#if !defined(_WINDOWS) && !defined(macintosh)
-#define LDAP_ASYNC_IO
-#endif /* _WINDOWS */
+#  if !defined(_WINDOWS) && !defined(macintosh)
+#    define LDAP_ASYNC_IO
+#  endif /* _WINDOWS */
 #endif
 
 /*
  * for select()
  */
-#if !defined(WINSOCK) && !defined(_WINDOWS) && !defined(macintosh) && !defined(XP_OS2)
-#if defined(hpux) || defined(LINUX) || defined(SUNOS4) || defined(XP_BEOS)
-#include <sys/time.h>
-#else
-#include <sys/select.h>
-#endif
-#if !defined(FD_SET)
-#define NFDBITS         32
-#define FD_SETSIZE      32
-#define FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
-#define FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
-#define FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
-#define FD_ZERO(p)      bzero((char *)(p), sizeof(*(p)))
-#endif /* !FD_SET */
-#endif /* !WINSOCK && !_WINDOWS && !macintosh */
-
+#if !defined(WINSOCK) && !defined(_WINDOWS) && !defined(macintosh) && \
+    !defined(XP_OS2)
+#  if defined(hpux) || defined(LINUX) || defined(SUNOS4) || defined(XP_BEOS)
+#    include <sys/time.h>
+#  else
+#    include <sys/select.h>
+#  endif
+#  if !defined(FD_SET)
+#    define NFDBITS 32
+#    define FD_SETSIZE 32
+#    define FD_SET(n, p) \
+      ((p)->fds_bits[(n) / NFDBITS] |= (1 << ((n) % NFDBITS)))
+#    define FD_CLR(n, p) \
+      ((p)->fds_bits[(n) / NFDBITS] &= ~(1 << ((n) % NFDBITS)))
+#    define FD_ISSET(n, p) \
+      ((p)->fds_bits[(n) / NFDBITS] & (1 << ((n) % NFDBITS)))
+#    define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
+#  endif /* !FD_SET */
+#endif   /* !WINSOCK && !_WINDOWS && !macintosh */
 
 /*
  * for connect() -- must we block signals when calling connect()?  This
  * is necessary on some buggy UNIXes.
  */
-#if !defined(NSLDAPI_CONNECT_MUST_NOT_BE_INTERRUPTED) && \
-  ( defined(AIX) || defined(IRIX) || defined(HPUX) || defined(SUNOS4) \
-  || defined(SOLARIS) || defined(OSF1) ||defined(freebsd))
-#define NSLDAPI_CONNECT_MUST_NOT_BE_INTERRUPTED
+#if !defined(NSLDAPI_CONNECT_MUST_NOT_BE_INTERRUPTED) &&                  \
+    (defined(AIX) || defined(IRIX) || defined(HPUX) || defined(SUNOS4) || \
+     defined(SOLARIS) || defined(OSF1) || defined(freebsd))
+#  define NSLDAPI_CONNECT_MUST_NOT_BE_INTERRUPTED
 #endif
 
 /*
  * On most platforms, sigprocmask() works fine even in multithreaded code.
  * But not everywhere.
  */
 #ifdef AIX
-#define NSLDAPI_MT_SAFE_SIGPROCMASK(h,s,o) sigthreadmask(h,s,o)
+#  define NSLDAPI_MT_SAFE_SIGPROCMASK(h, s, o) sigthreadmask(h, s, o)
 #else
-#define NSLDAPI_MT_SAFE_SIGPROCMASK(h,s,o) sigprocmask(h,s,o)
+#  define NSLDAPI_MT_SAFE_SIGPROCMASK(h, s, o) sigprocmask(h, s, o)
 #endif
 
 /*
  * toupper and tolower macros are different under bsd and sys v
  */
-#if defined( SYSV ) && !defined( hpux )
-#define TOUPPER(c) (isascii(c) && islower(c) ? _toupper(c) : c)
-#define TOLOWER(c) (isascii(c) && isupper(c) ? _tolower(c) : c)
+#if defined(SYSV) && !defined(hpux)
+#  define TOUPPER(c) (isascii(c) && islower(c) ? _toupper(c) : c)
+#  define TOLOWER(c) (isascii(c) && isupper(c) ? _tolower(c) : c)
 #else
-#define TOUPPER(c) (isascii(c) && islower(c) ? toupper(c) : c)
-#define TOLOWER(c) (isascii(c) && isupper(c) ? tolower(c) : c)
+#  define TOUPPER(c) (isascii(c) && islower(c) ? toupper(c) : c)
+#  define TOLOWER(c) (isascii(c) && isupper(c) ? tolower(c) : c)
 #endif
 
 /*
  * put a cover on the tty-related ioctl calls we need to use
  */
-#if defined( NeXT ) || (defined(SunOS) && SunOS < 40)
-#define TERMIO_TYPE struct sgttyb
-#define TERMFLAG_TYPE int
-#define GETATTR( fd, tiop ) ioctl((fd), TIOCGETP, (caddr_t)(tiop))
-#define SETATTR( fd, tiop ) ioctl((fd), TIOCSETP, (caddr_t)(tiop))
-#define GETFLAGS( tio ) (tio).sg_flags
-#define SETFLAGS( tio, flags ) (tio).sg_flags = (flags)
+#if defined(NeXT) || (defined(SunOS) && SunOS < 40)
+#  define TERMIO_TYPE struct sgttyb
+#  define TERMFLAG_TYPE int
+#  define GETATTR(fd, tiop) ioctl((fd), TIOCGETP, (caddr_t)(tiop))
+#  define SETATTR(fd, tiop) ioctl((fd), TIOCSETP, (caddr_t)(tiop))
+#  define GETFLAGS(tio) (tio).sg_flags
+#  define SETFLAGS(tio, flags) (tio).sg_flags = (flags)
 #else
-#define USE_TERMIOS
-#define TERMIO_TYPE struct termios
-#define TERMFLAG_TYPE tcflag_t
-#define GETATTR( fd, tiop ) tcgetattr((fd), (tiop))
-#define SETATTR( fd, tiop ) tcsetattr((fd), TCSANOW /* 0 */, (tiop))
-#define GETFLAGS( tio ) (tio).c_lflag
-#define SETFLAGS( tio, flags ) (tio).c_lflag = (flags)
+#  define USE_TERMIOS
+#  define TERMIO_TYPE struct termios
+#  define TERMFLAG_TYPE tcflag_t
+#  define GETATTR(fd, tiop) tcgetattr((fd), (tiop))
+#  define SETATTR(fd, tiop) tcsetattr((fd), TCSANOW /* 0 */, (tiop))
+#  define GETFLAGS(tio) (tio).c_lflag
+#  define SETFLAGS(tio, flags) (tio).c_lflag = (flags)
 #endif
 
-#if ( !defined( HPUX9 )) && ( !defined( sunos4 )) && ( !defined( SNI )) && \
-  ( !defined( HAVE_TIME_R ))
-#define HAVE_TIME_R
+#if (!defined(HPUX9)) && (!defined(sunos4)) && (!defined(SNI)) && \
+    (!defined(HAVE_TIME_R))
+#  define HAVE_TIME_R
 #endif
 
 #if defined(SNI) || defined(LINUX1_2)
 int strcasecmp(const char *, const char *);
-#ifdef SNI
+#  ifdef SNI
 int strncasecmp(const char *, const char *, int);
-#endif /* SNI */
-#ifdef LINUX1_2
+#  endif /* SNI */
+#  ifdef LINUX1_2
 int strncasecmp(const char *, const char *, size_t);
-#endif /* LINUX1_2 */
-#endif /* SNI || LINUX1_2 */
+#  endif /* LINUX1_2 */
+#endif   /* SNI || LINUX1_2 */
 
-#if defined(_WINDOWS) || defined(macintosh) || defined(XP_OS2) || defined(DARWIN)
-#define GETHOSTBYNAME( n, r, b, l, e )  gethostbyname( n )
-#define NSLDAPI_CTIME( c, b, l ) ctime( c )
-#define STRTOK( s1, s2, l ) strtok( s1, s2 )
+#if defined(_WINDOWS) || defined(macintosh) || defined(XP_OS2) || \
+    defined(DARWIN)
+#  define GETHOSTBYNAME(n, r, b, l, e) gethostbyname(n)
+#  define NSLDAPI_CTIME(c, b, l) ctime(c)
+#  define STRTOK(s1, s2, l) strtok(s1, s2)
 #elif defined(XP_BEOS)
-#define GETHOSTBYNAME( n, r, b, l, e )  gethostbyname( n )
-#define NSLDAPI_CTIME( c, b, l )                ctime_r( c, b )
-#define STRTOK( s1, s2, l ) strtok_r( s1, s2, l )
-#define HAVE_STRTOK_R
+#  define GETHOSTBYNAME(n, r, b, l, e) gethostbyname(n)
+#  define NSLDAPI_CTIME(c, b, l) ctime_r(c, b)
+#  define STRTOK(s1, s2, l) strtok_r(s1, s2, l)
+#  define HAVE_STRTOK_R
 #else /* UNIX */
-#if (defined(AIX) && defined(_THREAD_SAFE)) || defined(OSF1)
-#define NSLDAPI_NETDB_BUF_SIZE sizeof(struct protoent_data)
-#else
-#define NSLDAPI_NETDB_BUF_SIZE 1024
-#endif
+#  if (defined(AIX) && defined(_THREAD_SAFE)) || defined(OSF1)
+#    define NSLDAPI_NETDB_BUF_SIZE sizeof(struct protoent_data)
+#  else
+#    define NSLDAPI_NETDB_BUF_SIZE 1024
+#  endif
 
-#if defined(sgi) || defined(HPUX9) || defined(SCOOS) || \
-    defined(UNIXWARE) || defined(SUNOS4) || defined(SNI) || defined(BSDI) || \
-    defined(NCR) || defined(OSF1) || defined(NEC) || defined(VMS) || \
-    ( defined(HPUX10) && !defined(_REENTRANT)) || defined(HPUX11) || \
-    defined(UnixWare) || defined(NETBSD) || \
-    defined(FREEBSD) || defined(OPENBSD) || \
-    (defined(LINUX) && __GLIBC__ < 2) || \
-    (defined(AIX) && !defined(USE_REENTRANT_LIBC))
-#define GETHOSTBYNAME( n, r, b, l, e )  gethostbyname( n )
-#elif defined(AIX)
+#  if defined(sgi) || defined(HPUX9) || defined(SCOOS) || defined(UNIXWARE) || \
+      defined(SUNOS4) || defined(SNI) || defined(BSDI) || defined(NCR) ||      \
+      defined(OSF1) || defined(NEC) || defined(VMS) ||                         \
+      (defined(HPUX10) && !defined(_REENTRANT)) || defined(HPUX11) ||          \
+      defined(UnixWare) || defined(NETBSD) || defined(FREEBSD) ||              \
+      defined(OPENBSD) || (defined(LINUX) && __GLIBC__ < 2) ||                 \
+      (defined(AIX) && !defined(USE_REENTRANT_LIBC))
+#    define GETHOSTBYNAME(n, r, b, l, e) gethostbyname(n)
+#  elif defined(AIX)
 /* Maybe this is for another version of AIX?
    Commenting out for AIX 4.1 for Nova
    Replaced with following to lines, stolen from the #else below
 #define GETHOSTBYNAME_BUF_T struct hostent_data
 */
-typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE];
-#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
-#define GETHOSTBYNAME( n, r, b, l, e ) \
-  (memset (&b, 0, l), gethostbyname_r (n, r, &b) ? NULL : r)
-#elif defined(HPUX10)
-#define GETHOSTBYNAME_BUF_T struct hostent_data
-#define GETHOSTBYNAME( n, r, b, l, e ) nsldapi_compat_gethostbyname_r( n, r, (char *)&b, l, e )
-#elif defined(LINUX) || defined(DRAGONFLY)
-typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE];
-#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
-#define GETHOSTBYNAME( n, r, b, l, rp, e )  gethostbyname_r( n, r, b, l, rp, e )
-#define GETHOSTBYNAME_R_RETURNS_INT
-#else
-typedef char GETHOSTBYNAME_buf_t [NSLDAPI_NETDB_BUF_SIZE];
-#define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
-#define GETHOSTBYNAME( n, r, b, l, e )  gethostbyname_r( n, r, b, l, e )
-#endif
-#if defined(HPUX9) || defined(LINUX1_2) || defined(LINUX2_0) || \
-    defined(LINUX2_1) || defined(SUNOS4) || defined(SNI) || \
-    defined(SCOOS) || defined(BSDI) || defined(NCR) || \
-    defined(NEC) || ( defined(HPUX10) && !defined(_REENTRANT)) || \
-    (defined(AIX) && !defined(USE_REENTRANT_LIBC))
-#define NSLDAPI_CTIME( c, b, l ) ctime( c )
-#elif defined(HPUX10) && defined(_REENTRANT) && !defined(HPUX11)
-#define NSLDAPI_CTIME( c, b, l ) nsldapi_compat_ctime_r( c, b, l )
-#elif defined( IRIX6_2 ) || defined( IRIX6_3 ) || defined(UNIXWARE) \
-  || defined(OSF1V4) || defined(AIX) || defined(UnixWare) \
-        || defined(hpux) || defined(HPUX11) || defined(NETBSD) \
-        || defined(IRIX6) || defined(FREEBSD) || defined(VMS) \
-        || defined(NTO) || defined(OPENBSD) || defined(DRAGONFLY)
-#define NSLDAPI_CTIME( c, b, l )        ctime_r( c, b )
-#elif defined( OSF1V3 )
-#define NSLDAPI_CTIME( c, b, l ) (ctime_r( c, b, l ) ? NULL : b)
-#else
-#define NSLDAPI_CTIME( c, b, l ) ctime_r( c, b, l )
-#endif
-#if defined(hpux9) || defined(SUNOS4) || defined(SNI) || \
-    defined(SCOOS) || defined(BSDI) || defined(NCR) || defined(VMS) || \
-    defined(NEC) || (defined(LINUX) && __GNU_LIBRARY__ != 6) || \
-    (defined(AIX) && !defined(USE_REENTRANT_LIBC))
-#define STRTOK( s1, s2, l ) strtok( s1, s2 )
-#else
-#define HAVE_STRTOK_R
-#ifndef strtok_r
+typedef char GETHOSTBYNAME_buf_t[NSLDAPI_NETDB_BUF_SIZE];
+#    define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
+#    define GETHOSTBYNAME(n, r, b, l, e) \
+      (memset(&b, 0, l), gethostbyname_r(n, r, &b) ? NULL : r)
+#  elif defined(HPUX10)
+#    define GETHOSTBYNAME_BUF_T struct hostent_data
+#    define GETHOSTBYNAME(n, r, b, l, e) \
+      nsldapi_compat_gethostbyname_r(n, r, (char *)&b, l, e)
+#  elif defined(LINUX) || defined(DRAGONFLY)
+typedef char GETHOSTBYNAME_buf_t[NSLDAPI_NETDB_BUF_SIZE];
+#    define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
+#    define GETHOSTBYNAME(n, r, b, l, rp, e) gethostbyname_r(n, r, b, l, rp, e)
+#    define GETHOSTBYNAME_R_RETURNS_INT
+#  else
+typedef char GETHOSTBYNAME_buf_t[NSLDAPI_NETDB_BUF_SIZE];
+#    define GETHOSTBYNAME_BUF_T GETHOSTBYNAME_buf_t
+#    define GETHOSTBYNAME(n, r, b, l, e) gethostbyname_r(n, r, b, l, e)
+#  endif
+#  if defined(HPUX9) || defined(LINUX1_2) || defined(LINUX2_0) ||        \
+      defined(LINUX2_1) || defined(SUNOS4) || defined(SNI) ||            \
+      defined(SCOOS) || defined(BSDI) || defined(NCR) || defined(NEC) || \
+      (defined(HPUX10) && !defined(_REENTRANT)) ||                       \
+      (defined(AIX) && !defined(USE_REENTRANT_LIBC))
+#    define NSLDAPI_CTIME(c, b, l) ctime(c)
+#  elif defined(HPUX10) && defined(_REENTRANT) && !defined(HPUX11)
+#    define NSLDAPI_CTIME(c, b, l) nsldapi_compat_ctime_r(c, b, l)
+#  elif defined(IRIX6_2) || defined(IRIX6_3) || defined(UNIXWARE) ||           \
+      defined(OSF1V4) || defined(AIX) || defined(UnixWare) || defined(hpux) || \
+      defined(HPUX11) || defined(NETBSD) || defined(IRIX6) ||                  \
+      defined(FREEBSD) || defined(VMS) || defined(NTO) || defined(OPENBSD) ||  \
+      defined(DRAGONFLY)
+#    define NSLDAPI_CTIME(c, b, l) ctime_r(c, b)
+#  elif defined(OSF1V3)
+#    define NSLDAPI_CTIME(c, b, l) (ctime_r(c, b, l) ? NULL : b)
+#  else
+#    define NSLDAPI_CTIME(c, b, l) ctime_r(c, b, l)
+#  endif
+#  if defined(hpux9) || defined(SUNOS4) || defined(SNI) || defined(SCOOS) || \
+      defined(BSDI) || defined(NCR) || defined(VMS) || defined(NEC) ||       \
+      (defined(LINUX) && __GNU_LIBRARY__ != 6) ||                            \
+      (defined(AIX) && !defined(USE_REENTRANT_LIBC))
+#    define STRTOK(s1, s2, l) strtok(s1, s2)
+#  else
+#    define HAVE_STRTOK_R
+#    ifndef strtok_r
 char *strtok_r(char *, const char *, char **);
-#endif
-#define STRTOK( s1, s2, l ) (char *)strtok_r( s1, s2, l )
-#endif /* STRTOK */
-#endif /* UNIX */
+#    endif
+#    define STRTOK(s1, s2, l) (char *)strtok_r(s1, s2, l)
+#  endif /* STRTOK */
+#endif   /* UNIX */
 
-#if defined( ultrix ) || defined( nextstep )
+#if defined(ultrix) || defined(nextstep)
 extern char *strdup();
 #endif /* ultrix || nextstep */
 
-#if defined( sunos4 ) || defined( OSF1 )
-#define BSD_TIME 1  /* for servers/slapd/log.h */
-#endif /* sunos4 || osf */
+#if defined(sunos4) || defined(OSF1)
+#  define BSD_TIME 1 /* for servers/slapd/log.h */
+#endif               /* sunos4 || osf */
 
 #if defined(XP_OS2)
-#include <machine/endian.h>   /* for htonl, et.al. */
-#include <arpa/inet.h>  /* for inet_addr() */
+#  include <machine/endian.h> /* for htonl, et.al. */
+#  include <arpa/inet.h>      /* for inet_addr() */
 #elif !defined(_WINDOWS) && !defined(macintosh)
-#include <netinet/in.h>
-#if !defined(XP_BEOS)
-#include <arpa/inet.h>  /* for inet_addr() */
+#  include <netinet/in.h>
+#  if !defined(XP_BEOS)
+#    include <arpa/inet.h> /* for inet_addr() */
+#  endif
 #endif
-#endif
-
 
 /*
  * Define portable 32-bit integral types.
  */
 #include <limits.h>
-#if UINT_MAX >= 0xffffffffU  /* an int holds at least 32 bits */
-    typedef signed int nsldapi_int_32;
-    typedef unsigned int nsldapi_uint_32;
-#else  /* ints are < 32 bits; use long instead */
-    typedef signed long nsldapi_int_32;
-    typedef unsigned long nsldapi_uint_32;
+#if UINT_MAX >= 0xffffffffU /* an int holds at least 32 bits */
+typedef signed int nsldapi_int_32;
+typedef unsigned int nsldapi_uint_32;
+#else /* ints are < 32 bits; use long instead */
+typedef signed long nsldapi_int_32;
+typedef unsigned long nsldapi_uint_32;
 #endif
 
 /*
  * Define a portable type for IPv4 style Internet addresses (32 bits):
  */
 #if defined(_IN_ADDR_T) || defined(aix) || defined(HPUX11) || defined(OSF1)
 typedef in_addr_t nsldapi_in_addr_t;
 #else
 typedef nsldapi_uint_32 nsldapi_in_addr_t;
 #endif
 
 #ifdef SUNOS4
-#include <pcfs/pc_dir.h>  /* for toupper() */
+#  include <pcfs/pc_dir.h> /* for toupper() */
 int fprintf(FILE *, char *, ...);
 int fseek(FILE *, long, int);
 int fread(char *, int, int, FILE *);
 int fclose(FILE *);
 int fflush(FILE *);
 int rewind(FILE *);
 void *memmove(void *, const void *, size_t);
 int strcasecmp(char *, char *);
@@ -386,73 +390,73 @@ int strncasecmp(char *, char *, int);
 time_t time(time_t *);
 void perror(char *);
 int fputc(char, FILE *);
 int fputs(char *, FILE *);
 int re_exec(char *);
 int socket(int, int, int);
 void bzero(char *, int);
 unsigned long inet_addr(char *);
-char * inet_ntoa(struct in_addr);
+char *inet_ntoa(struct in_addr);
 int getdtablesize();
 int connect(int, struct sockaddr *, int);
 #endif /* SUNOS4 */
 
 /* #if defined(SUNOS4) || defined(SNI) */
 #if defined(SUNOS4)
 int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
 #endif /* SUNOS4 || SNI */
 
 /*
  * SAFEMEMCPY is an overlap-safe copy from s to d of n bytes
  */
 #ifdef macintosh
-#define SAFEMEMCPY( d, s, n ) BlockMoveData( (Ptr)s, (Ptr)d, n )
+#  define SAFEMEMCPY(d, s, n) BlockMoveData((Ptr)s, (Ptr)d, n)
 #else /* macintosh */
-#ifdef sunos4
-#define SAFEMEMCPY( d, s, n ) bcopy( s, d, n )
-#else /* sunos4 */
-#define SAFEMEMCPY( d, s, n ) memmove( d, s, n )
-#endif /* sunos4 */
-#endif /* macintosh */
+#  ifdef sunos4
+#    define SAFEMEMCPY(d, s, n) bcopy(s, d, n)
+#  else /* sunos4 */
+#    define SAFEMEMCPY(d, s, n) memmove(d, s, n)
+#  endif /* sunos4 */
+#endif   /* macintosh */
 
 #ifdef _WINDOWS
 
-#define strcasecmp strcmpi
-#define strncasecmp _strnicmp
-#define bzero(a, b) memset( a, 0, b )
-#define getpid _getpid
-#define ioctl ioctlsocket
-#define sleep(a) Sleep( a*1000 )
+#  define strcasecmp strcmpi
+#  define strncasecmp _strnicmp
+#  define bzero(a, b) memset(a, 0, b)
+#  define getpid _getpid
+#  define ioctl ioctlsocket
+#  define sleep(a) Sleep(a * 1000)
 
-#ifndef MAXPATHLEN
-#define MAXPATHLEN _MAX_PATH
-#endif
+#  ifndef MAXPATHLEN
+#    define MAXPATHLEN _MAX_PATH
+#  endif
 
 /* We'd like this number to be prime for the hash
  * into the Connection table */
-#define DS_MAX_NT_SOCKET_CONNECTIONS 2003
+#  define DS_MAX_NT_SOCKET_CONNECTIONS 2003
 
 #elif defined(XP_OS2)
 
-#define strcasecmp stricmp
-#define strncasecmp strnicmp
-#define bzero(a, b) memset( a, 0, b )
-#include <string.h> /*for strcmpi()*/
-#include <time.h>   /*for ctime()*/
+#  define strcasecmp stricmp
+#  define strncasecmp strnicmp
+#  define bzero(a, b) memset(a, 0, b)
+#  include <string.h> /*for strcmpi()*/
+#  include <time.h>   /*for ctime()*/
 
 #endif /* XP_OS2 */
 
 /* Define a macro to support large files */
 #ifdef _LARGEFILE64_SOURCE
-#define NSLDAPI_FOPEN( filename, mode ) fopen64( filename, mode )
+#  define NSLDAPI_FOPEN(filename, mode) fopen64(filename, mode)
 #else
-#define NSLDAPI_FOPEN( filename, mode ) fopen( filename, mode )
+#  define NSLDAPI_FOPEN(filename, mode) fopen(filename, mode)
 #endif
 
 #if defined(LINUX) || defined(AIX) || defined(HPUX) || defined(_WINDOWS)
 size_t nsldapi_compat_strlcpy(char *dst, const char *src, size_t len);
-#define STRLCPY nsldapi_compat_strlcpy
+#  define STRLCPY nsldapi_compat_strlcpy
 #else
-#define STRLCPY strlcpy
+#  define STRLCPY strlcpy
 #endif
 
 #endif /* _PORTABLE_H */
--- a/ldap/c-sdk/include/proto-ntutil.h
+++ b/ldap/c-sdk/include/proto-ntutil.h
@@ -36,64 +36,64 @@
  * ***** END LICENSE BLOCK ***** */
 
 /******************************************************
  *
  *  proto-ntutil.h - Prototypes for utility functions used
  *  throughout slapd on NT.
  *
  ******************************************************/
-#if defined( _WINDOWS )
+#if defined(_WINDOWS)
 
-#ifndef _PROTO_NTUTIL
-#define _PROTO_NTUTIL
+#  ifndef _PROTO_NTUTIL
+#    define _PROTO_NTUTIL
 
 /*
  *
  * ntreg.c
  *
  */
-extern int SlapdGetRegSZ( LPTSTR lpszRegKey, LPSTR lpszValueName, LPTSTR lpszValue );
+extern int SlapdGetRegSZ(LPTSTR lpszRegKey, LPSTR lpszValueName,
+                         LPTSTR lpszValue);
 
 /*
  *
  * getopt.c
  *
  */
-extern int getopt (int argc, char *const *argv, const char *optstring);
+extern int getopt(int argc, char *const *argv, const char *optstring);
 
 /*
  *
  * ntevent.c
  *
  */
 extern BOOL MultipleInstances();
 extern BOOL SlapdIsAService();
-extern void InitializeSlapdLogging( LPTSTR lpszRegLocation, LPTSTR lpszEventLogName, LPTSTR lpszMessageFile );
-extern void ReportSlapdEvent(WORD wEventType, DWORD dwIdEvent, WORD wNumInsertStrings,
-                             char *pszStrings);
-extern BOOL ReportSlapdStatusToSCMgr(
-                    SERVICE_STATUS *serviceStatus,
-                    SERVICE_STATUS_HANDLE serviceStatusHandle,
-                    HANDLE Event,
-                    DWORD dwCurrentState,
-                    DWORD dwWin32ExitCode,
-                    DWORD dwCheckPoint,
-                    DWORD dwWaitHint);
+extern void InitializeSlapdLogging(LPTSTR lpszRegLocation,
+                                   LPTSTR lpszEventLogName,
+                                   LPTSTR lpszMessageFile);
+extern void ReportSlapdEvent(WORD wEventType, DWORD dwIdEvent,
+                             WORD wNumInsertStrings, char *pszStrings);
+extern BOOL ReportSlapdStatusToSCMgr(SERVICE_STATUS *serviceStatus,
+                                     SERVICE_STATUS_HANDLE serviceStatusHandle,
+                                     HANDLE Event, DWORD dwCurrentState,
+                                     DWORD dwWin32ExitCode, DWORD dwCheckPoint,
+                                     DWORD dwWaitHint);
 extern void WINAPI SlapdServiceCtrlHandler(DWORD dwOpcode);
 extern BOOL SlapdGetServerNameFromCmdline(char *szServerName, char *szCmdLine);
 
 /*
  *
  * ntgetpassword.c
  *
  */
-#ifdef NET_SSL
+#    ifdef NET_SSL
 extern char *Slapd_GetPassword();
-#ifdef FORTEZZA
+#      ifdef FORTEZZA
 extern char *Slapd_GetFortezzaPIN();
-#endif
+#      endif
 extern void CenterDialog(HWND hwndParent, HWND hwndDialog);
-#endif /* NET_SSL */
+#    endif /* NET_SSL */
 
-#endif /* _PROTO_NTUTIL */
+#  endif /* _PROTO_NTUTIL */
 
 #endif /* _WINDOWS */
--- a/ldap/c-sdk/include/regex.h
+++ b/ldap/c-sdk/include/regex.h
@@ -30,66 +30,67 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#if defined( macintosh ) || defined( DOS ) || defined( _WINDOWS ) || defined( NEED_BSDREGEX ) || defined( XP_OS2 )
+#if defined(macintosh) || defined(DOS) || defined(_WINDOWS) || \
+    defined(NEED_BSDREGEX) || defined(XP_OS2)
 /*
  * Copyright (c) 1993 Regents of the University of Michigan.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * provided that this notice is preserved and that due credit is given
  * to the University of Michigan at Ann Arbor. The name of the University
  * may not be used to endorse or promote products derived from this
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  */
 /*
  * regex.h -- includes for regular expression matching routines
  * 13 August 1993 Mark C Smith
  */
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 extern "C" {
-#endif
+#  endif
 
-#include "ldap.h"
+#  include "ldap.h"
 
-#if !defined( NEEDPROTOS ) && defined( __STDC__ )
-#define NEEDPROTOS
-#endif
+#  if !defined(NEEDPROTOS) && defined(__STDC__)
+#    define NEEDPROTOS
+#  endif
 
-#ifdef _SLDAPD_H_  /* server build: no need to use LDAP_CALL stuff */
-#ifdef LDAP_CALL
-#undef LDAP_CALL
-#define LDAP_CALL
-#endif
-#endif
+#  ifdef _SLDAPD_H_ /* server build: no need to use LDAP_CALL stuff */
+#    ifdef LDAP_CALL
+#      undef LDAP_CALL
+#      define LDAP_CALL
+#    endif
+#  endif
 
-#ifdef NEEDPROTOS
-int re_init( void );
-void re_lock( void );
-int re_unlock( void );
-char * LDAP_CALL re_comp( const char *pat );
-int LDAP_CALL re_exec( const char *lp );
-void LDAP_CALL re_modw( char *s );
-int LDAP_CALL re_subs( char *src, char *dst );
-#else /* NEEDPROTOS */
+#  ifdef NEEDPROTOS
+int re_init(void);
+void re_lock(void);
+int re_unlock(void);
+char *LDAP_CALL re_comp(const char *pat);
+int LDAP_CALL re_exec(const char *lp);
+void LDAP_CALL re_modw(char *s);
+int LDAP_CALL re_subs(char *src, char *dst);
+#  else  /* NEEDPROTOS */
 int re_init();
 void re_lock();
 int re_unlock();
-char * LDAP_CALL re_comp();
+char* LDAP_CALL re_comp();
 int LDAP_CALL re_exec();
 void LDAP_CALL re_modw();
 int LDAP_CALL re_subs();
-#endif /* NEEDPROTOS */
+#  endif /* NEEDPROTOS */
 
-#define re_fail( m, p )
+#  define re_fail(m, p)
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 }
-#endif
+#  endif
 #endif /* macintosh or DOS or or _WIN32 or NEED_BSDREGEX */
--- a/ldap/c-sdk/include/srchpref.h
+++ b/ldap/c-sdk/include/srchpref.h
@@ -44,43 +44,42 @@
  * to the University of Michigan at Ann Arbor. The name of the University
  * may not be used to endorse or promote products derived from this
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  *
  * searchpref.h:  display template library defines
  */
 
-
 #ifndef _SRCHPREF_H
-#define _SRCHPREF_H
+#  define _SRCHPREF_H
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 extern "C" {
-#endif
+#  endif
 
 /* calling conventions used by library */
-#ifndef LDAP_CALL
-#if defined( _WINDOWS ) || defined( _WIN32 )
-#define LDAP_C __cdecl
-#ifndef _WIN32
-#define __stdcall _far _pascal
-#define LDAP_CALLBACK _loadds
-#else
-#define LDAP_CALLBACK
-#endif /* _WIN32 */
-#define LDAP_PASCAL __stdcall
-#define LDAP_CALL LDAP_PASCAL
-#else /* _WINDOWS */
-#define LDAP_C
-#define LDAP_CALLBACK
-#define LDAP_PASCAL
-#define LDAP_CALL
-#endif /* _WINDOWS */
-#endif /* LDAP_CALL */
+#  ifndef LDAP_CALL
+#    if defined(_WINDOWS) || defined(_WIN32)
+#      define LDAP_C __cdecl
+#      ifndef _WIN32
+#        define __stdcall _far _pascal
+#        define LDAP_CALLBACK _loadds
+#      else
+#        define LDAP_CALLBACK
+#      endif /* _WIN32 */
+#      define LDAP_PASCAL __stdcall
+#      define LDAP_CALL LDAP_PASCAL
+#    else /* _WINDOWS */
+#      define LDAP_C
+#      define LDAP_CALLBACK
+#      define LDAP_PASCAL
+#      define LDAP_CALL
+#    endif /* _WINDOWS */
+#  endif   /* LDAP_CALL */
 
 struct ldap_searchattr {
   char *sa_attrlabel;
   char *sa_attr;
   /* max 32 matchtypes for now */
   unsigned long sa_matchtypebitmap;
   char *sa_selectattr;
   char *sa_selecttext;
@@ -102,53 +101,51 @@ struct ldap_searchobj {
   char *so_filtertag;
   char *so_defaultselectattr;
   char *so_defaultselecttext;
   struct ldap_searchattr *so_salist;
   struct ldap_searchmatch *so_smlist;
   struct ldap_searchobj *so_next;
 };
 
-#define NULLSEARCHOBJ ((struct ldap_searchobj *)0)
+#  define NULLSEARCHOBJ ((struct ldap_searchobj *)0)
 
 /*
  * global search object options
  */
-#define LDAP_SEARCHOBJ_OPT_INTERNAL 0x00000001
+#  define LDAP_SEARCHOBJ_OPT_INTERNAL 0x00000001
 
-#define LDAP_IS_SEARCHOBJ_OPTION_SET( so, option ) \
-  (((so)->so_options & option ) != 0 )
+#  define LDAP_IS_SEARCHOBJ_OPTION_SET(so, option) \
+    (((so)->so_options & option) != 0)
 
-#define LDAP_SEARCHPREF_VERSION_ZERO 0
-#define LDAP_SEARCHPREF_VERSION 1
+#  define LDAP_SEARCHPREF_VERSION_ZERO 0
+#  define LDAP_SEARCHPREF_VERSION 1
 
-#define LDAP_SEARCHPREF_ERR_VERSION 1
-#define LDAP_SEARCHPREF_ERR_MEM 2
-#define LDAP_SEARCHPREF_ERR_SYNTAX 3
-#define LDAP_SEARCHPREF_ERR_FILE 4
-
+#  define LDAP_SEARCHPREF_ERR_VERSION 1
+#  define LDAP_SEARCHPREF_ERR_MEM 2
+#  define LDAP_SEARCHPREF_ERR_SYNTAX 3
+#  define LDAP_SEARCHPREF_ERR_FILE 4
 
 LDAP_API(int)
 LDAP_CALL
-ldap_init_searchprefs( char *file, struct ldap_searchobj **solistp );
+ldap_init_searchprefs(char *file, struct ldap_searchobj **solistp);
 
 LDAP_API(int)
 LDAP_CALL
-ldap_init_searchprefs_buf( char *buf, long buflen,
-  struct ldap_searchobj **solistp );
+ldap_init_searchprefs_buf(char *buf, long buflen,
+                          struct ldap_searchobj **solistp);
 
 LDAP_API(void)
 LDAP_CALL
-ldap_free_searchprefs( struct ldap_searchobj *solist );
+ldap_free_searchprefs(struct ldap_searchobj *solist);
 
 LDAP_API(struct ldap_searchobj *)
 LDAP_CALL
-ldap_first_searchobj( struct ldap_searchobj *solist );
+ldap_first_searchobj(struct ldap_searchobj *solist);
 
 LDAP_API(struct ldap_searchobj *)
 LDAP_CALL
-ldap_next_searchobj( struct ldap_searchobj *sollist,
-  struct ldap_searchobj *so );
+ldap_next_searchobj(struct ldap_searchobj *sollist, struct ldap_searchobj *so);
 
-#ifdef __cplusplus
+#  ifdef __cplusplus
 }
-#endif
+#  endif
 #endif /* _SRCHPREF_H */
--- a/ldap/c-sdk/libraries/liblber/bprint.c
+++ b/ldap/c-sdk/libraries/liblber/bprint.c
@@ -1,102 +1,99 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- * 
- * The contents of this file are subject to the Mozilla Public License Version 
- * 1.1 (the "License"); you may not use this file except in compliance with 
- * the License. You may obtain a copy of the License at 
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
- * 
+ *
  * The Original Code is Mozilla Communicator client code, released
  * March 31, 1998.
- * 
+ *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998-1999
  * the Initial Developer. All Rights Reserved.
- * 
+ *
  * Contributor(s):
- * 
+ *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
- * 
+ *
  * ***** END LICENSE BLOCK ***** */
 
 /* bprint.c - a printing utility for debugging output */
 #include <string.h>
 #include "lber-int.h"
 
 #ifdef LDAP_DEBUG
 /*
  * Print arbitrary stuff, for debugging.
  */
 
-#define BPLEN	48
+#  define BPLEN 48
 
-void
-lber_bprint( char *data, int len )
-{
-    static char	hexdig[] = "0123456789abcdef";
-    char	out[ BPLEN ];
-    int		i = 0;
+void lber_bprint(char *data, int len) {
+  static char hexdig[] = "0123456789abcdef";
+  char out[BPLEN];
+  int i = 0;
 
-    memset( out, 0, BPLEN );
-    for ( ;; ) {
-	if ( len < 1 ) {
-		char msg[BPLEN + 80];
-	    sprintf( msg, "\t%s\n", ( i == 0 ) ? "(end)" : out );
-		ber_err_print( msg );
-	    break;
-	}
+  memset(out, 0, BPLEN);
+  for (;;) {
+    if (len < 1) {
+      char msg[BPLEN + 80];
+      sprintf(msg, "\t%s\n", (i == 0) ? "(end)" : out);
+      ber_err_print(msg);
+      break;
+    }
 
-#ifndef HEX
-	if ( isgraph( (unsigned char)*data )) {
-	    out[ i ] = ' ';
-	    out[ i+1 ] = *data;
-	} else {
-#endif
-	    out[ i ] = hexdig[ ( *data & 0xf0 ) >> 4 ];
-	    out[ i+1 ] = hexdig[ *data & 0x0f ];
-#ifndef HEX
-	}
-#endif
-	i += 2;
-	len--;
-	data++;
+#  ifndef HEX
+    if (isgraph((unsigned char)*data)) {
+      out[i] = ' ';
+      out[i + 1] = *data;
+    } else {
+#  endif
+      out[i] = hexdig[(*data & 0xf0) >> 4];
+      out[i + 1] = hexdig[*data & 0x0f];
+#  ifndef HEX
+    }
+#  endif
+    i += 2;
+    len--;
+    data++;
 
-	if ( i > BPLEN - 2 ) {
-		char msg[BPLEN + 80];
-	    sprintf( msg, "\t%s\n", out );
-		ber_err_print( msg );
-	    memset( out, 0, BPLEN );
-	    i = 0;
-	    continue;
-	}
-	out[ i++ ] = ' ';
+    if (i > BPLEN - 2) {
+      char msg[BPLEN + 80];
+      sprintf(msg, "\t%s\n", out);
+      ber_err_print(msg);
+      memset(out, 0, BPLEN);
+      i = 0;
+      continue;
     }
+    out[i++] = ' ';
+  }
 }
 
 #endif
 
-void ber_err_print( char *data )
-{
+void ber_err_print(char *data) {
 #ifdef USE_DEBUG_WIN
-	OutputDebugString( data );
+  OutputDebugString(data);
 #else
-	fputs( data, stderr );
-	fflush( stderr );
+  fputs(data, stderr);
+  fflush(stderr);
 #endif
 }
--- a/ldap/c-sdk/libraries/liblber/decode.c
+++ b/ldap/c-sdk/libraries/liblber/decode.c
@@ -1,43 +1,43 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- * 
- * The contents of this file are subject to the Mozilla Public License Version 
- * 1.1 (the "License"); you may not use this file except in compliance with 
- * the License. You may obtain a copy of the License at 
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
- * 
+ *
  * The Original Code is Mozilla Communicator client code, released
  * March 31, 1998.
- * 
+ *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998-1999
  * the Initial Developer. All Rights Reserved.
- * 
+ *
  * Contributor(s):
- * 
+ *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
- * 
+ *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * Copyright (c) 1990 Regents of the University of Michigan.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * provided that this notice is preserved and that due credit is given
@@ -52,782 +52,696 @@
 #include "lber-int.h"
 
 /*
  * Note: ber_get_tag() only uses the ber_end and ber_ptr elements of ber.
  * If that changes, the ber_peek_tag() and/or ber_skip_tag() implementations
  * will need to be changed.
  */
 /* return the tag - LBER_DEFAULT returned means trouble */
-ber_tag_t
-LDAP_CALL
-ber_get_tag( BerElement *ber )
-{
-	unsigned char	xbyte;
-	ber_tag_t		tag;
-	char			*tagp;
-	int				i;
+ber_tag_t LDAP_CALL ber_get_tag(BerElement *ber) {
+  unsigned char xbyte;
+  ber_tag_t tag;
+  char *tagp;
+  int i;
 
-	if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 )
-		return( LBER_DEFAULT );
+  if (ber_read(ber, (char *)&xbyte, 1) != 1) return (LBER_DEFAULT);
 
-	if ( (xbyte & LBER_BIG_TAG_MASK) != LBER_BIG_TAG_MASK )
-		return( (ber_uint_t) xbyte );
+  if ((xbyte & LBER_BIG_TAG_MASK) != LBER_BIG_TAG_MASK)
+    return ((ber_uint_t)xbyte);
 
-	tagp = (char *) &tag;
-	tagp[0] = xbyte;
-	for ( i = 1; i < sizeof(ber_int_t); i++ ) {
-		if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 )
-			return( LBER_DEFAULT );
+  tagp = (char *)&tag;
+  tagp[0] = xbyte;
+  for (i = 1; i < sizeof(ber_int_t); i++) {
+    if (ber_read(ber, (char *)&xbyte, 1) != 1) return (LBER_DEFAULT);
 
-		tagp[i] = xbyte;
+    tagp[i] = xbyte;
 
-		if ( ! (xbyte & LBER_MORE_TAG_MASK) )
-			break;
-	}
+    if (!(xbyte & LBER_MORE_TAG_MASK)) break;
+  }
 
-	/* tag too big! */
-	if ( i == sizeof(ber_int_t) )
-		return( LBER_DEFAULT );
+  /* tag too big! */
+  if (i == sizeof(ber_int_t)) return (LBER_DEFAULT);
 
-	/* want leading, not trailing 0's */
-	return( tag >> (sizeof(ber_int_t) - i - 1) );
+  /* want leading, not trailing 0's */
+  return (tag >> (sizeof(ber_int_t) - i - 1));
 }
 
 /*
  * Note: ber_skip_tag() only uses the ber_end and ber_ptr elements of ber.
  * If that changes, the implementation of ber_peek_tag() will need to
  * be changed.
  */
-ber_tag_t
-LDAP_CALL
-ber_skip_tag( BerElement *ber, ber_len_t *len )
-{
-	ber_tag_t		tag;
-	unsigned char	lc;
-	int				noctets, diff;
-	ber_len_t		netlen;
+ber_tag_t LDAP_CALL ber_skip_tag(BerElement *ber, ber_len_t *len) {
+  ber_tag_t tag;
+  unsigned char lc;
+  int noctets, diff;
+  ber_len_t netlen;
 
-	/*
-	 * Any ber element looks like this: tag length contents.
-	 * Assuming everything's ok, we return the tag byte (we
-	 * can assume a single byte), and return the length in len.
-	 *
-	 * Assumptions:
-	 *	1) definite lengths
-	 *	2) primitive encodings used whenever possible
-	 */
+  /*
+   * Any ber element looks like this: tag length contents.
+   * Assuming everything's ok, we return the tag byte (we
+   * can assume a single byte), and return the length in len.
+   *
+   * Assumptions:
+   *	1) definite lengths
+   *	2) primitive encodings used whenever possible
+   */
 
-	/*
-	 * First, we read the tag.
-	 */
+  /*
+   * First, we read the tag.
+   */
 
-	if ( (tag = ber_get_tag( ber )) == LBER_DEFAULT )
-		return( LBER_DEFAULT );
+  if ((tag = ber_get_tag(ber)) == LBER_DEFAULT) return (LBER_DEFAULT);
 
-	/*
-	 * Next, read the length.  The first byte contains the length of
-	 * the length.  If bit 8 is set, the length is the long form,
-	 * otherwise it's the short form.  We don't allow a length that's
-	 * greater than what we can hold in an unsigned long.
-	 */
+  /*
+   * Next, read the length.  The first byte contains the length of
+   * the length.  If bit 8 is set, the length is the long form,
+   * otherwise it's the short form.  We don't allow a length that's
+   * greater than what we can hold in an unsigned long.
+   */
 
-	*len = netlen = 0;
-	if ( ber_read( ber, (char *) &lc, 1 ) != 1 )
-		return( LBER_DEFAULT );
-	if ( lc & 0x80 ) {
-		noctets = (lc & 0x7f);
-		if ( noctets > sizeof(ber_uint_t) )
-			return( LBER_DEFAULT );
-		diff = sizeof(ber_int_t) - noctets;
-		if ( ber_read( ber, (char *) &netlen + diff, noctets )
-		    != noctets )
-			return( LBER_DEFAULT );
-		*len = LBER_NTOHL( netlen );
-	} else {
-		*len = lc;
-	}
+  *len = netlen = 0;
+  if (ber_read(ber, (char *)&lc, 1) != 1) return (LBER_DEFAULT);
+  if (lc & 0x80) {
+    noctets = (lc & 0x7f);
+    if (noctets > sizeof(ber_uint_t)) return (LBER_DEFAULT);
+    diff = sizeof(ber_int_t) - noctets;
+    if (ber_read(ber, (char *)&netlen + diff, noctets) != noctets)
+      return (LBER_DEFAULT);
+    *len = LBER_NTOHL(netlen);
+  } else {
+    *len = lc;
+  }
 
-	return( tag );
+  return (tag);
 }
 
-
 /*
  * Note: Previously, we passed the "ber" parameter directly to ber_skip_tag(),
  * saving and restoring the ber_ptr element only.  We now take advantage
  * of the fact that the only ber structure elements touched by ber_skip_tag()
  * are ber_end and ber_ptr.  If that changes, this code must change too.
  */
-ber_tag_t
-LDAP_CALL
-ber_peek_tag( BerElement *ber, ber_len_t *len )
-{
-	BerElement	bercopy;
+ber_tag_t LDAP_CALL ber_peek_tag(BerElement *ber, ber_len_t *len) {
+  BerElement bercopy;
 
-	bercopy.ber_end = ber->ber_end;
-	bercopy.ber_ptr = ber->ber_ptr;
-	return( ber_skip_tag( &bercopy, len ));
+  bercopy.ber_end = ber->ber_end;
+  bercopy.ber_ptr = ber->ber_ptr;
+  return (ber_skip_tag(&bercopy, len));
 }
 
-static int
-ber_getnint( BerElement *ber, ber_int_t *num, ber_slen_t len )
-{
-	int				i;
-	ber_int_t		value;
-	unsigned char	buffer[sizeof(ber_int_t)];
-	/*
-	 * The tag and length have already been stripped off.  We should
-	 * be sitting right before len bytes of 2's complement integer,
-	 * ready to be read straight into an int.  We may have to sign
-	 * extend after we read it in.
-	 */
+static int ber_getnint(BerElement *ber, ber_int_t *num, ber_slen_t len) {
+  int i;
+  ber_int_t value;
+  unsigned char buffer[sizeof(ber_int_t)];
+  /*
+   * The tag and length have already been stripped off.  We should
+   * be sitting right before len bytes of 2's complement integer,
+   * ready to be read straight into an int.  We may have to sign
+   * extend after we read it in.
+   */
 
-	if ( len > sizeof(ber_slen_t) )
-		return( -1 );
+  if (len > sizeof(ber_slen_t)) return (-1);
 
-	/* read into the low-order bytes of netnum */
-	if ( ber_read( ber, (char *) buffer, len ) != len )
-		return( -1 );
+  /* read into the low-order bytes of netnum */
+  if (ber_read(ber, (char *)buffer, len) != len) return (-1);
 
-	/* This sets the required sign extension */
-	if ( len != 0) {
-		value = 0x80 & buffer[0] ? (-1) : 0;
-	} else {
-		value = 0;
-	}
-		
-	for ( i = 0; i < len; i++ )
-	  value = (value << 8) | buffer[i];
-	
-	*num = value;
-	
-	return( len );
+  /* This sets the required sign extension */
+  if (len != 0) {
+    value = 0x80 & buffer[0] ? (-1) : 0;
+  } else {
+    value = 0;
+  }
+
+  for (i = 0; i < len; i++) value = (value << 8) | buffer[i];
+
+  *num = value;
+
+  return (len);
 }
 
-ber_tag_t
-LDAP_CALL
-ber_get_int( BerElement *ber, ber_int_t *num )
-{
-	ber_tag_t	tag;
-	ber_len_t	len;
+ber_tag_t LDAP_CALL ber_get_int(BerElement *ber, ber_int_t *num) {
+  ber_tag_t tag;
+  ber_len_t len;
+
+  if ((tag = ber_skip_tag(ber, &len)) == LBER_DEFAULT) return (LBER_DEFAULT);
 
-	if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT )
-		return( LBER_DEFAULT );
+  /*
+   * len is being demoted to a long here --  possible conversion error
+   */
 
-	/*
-     * len is being demoted to a long here --  possible conversion error
-     */
-  
-	if ( ber_getnint( ber, num, (int)len ) != (ber_slen_t)len )
-		return( LBER_DEFAULT );
-	else
-		return( tag );
+  if (ber_getnint(ber, num, (int)len) != (ber_slen_t)len)
+    return (LBER_DEFAULT);
+  else
+    return (tag);
 }
 
-ber_tag_t
-LDAP_CALL
-ber_get_stringb( BerElement *ber, char *buf, ber_len_t *len )
-{
-	ber_len_t	datalen;
-	ber_tag_t	tag;
+ber_tag_t LDAP_CALL ber_get_stringb(BerElement *ber, char *buf,
+                                    ber_len_t *len) {
+  ber_len_t datalen;
+  ber_tag_t tag;
 #ifdef STR_TRANSLATION
-	char		*transbuf;
+  char *transbuf;
 #endif /* STR_TRANSLATION */
 
-	if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT )
-		return( LBER_DEFAULT );
-	if ( datalen > (*len - 1) )
-		return( LBER_DEFAULT );
+  if ((tag = ber_skip_tag(ber, &datalen)) == LBER_DEFAULT)
+    return (LBER_DEFAULT);
+  if (datalen > (*len - 1)) return (LBER_DEFAULT);
 
-	/*
-     * datalen is being demoted to a long here --  possible conversion error
-     */
+  /*
+   * datalen is being demoted to a long here --  possible conversion error
+   */
 
-	if ( ber_read( ber, buf, datalen ) != (ber_slen_t) datalen )
-		return( LBER_DEFAULT );
+  if (ber_read(ber, buf, datalen) != (ber_slen_t)datalen) return (LBER_DEFAULT);
 
-	buf[datalen] = '\0';
+  buf[datalen] = '\0';
 
 #ifdef STR_TRANSLATION
-	if ( datalen > 0 && ( ber->ber_options & LBER_OPT_TRANSLATE_STRINGS )
-	    != 0 && ber->ber_decode_translate_proc != NULL ) {
-		transbuf = buf;
-		++datalen;
-		if ( (*(ber->ber_decode_translate_proc))( &transbuf, &datalen,
-		    0 ) != 0 ) {
-			return( LBER_DEFAULT );
-		}
-		if ( datalen > *len ) {
-			NSLBERI_FREE( transbuf );
-			return( LBER_DEFAULT );
-		}
-		SAFEMEMCPY( buf, transbuf, datalen );
-		NSLBERI_FREE( transbuf );
-		--datalen;
-	}
+  if (datalen > 0 && (ber->ber_options & LBER_OPT_TRANSLATE_STRINGS) != 0 &&
+      ber->ber_decode_translate_proc != NULL) {
+    transbuf = buf;
+    ++datalen;
+    if ((*(ber->ber_decode_translate_proc))(&transbuf, &datalen, 0) != 0) {
+      return (LBER_DEFAULT);
+    }
+    if (datalen > *len) {
+      NSLBERI_FREE(transbuf);
+      return (LBER_DEFAULT);
+    }
+    SAFEMEMCPY(buf, transbuf, datalen);
+    NSLBERI_FREE(transbuf);
+    --datalen;
+  }
 #endif /* STR_TRANSLATION */
 
-	*len = datalen;
-	return( tag );
+  *len = datalen;
+  return (tag);
 }
 
-ber_tag_t
-LDAP_CALL
-ber_get_stringa( BerElement *ber, char **buf )
-{
-	ber_len_t	datalen, ndatalen;
-	ber_tag_t	tag;
+ber_tag_t LDAP_CALL ber_get_stringa(BerElement *ber, char **buf) {
+  ber_len_t datalen, ndatalen;
+  ber_tag_t tag;
 
-	if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT )
-		return( LBER_DEFAULT );
+  if ((tag = ber_skip_tag(ber, &datalen)) == LBER_DEFAULT)
+    return (LBER_DEFAULT);
 
-	if ( ((ndatalen = (size_t)datalen + 1) < (size_t) datalen) ||
-	   ( datalen > (ber->ber_end - ber->ber_ptr) ) ||
-	   ( (*buf = (char *)NSLBERI_MALLOC( (size_t)ndatalen )) == NULL ))
-		return( LBER_DEFAULT );
+  if (((ndatalen = (size_t)datalen + 1) < (size_t)datalen) ||
+      (datalen > (ber->ber_end - ber->ber_ptr)) ||
+      ((*buf = (char *)NSLBERI_MALLOC((size_t)ndatalen)) == NULL))
+    return (LBER_DEFAULT);
 
-    /*
-     * datalen is being demoted to a long here --  possible conversion error
-     */
-	if ( ber_read( ber, *buf, datalen ) != (ber_slen_t) datalen ) {
-		NSLBERI_FREE( *buf );
-		*buf = NULL;
-		return( LBER_DEFAULT );
-	}
+  /*
+   * datalen is being demoted to a long here --  possible conversion error
+   */
+  if (ber_read(ber, *buf, datalen) != (ber_slen_t)datalen) {
+    NSLBERI_FREE(*buf);
+    *buf = NULL;
+    return (LBER_DEFAULT);
+  }
 
-	(*buf)[datalen] = '\0';
+  (*buf)[datalen] = '\0';
 
 #ifdef STR_TRANSLATION
-	if ( datalen > 0 && ( ber->ber_options & LBER_OPT_TRANSLATE_STRINGS )
-	    != 0 && ber->ber_decode_translate_proc != NULL ) {
-		++datalen;
-		if ( (*(ber->ber_decode_translate_proc))( buf, &datalen, 1 )
-		    != 0 ) {
-			NSLBERI_FREE( *buf );
-			*buf = NULL;
-			return( LBER_DEFAULT );
-		}
-	}
+  if (datalen > 0 && (ber->ber_options & LBER_OPT_TRANSLATE_STRINGS) != 0 &&
+      ber->ber_decode_translate_proc != NULL) {
+    ++datalen;
+    if ((*(ber->ber_decode_translate_proc))(buf, &datalen, 1) != 0) {
+      NSLBERI_FREE(*buf);
+      *buf = NULL;
+      return (LBER_DEFAULT);
+    }
+  }
 #endif /* STR_TRANSLATION */
 
-	return( tag );
+  return (tag);
 }
 
-ber_tag_t
-LDAP_CALL
-ber_get_stringal( BerElement *ber, struct berval **bv )
-{
-	ber_len_t	len, nlen;
-	ber_tag_t	tag;
+ber_tag_t LDAP_CALL ber_get_stringal(BerElement *ber, struct berval **bv) {
+  ber_len_t len, nlen;
+  ber_tag_t tag;
+
+  if ((*bv = (struct berval *)NSLBERI_MALLOC(sizeof(struct berval))) == NULL) {
+    return (LBER_DEFAULT);
+  }
 
-	if ( (*bv = (struct berval *)NSLBERI_MALLOC( sizeof(struct berval) ))
-	    == NULL ) {
-		return( LBER_DEFAULT );
-	}
-	
-	(*bv)->bv_val = NULL;
-	(*bv)->bv_len = 0;
+  (*bv)->bv_val = NULL;
+  (*bv)->bv_len = 0;
 
-	if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT ) {
-		NSLBERI_FREE( *bv );
-		*bv = NULL;
-		return( LBER_DEFAULT );
-	}
+  if ((tag = ber_skip_tag(ber, &len)) == LBER_DEFAULT) {
+    NSLBERI_FREE(*bv);
+    *bv = NULL;
+    return (LBER_DEFAULT);
+  }
 
-	if ( ((nlen = (size_t) len + 1) < (size_t)len) ||
-	     ( len > (ber->ber_end - ber->ber_ptr) ) ||
-	     (((*bv)->bv_val = (char *)NSLBERI_MALLOC( (size_t)nlen ))
-	    == NULL )) {
-		NSLBERI_FREE( *bv );
-		*bv = NULL;
-		return( LBER_DEFAULT );
-	}
+  if (((nlen = (size_t)len + 1) < (size_t)len) ||
+      (len > (ber->ber_end - ber->ber_ptr)) ||
+      (((*bv)->bv_val = (char *)NSLBERI_MALLOC((size_t)nlen)) == NULL)) {
+    NSLBERI_FREE(*bv);
+    *bv = NULL;
+    return (LBER_DEFAULT);
+  }
 
-    /*
-     * len is being demoted to a long here --  possible conversion error
-     */
-	if ( ber_read( ber, (*bv)->bv_val, len ) != (ber_slen_t) len ) {
-		NSLBERI_FREE( (*bv)->bv_val );
-		(*bv)->bv_val = NULL;
-		NSLBERI_FREE( *bv );
-		*bv = NULL;
-		return( LBER_DEFAULT );
-	}
+  /*
+   * len is being demoted to a long here --  possible conversion error
+   */
+  if (ber_read(ber, (*bv)->bv_val, len) != (ber_slen_t)len) {
+    NSLBERI_FREE((*bv)->bv_val);
+    (*bv)->bv_val = NULL;
+    NSLBERI_FREE(*bv);
+    *bv = NULL;
+    return (LBER_DEFAULT);
+  }
 
-	((*bv)->bv_val)[len] = '\0';
-	(*bv)->bv_len = len;
+  ((*bv)->bv_val)[len] = '\0';
+  (*bv)->bv_len = len;
 
 #ifdef STR_TRANSLATION
-	if ( len > 0 && ( ber->ber_options & LBER_OPT_TRANSLATE_STRINGS ) != 0
-	    && ber->ber_decode_translate_proc != NULL ) {
-		++len;
-		if ( (*(ber->ber_decode_translate_proc))( &((*bv)->bv_val),
-		    &len, 1 ) != 0 ) {
-			NSLBERI_FREE( (*bv)->bv_val );
-			(*bv)->bv_val = NULL;
-			NSLBERI_FREE( *bv );
-			*bv = NULL;
-			return( LBER_DEFAULT );
-		}
-		(*bv)->bv_len = len - 1;
-	}
+  if (len > 0 && (ber->ber_options & LBER_OPT_TRANSLATE_STRINGS) != 0 &&
+      ber->ber_decode_translate_proc != NULL) {
+    ++len;
+    if ((*(ber->ber_decode_translate_proc))(&((*bv)->bv_val), &len, 1) != 0) {
+      NSLBERI_FREE((*bv)->bv_val);
+      (*bv)->bv_val = NULL;
+      NSLBERI_FREE(*bv);
+      *bv = NULL;
+      return (LBER_DEFAULT);
+    }
+    (*bv)->bv_len = len - 1;
+  }
 #endif /* STR_TRANSLATION */
 
-	return( tag );
+  return (tag);
 }
 
-ber_tag_t
-LDAP_CALL
-ber_get_bitstringa( BerElement *ber, char **buf, ber_len_t *blen )
-{
-	ber_len_t		datalen;
-	ber_tag_t		tag;
-	unsigned char	unusedbits;
+ber_tag_t LDAP_CALL ber_get_bitstringa(BerElement *ber, char **buf,
+                                       ber_len_t *blen) {
+  ber_len_t datalen;
+  ber_tag_t tag;
+  unsigned char unusedbits;
 
-	if ( (tag = ber_skip_tag( ber, &datalen )) == LBER_DEFAULT )
-		return( LBER_DEFAULT );
-	--datalen;
+  if ((tag = ber_skip_tag(ber, &datalen)) == LBER_DEFAULT)
+    return (LBER_DEFAULT);
+  --datalen;
 
-	if ( (datalen > (ber->ber_end - ber->ber_ptr)) ||
-	   ( (*buf = (char *)NSLBERI_MALLOC((size_t)datalen )) == NULL ) )
-		return( LBER_DEFAULT );
+  if ((datalen > (ber->ber_end - ber->ber_ptr)) ||
+      ((*buf = (char *)NSLBERI_MALLOC((size_t)datalen)) == NULL))
+    return (LBER_DEFAULT);
 
-	if ( ber_read( ber, (char *)&unusedbits, 1 ) != 1 ) {
-		NSLBERI_FREE( *buf );
-		*buf = NULL;
-		return( LBER_DEFAULT );
-	}
+  if (ber_read(ber, (char *)&unusedbits, 1) != 1) {
+    NSLBERI_FREE(*buf);
+    *buf = NULL;
+    return (LBER_DEFAULT);
+  }
 
-	/*
-     * datalen is being demoted to a long here --  possible conversion error
-     */
-	if ( ber_read( ber, *buf, datalen ) != (ber_slen_t) datalen ) {
-		NSLBERI_FREE( *buf );
-		*buf = NULL;
-		return( LBER_DEFAULT );
-	}
+  /*
+   * datalen is being demoted to a long here --  possible conversion error
+   */
+  if (ber_read(ber, *buf, datalen) != (ber_slen_t)datalen) {
+    NSLBERI_FREE(*buf);
+    *buf = NULL;
+    return (LBER_DEFAULT);
+  }
 
-	*blen = datalen * 8 - unusedbits;
-	return( tag );
+  *blen = datalen * 8 - unusedbits;
+  return (tag);
 }
 
-ber_tag_t
-LDAP_CALL
-ber_get_null( BerElement *ber )
-{
-	ber_len_t	len;
-	ber_tag_t	tag;
+ber_tag_t LDAP_CALL ber_get_null(BerElement *ber) {
+  ber_len_t len;
+  ber_tag_t tag;
 
-	if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT )
-		return( LBER_DEFAULT );
+  if ((tag = ber_skip_tag(ber, &len)) == LBER_DEFAULT) return (LBER_DEFAULT);
 
-	if ( len != 0 )
-		return( LBER_DEFAULT );
+  if (len != 0) return (LBER_DEFAULT);
 
-	return( tag );
+  return (tag);
 }
 
-ber_tag_t
-LDAP_CALL
-ber_get_boolean( BerElement *ber, ber_int_t *boolval )
-{
-	int	rc;
+ber_tag_t LDAP_CALL ber_get_boolean(BerElement *ber, ber_int_t *boolval) {
+  int rc;
 
-	rc = ber_get_int( ber, boolval );
+  rc = ber_get_int(ber, boolval);
 
-	return( rc );
+  return (rc);
 }
 
-ber_tag_t
-LDAP_CALL
-ber_first_element( BerElement *ber, ber_len_t *len, char **last )
-{
-	/* skip the sequence header, use the len to mark where to stop */
-	if ( ber_skip_tag( ber, len ) == LBER_DEFAULT ) {
-		return( LBER_ERROR );
-	}
+ber_tag_t LDAP_CALL ber_first_element(BerElement *ber, ber_len_t *len,
+                                      char **last) {
+  /* skip the sequence header, use the len to mark where to stop */
+  if (ber_skip_tag(ber, len) == LBER_DEFAULT) {
+    return (LBER_ERROR);
+  }
 
-	*last = ber->ber_ptr + *len;
+  *last = ber->ber_ptr + *len;
 
-	if ( *last == ber->ber_ptr ) {
-		return( LBER_END_OF_SEQORSET );
-	}
+  if (*last == ber->ber_ptr) {
+    return (LBER_END_OF_SEQORSET);
+  }
 
-	return( ber_peek_tag( ber, len ) );
+  return (ber_peek_tag(ber, len));
 }
 
-ber_tag_t
-LDAP_CALL
-ber_next_element( BerElement *ber, ber_len_t *len, char *last )
-{
-	if ( ber->ber_ptr == last ) {
-		return( LBER_END_OF_SEQORSET );
-	}
+ber_tag_t LDAP_CALL ber_next_element(BerElement *ber, ber_len_t *len,
+                                     char *last) {
+  if (ber->ber_ptr == last) {
+    return (LBER_END_OF_SEQORSET);
+  }
 
-	return( ber_peek_tag( ber, len ) );
+  return (ber_peek_tag(ber, len));
 }
 
 /* VARARGS */
-ber_tag_t
-LDAP_C
-ber_scanf( BerElement *ber, const char *fmt, ... )
-{
-	va_list			ap;
-	char			*last, *p;
-	char			*s, **ss, ***sss;
-	struct berval 	***bv, **bvp, *bval;
-	int				*i, j;
-	ber_int_t		*l, rc, tag;
-	ber_tag_t		*t;
-	ber_len_t		len;
-	size_t			array_size;
-	
-	va_start( ap, fmt );
+ber_tag_t LDAP_C ber_scanf(BerElement *ber, const char *fmt, ...) {
+  va_list ap;
+  char *last, *p;
+  char *s, **ss, ***sss;
+  struct berval ***bv, **bvp, *bval;
+  int *i, j;
+  ber_int_t *l, rc, tag;
+  ber_tag_t *t;
+  ber_len_t len;
+  size_t array_size;
+
+  va_start(ap, fmt);
 
 #ifdef LDAP_DEBUG
-	if ( lber_debug & 64 ) {
-		char msg[80];
-		sprintf( msg, "ber_scanf fmt (%s) ber:\n", fmt );
-		ber_err_print( msg );
-		ber_dump( ber, 1 );
-	}
+  if (lber_debug & 64) {
+    char msg[80];
+    sprintf(msg, "ber_scanf fmt (%s) ber:\n", fmt);
+    ber_err_print(msg);
+    ber_dump(ber, 1);
+  }
 #endif
-	for ( rc = 0, p = (char *) fmt; *p && rc != LBER_DEFAULT; p++ ) {
-		switch ( *p ) {
-		case 'a':	/* octet string - allocate storage as needed */
-			ss = va_arg( ap, char ** );
-			rc = ber_get_stringa( ber, ss );
-			break;
+  for (rc = 0, p = (char *)fmt; *p && rc != LBER_DEFAULT; p++) {
+    switch (*p) {
+      case 'a': /* octet string - allocate storage as needed */
+        ss = va_arg(ap, char **);
+        rc = ber_get_stringa(ber, ss);
+        break;
 
-		case 'b':	/* boolean */
-			i = va_arg( ap, int * );
-			rc = ber_get_boolean( ber, i );
-			break;
+      case 'b': /* boolean */
+        i = va_arg(ap, int *);
+        rc = ber_get_boolean(ber, i);
+        break;
 
-		case 'e':	/* enumerated */
-		case 'i':	/* int */
-			l = va_arg( ap, ber_slen_t * );
-			rc = ber_get_int( ber, l );
-			break;
+      case 'e': /* enumerated */
+      case 'i': /* int */
+        l = va_arg(ap, ber_slen_t *);
+        rc = ber_get_int(ber, l);
+        break;
 
-		case 'l':	/* length of next item */
-			l = va_arg( ap, ber_slen_t * );
-			rc = ber_peek_tag( ber, (ber_len_t *)l );
-			break;
+      case 'l': /* length of next item */
+        l = va_arg(ap, ber_slen_t *);
+        rc = ber_peek_tag(ber, (ber_len_t *)l);
+        break;
 
-		case 'n':	/* null */
-			rc = ber_get_null( ber );
-			break;
+      case 'n': /* null */
+        rc = ber_get_null(ber);
+        break;
 
-		case 's':	/* octet string - in a buffer */
-			s = va_arg( ap, char * );
-			l = va_arg( ap, ber_slen_t * );
-			rc = ber_get_stringb( ber, s, (ber_len_t *)l );
-			break;
+      case 's': /* octet string - in a buffer */
+        s = va_arg(ap, char *);
+        l = va_arg(ap, ber_slen_t *);
+        rc = ber_get_stringb(ber, s, (ber_len_t *)l);
+        break;
 
-		case 'o':	/* octet string in a supplied berval */
-			bval = va_arg( ap, struct berval * );
-			ber_peek_tag( ber, &bval->bv_len );
-			rc = ber_get_stringa( ber, &bval->bv_val );
-			break;
+      case 'o': /* octet string in a supplied berval */
+        bval = va_arg(ap, struct berval *);
+        ber_peek_tag(ber, &bval->bv_len);
+        rc = ber_get_stringa(ber, &bval->bv_val);
+        break;
 
-		case 'O':	/* octet string - allocate & include length */
-			bvp = va_arg( ap, struct berval ** );
-			rc = ber_get_stringal( ber, bvp );
-			break;
+      case 'O': /* octet string - allocate & include length */
+        bvp = va_arg(ap, struct berval **);
+        rc = ber_get_stringal(ber, bvp);
+        break;
 
-		case 'B':	/* bit string - allocate storage as needed */
-			ss = va_arg( ap, char ** );
-			l = va_arg( ap, ber_slen_t * ); /* for length, in bits */
-			rc = ber_get_bitstringa( ber, ss, (ber_len_t *)l );
-			break;
+      case 'B': /* bit string - allocate storage as needed */
+        ss = va_arg(ap, char **);
+        l = va_arg(ap, ber_slen_t *); /* for length, in bits */
+        rc = ber_get_bitstringa(ber, ss, (ber_len_t *)l);
+        break;
 
-		case 't':	/* tag of next item */
-			t = va_arg( ap, ber_tag_t * );
-			*t = rc = ber_peek_tag( ber, &len );
-			break;
+      case 't': /* tag of next item */
+        t = va_arg(ap, ber_tag_t *);
+        *t = rc = ber_peek_tag(ber, &len);
+        break;
 
-		case 'T':	/* skip tag of next item */
-			t = va_arg( ap, ber_tag_t * );
-			*t = rc = ber_skip_tag( ber, &len );
-			break;
+      case 'T': /* skip tag of next item */
+        t = va_arg(ap, ber_tag_t *);
+        *t = rc = ber_skip_tag(ber, &len);
+        break;
 
-		case 'v':	/* sequence of strings */
-			sss = va_arg( ap, char *** );
-			*sss = NULL;
-			j = 0;
-			array_size = 0;
-			for ( tag = ber_first_element( ber, &len, &last );
-			    tag != LBER_DEFAULT && tag != LBER_END_OF_SEQORSET
-			    && rc != LBER_DEFAULT;
-			    tag = ber_next_element( ber, &len, last ) ) {
-				if ( *sss == NULL ) {
-				    /* Make room for at least 15 strings */
-				    *sss = (char **)NSLBERI_MALLOC(16 * sizeof(char *) );
-					if (!*sss) {
-						rc = LBER_DEFAULT;
-						break; /* out of memory - cannot continue */
-                    }
-				    array_size = 16;
-				} else {
-				    char **save_sss = *sss;
-				    if ( (size_t)(j+2) > array_size) {
-						/* We'v overflowed our buffer */
-						*sss = (char **)NSLBERI_REALLOC( *sss, (array_size * 2) * sizeof(char *) );
-						array_size = array_size * 2;
-				    }
-					if (!*sss) {
-						rc = LBER_DEFAULT;
-						ber_svecfree(save_sss);
-						break; /* out of memory - cannot continue */
-					}
-				}
-				(*sss)[j] = NULL;
-				rc = ber_get_stringa( ber, &((*sss)[j]) );
-				j++;
-			}
-			if ( rc != LBER_DEFAULT &&
-			    tag != LBER_END_OF_SEQORSET ) {
-				rc = LBER_DEFAULT;
-			}
-			if ( *sss && (j > 0) ) {
-				(*sss)[j] = NULL;
-			}
-			break;
+      case 'v': /* sequence of strings */
+        sss = va_arg(ap, char ***);
+        *sss = NULL;
+        j = 0;
+        array_size = 0;
+        for (tag = ber_first_element(ber, &len, &last);
+             tag != LBER_DEFAULT && tag != LBER_END_OF_SEQORSET &&
+             rc != LBER_DEFAULT;
+             tag = ber_next_element(ber, &len, last)) {
+          if (*sss == NULL) {
+            /* Make room for at least 15 strings */
+            *sss = (char **)NSLBERI_MALLOC(16 * sizeof(char *));
+            if (!*sss) {
+              rc = LBER_DEFAULT;
+              break; /* out of memory - cannot continue */
+            }
+            array_size = 16;
+          } else {
+            char **save_sss = *sss;
+            if ((size_t)(j + 2) > array_size) {
+              /* We'v overflowed our buffer */
+              *sss = (char **)NSLBERI_REALLOC(
+                  *sss, (array_size * 2) * sizeof(char *));
+              array_size = array_size * 2;
+            }
+            if (!*sss) {
+              rc = LBER_DEFAULT;
+              ber_svecfree(save_sss);
+              break; /* out of memory - cannot continue */
+            }
+          }
+          (*sss)[j] = NULL;
+          rc = ber_get_stringa(ber, &((*sss)[j]));
+          j++;
+        }
+        if (rc != LBER_DEFAULT && tag != LBER_END_OF_SEQORSET) {
+          rc = LBER_DEFAULT;
+        }
+        if (*sss && (j > 0)) {
+          (*sss)[j] = NULL;
+        }
+        break;
 
-		case 'V':	/* sequence of strings + lengths */
-			bv = va_arg( ap, struct berval *** );
-			*bv = NULL;
-			j = 0;
-			for ( tag = ber_first_element( ber, &len, &last );
-			    tag != LBER_DEFAULT && tag != LBER_END_OF_SEQORSET
-			    && rc != LBER_DEFAULT;
-			    tag = ber_next_element( ber, &len, last ) ) {
-				if ( *bv == NULL ) {
-					*bv = (struct berval **)NSLBERI_MALLOC(
-					    2 * sizeof(struct berval *) );
-					if (!*bv) {
-						rc = LBER_DEFAULT;
-						break; /* out of memory - cannot continue */
-					}
-				} else {
-					struct berval **save_bv = *bv;
-					*bv = (struct berval **)NSLBERI_REALLOC(
-					    *bv,
-					    (j + 2) * sizeof(struct berval *) );
-					if (!*bv) {
-						rc = LBER_DEFAULT;
-						ber_bvecfree(save_bv);
-						break; /* out of memory - cannot continue */
-					}
-				}
-				rc = ber_get_stringal( ber, &((*bv)[j]) );
-				j++;
-			}
-			if ( rc != LBER_DEFAULT &&
-			    tag != LBER_END_OF_SEQORSET ) {
-				rc = LBER_DEFAULT;
-			}
-			if ( *bv && (j > 0) ) {
-				(*bv)[j] = NULL;
-			}
-			break;
+      case 'V': /* sequence of strings + lengths */
+        bv = va_arg(ap, struct berval ***);
+        *bv = NULL;
+        j = 0;
+        for (tag = ber_first_element(ber, &len, &last);
+             tag != LBER_DEFAULT && tag != LBER_END_OF_SEQORSET &&
+             rc != LBER_DEFAULT;
+             tag = ber_next_element(ber, &len, last)) {
+          if (*bv == NULL) {
+            *bv = (struct berval **)NSLBERI_MALLOC(2 * sizeof(struct berval *));
+            if (!*bv) {
+              rc = LBER_DEFAULT;
+              break; /* out of memory - cannot continue */
+            }
+          } else {
+            struct berval **save_bv = *bv;
+            *bv = (struct berval **)NSLBERI_REALLOC(
+                *bv, (j + 2) * sizeof(struct berval *));
+            if (!*bv) {
+              rc = LBER_DEFAULT;
+              ber_bvecfree(save_bv);
+              break; /* out of memory - cannot continue */
+            }
+          }
+          rc = ber_get_stringal(ber, &((*bv)[j]));
+          j++;
+        }
+        if (rc != LBER_DEFAULT && tag != LBER_END_OF_SEQORSET) {
+          rc = LBER_DEFAULT;
+        }
+        if (*bv && (j > 0)) {
+          (*bv)[j] = NULL;
+        }
+        break;
 
-		case 'x':	/* skip the next element - whatever it is */
-			if ( (rc = ber_skip_tag( ber, &len )) == LBER_DEFAULT )
-				break;
-			ber->ber_ptr += len;
-			break;
+      case 'x': /* skip the next element - whatever it is */
+        if ((rc = ber_skip_tag(ber, &len)) == LBER_DEFAULT) break;
+        ber->ber_ptr += len;
+        break;
 
-		case '{':	/* begin sequence */
-		case '[':	/* begin set */
-			if ( *(p + 1) != 'v' && *(p + 1) != 'V' )
-				rc = ber_skip_tag( ber, &len );
-			break;
+      case '{': /* begin sequence */
+      case '[': /* begin set */
+        if (*(p + 1) != 'v' && *(p + 1) != 'V') rc = ber_skip_tag(ber, &len);
+        break;
 
-		case '}':	/* end sequence */
-		case ']':	/* end set */
-			break;
+      case '}': /* end sequence */
+      case ']': /* end set */
+        break;
 
-		default:
-			{
-				char msg[80];
-				sprintf( msg, "unknown fmt %c\n", *p );
-				ber_err_print( msg );
-			}
-			rc = LBER_DEFAULT;
-			break;
-		}
-	}
+      default: {
+        char msg[80];
+        sprintf(msg, "unknown fmt %c\n", *p);
+        ber_err_print(msg);
+      }
+        rc = LBER_DEFAULT;
+        break;
+    }
+  }
+
+  va_end(ap);
 
-	va_end( ap );
+  if (rc == LBER_DEFAULT) {
+    va_start(ap, fmt);
+    for (p--; fmt < p && *fmt; fmt++) {
+      switch (*fmt) {
+        case 'a': /* octet string - allocate storage as needed */
+          ss = va_arg(ap, char **);
+          NSLBERI_FREE(*ss);
+          *ss = NULL;
+          break;
 
-	if (rc == LBER_DEFAULT) {
-	  va_start( ap, fmt );
-	  for ( p--; fmt < p && *fmt; fmt++ ) {
-		switch ( *fmt ) {
-		case 'a':	/* octet string - allocate storage as needed */
-			ss = va_arg( ap, char ** );
-			NSLBERI_FREE(*ss);
-			*ss = NULL;
-			break;
+        case 'b': /* boolean */
+          i = va_arg(ap, int *);
+          break;
 
-		case 'b':	/* boolean */
-			i = va_arg( ap, int * );
-			break;
+        case 'e': /* enumerated */
+        case 'i': /* int */
+          l = va_arg(ap, ber_slen_t *);
+          break;
 
-		case 'e':	/* enumerated */
-		case 'i':	/* int */
-			l = va_arg( ap, ber_slen_t * );
-			break;
+        case 'l': /* length of next item */
+          l = va_arg(ap, ber_slen_t *);
+          break;
 
-		case 'l':	/* length of next item */
-			l = va_arg( ap, ber_slen_t * );
-			break;
+        case 'n': /* null */
+          break;
 
-		case 'n':	/* null */
-			break;
+        case 's': /* octet string - in a buffer */
+          s = va_arg(ap, char *);
+          l = va_arg(ap, ber_slen_t *);
+          break;
 
-		case 's':	/* octet string - in a buffer */
-			s = va_arg( ap, char * );
-			l = va_arg( ap, ber_slen_t * );
-			break;
-
-		case 'o':	/* octet string in a supplied berval */
-			bval = va_arg( ap, struct berval * );
-			if (bval->bv_val) NSLBERI_FREE(bval->bv_val);
-			memset(bval, 0, sizeof(struct berval));
-			break;
+        case 'o': /* octet string in a supplied berval */
+          bval = va_arg(ap, struct berval *);
+          if (bval->bv_val) NSLBERI_FREE(bval->bv_val);
+          memset(bval, 0, sizeof(struct berval));
+          break;
 
-		case 'O':	/* octet string - allocate & include length */
-			bvp = va_arg( ap, struct berval ** );
-			ber_bvfree(*bvp);
-			bvp = NULL;
-			break;
+        case 'O': /* octet string - allocate & include length */
+          bvp = va_arg(ap, struct berval **);
+          ber_bvfree(*bvp);
+          bvp = NULL;
+          break;
 
-		case 'B':	/* bit string - allocate storage as needed */
-			ss = va_arg( ap, char ** );
-			l = va_arg( ap, ber_slen_t * ); /* for length, in bits */
-			if (*ss) NSLBERI_FREE(*ss);
-			*ss = NULL;
-			break;
+        case 'B': /* bit string - allocate storage as needed */
+          ss = va_arg(ap, char **);
+          l = va_arg(ap, ber_slen_t *); /* for length, in bits */
+          if (*ss) NSLBERI_FREE(*ss);
+          *ss = NULL;
+          break;
 
-		case 't':	/* tag of next item */
-			t = va_arg( ap, ber_tag_t * );
-			break;
+        case 't': /* tag of next item */
+          t = va_arg(ap, ber_tag_t *);
+          break;
 
-		case 'T':	/* skip tag of next item */
-			t = va_arg( ap, ber_tag_t * );
-			break;
+        case 'T': /* skip tag of next item */
+          t = va_arg(ap, ber_tag_t *);
+          break;
 
-		case 'v':	/* sequence of strings */
-			sss = va_arg( ap, char *** );
-			ber_svecfree(*sss);
-			*sss = NULL;
-			break;
+        case 'v': /* sequence of strings */
+          sss = va_arg(ap, char ***);
+          ber_svecfree(*sss);
+          *sss = NULL;
+          break;
 
-		case 'V':	/* sequence of strings + lengths */
-			bv = va_arg( ap, struct berval *** );
-			ber_bvecfree(*bv);
-			*bv = NULL;
-			break;
+        case 'V': /* sequence of strings + lengths */
+          bv = va_arg(ap, struct berval ***);
+          ber_bvecfree(*bv);
+          *bv = NULL;
+          break;
 
-		case 'x':	/* skip the next element - whatever it is */
-			break;
+        case 'x': /* skip the next element - whatever it is */
+          break;
 
-		case '{':	/* begin sequence */
-		case '[':	/* begin set */
-			break;
+        case '{': /* begin sequence */
+        case '[': /* begin set */
+          break;
 
-		case '}':	/* end sequence */
-		case ']':	/* end set */
-			break;
+        case '}': /* end sequence */
+        case ']': /* end set */
+          break;
 
-		default:
-			break;
-		}
-	  } /* for */
-	  va_end( ap );
-	} /* if */
+        default:
+          break;
+      }
+    } /* for */
+    va_end(ap);
+  } /* if */
 
-	return( rc );
+  return (rc);
 }
 
-void
-LDAP_CALL
-ber_bvfree( struct berval *bv )
-{
-	if ( bv != NULL ) {
-		if ( bv->bv_val != NULL ) {
-			NSLBERI_FREE( bv->bv_val );
-		}
-		NSLBERI_FREE( (char *) bv );
-	}
+void LDAP_CALL ber_bvfree(struct berval *bv) {
+  if (bv != NULL) {
+    if (bv->bv_val != NULL) {
+      NSLBERI_FREE(bv->bv_val);
+    }
+    NSLBERI_FREE((char *)bv);
+  }
 }
 
-void
-LDAP_CALL
-ber_bvecfree( struct berval **bv )
-{
-	int	i;
+void LDAP_CALL ber_bvecfree(struct berval **bv) {
+  int i;
 
-	if ( bv != NULL ) {
-		for ( i = 0; bv[i] != NULL; i++ ) {
-			ber_bvfree( bv[i] );
-		}
-		NSLBERI_FREE( (char *) bv );
-	}
+  if (bv != NULL) {
+    for (i = 0; bv[i] != NULL; i++) {
+      ber_bvfree(bv[i]);
+    }
+    NSLBERI_FREE((char *)bv);
+  }
 }
 
-struct berval *
-LDAP_CALL
-ber_bvdup( const struct berval *bv )
-{
-	struct berval	*new;
+struct berval *LDAP_CALL ber_bvdup(const struct berval *bv) {
+  struct berval *new;
 
-	if ( (new = (struct berval *)NSLBERI_MALLOC( sizeof(struct berval) ))
-	    == NULL ) {
-		return( NULL );
-	}
-	if ( bv->bv_val == NULL ) {
-	    new->bv_val = NULL;
-	    new->bv_len = 0;
-	} else {
-	    if ( (new->bv_val = (char *)NSLBERI_MALLOC( bv->bv_len + 1 ))
-		== NULL ) {
-			NSLBERI_FREE( new );
-			new = NULL;
-		    return( NULL );
-	    }
-	    SAFEMEMCPY( new->bv_val, bv->bv_val, (size_t) bv->bv_len );
-	    new->bv_val[bv->bv_len] = '\0';
-	    new->bv_len = bv->bv_len;
-	}
+  if ((new = (struct berval *)NSLBERI_MALLOC(sizeof(struct berval))) == NULL) {
+    return (NULL);
+  }
+  if (bv->bv_val == NULL) {
+    new->bv_val = NULL;
+    new->bv_len = 0;
+  } else {
+    if ((new->bv_val = (char *)NSLBERI_MALLOC(bv->bv_len + 1)) == NULL) {
+      NSLBERI_FREE(new);
+      new = NULL;
+      return (NULL);
+    }
+    SAFEMEMCPY(new->bv_val, bv->bv_val, (size_t)bv->bv_len);
+    new->bv_val[bv->bv_len] = '\0';
+    new->bv_len = bv->bv_len;
+  }
 
-	return( new );
+  return (new);
 }
 
-void
-LDAP_CALL
-ber_svecfree( char **vals )
-{
-        int     i;
+void LDAP_CALL ber_svecfree(char **vals) {
+  int i;
 
-        if ( vals == NULL )
-                return;
-        for ( i = 0; vals[i] != NULL; i++ )
-                NSLBERI_FREE( vals[i] );
-        NSLBERI_FREE( (char *) vals );
+  if (vals == NULL) return;
+  for (i = 0; vals[i] != NULL; i++) NSLBERI_FREE(vals[i]);
+  NSLBERI_FREE((char *)vals);
 }
 
 #ifdef STR_TRANSLATION
-void
-LDAP_CALL
-ber_set_string_translators(
-    BerElement		*ber,
-    BERTranslateProc	encode_proc,
-    BERTranslateProc	decode_proc
-)
-{
-    ber->ber_encode_translate_proc = encode_proc;
-    ber->ber_decode_translate_proc = decode_proc;
+void LDAP_CALL ber_set_string_translators(BerElement *ber,
+                                          BERTranslateProc encode_proc,
+                                          BERTranslateProc decode_proc) {
+  ber->ber_encode_translate_proc = encode_proc;
+  ber->ber_decode_translate_proc = decode_proc;
 }
 #endif /* STR_TRANSLATION */
--- a/ldap/c-sdk/libraries/liblber/dtest.c
+++ b/ldap/c-sdk/libraries/liblber/dtest.c
@@ -1,43 +1,43 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- * 
- * The contents of this file are subject to the Mozilla Public License Version 
- * 1.1 (the "License"); you may not use this file except in compliance with 
- * the License. You may obtain a copy of the License at 
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
- * 
+ *
  * The Original Code is Mozilla Communicator client code, released
  * March 31, 1998.
- * 
+ *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998-1999
  * the Initial Developer. All Rights Reserved.
- * 
+ *
  * Contributor(s):
- * 
+ *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
- * 
+ *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * Copyright (c) 1990 Regents of the University of Michigan.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * provided that this notice is preserved and that due credit is given
@@ -46,68 +46,59 @@
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  */
 /* dtest.c - lber decoding test program */
 
 #include <stdio.h>
 #include <string.h>
 #ifdef MACOS
-#include <stdlib.h>
-#include <console.h>
+#  include <stdlib.h>
+#  include <console.h>
 #else /* MACOS */
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* _WIN32 */
-#endif /* MACOS */
+#  ifdef _WIN32
+#    include <windows.h>
+#  else
+#    include <sys/types.h>
+#    include <sys/socket.h>
+#  endif /* _WIN32 */
+#endif   /* MACOS */
 #include "lber.h"
 
-int
-SSL_Recv( int s, char *b, unsigned l, int dummy )
-{
-	return( read( s, b, l ) );
-}
+int SSL_Recv(int s, char *b, unsigned l, int dummy) { return (read(s, b, l)); }
 
-SSL_Send( int s, char *b, unsigned l, int dummy )
-{
-	return( write( s, b, l ) );
-}
+SSL_Send(int s, char *b, unsigned l, int dummy) { return (write(s, b, l)); }
 
-static void usage( char *name )
-{
-	fprintf( stderr, "usage: %s < berfile\n", name );
+static void usage(char *name) {
+  fprintf(stderr, "usage: %s < berfile\n", name);
 }
 
-main( int argc, char **argv )
-{
-	long		i, fd;
-	ber_len_t	len;
-	ber_tag_t	tag;
-	BerElement	*ber;
-	Sockbuf		*sb;
-	extern int	lber_debug;
+main(int argc, char **argv) {
+  long i, fd;
+  ber_len_t len;
+  ber_tag_t tag;
+  BerElement *ber;
+  Sockbuf *sb;
+  extern int lber_debug;
 
-	lber_debug = 255;
-	if ( argc > 1 ) {
-		usage( argv[0] );
-		exit( 1 );
-	}
+  lber_debug = 255;
+  if (argc > 1) {
+    usage(argv[0]);
+    exit(1);
+  }
 
-	sb = ber_sockbuf_alloc();
-	fd = 0;
-	ber_sockbuf_set_option( sb, LBER_SOCKBUF_OPT_DESC, &fd );
+  sb = ber_sockbuf_alloc();
+  fd = 0;
+  ber_sockbuf_set_option(sb, LBER_SOCKBUF_OPT_DESC, &fd);
 
-	if ( (ber = der_alloc()) == NULL ) {
-		perror( "ber_alloc" );
-		exit( 1 );
-	}
+  if ((ber = der_alloc()) == NULL) {
+    perror("ber_alloc");
+    exit(1);
+  }
 
-	if ( (tag = ber_get_next( sb, &len, ber )) == LBER_ERROR ) {
-		perror( "ber_get_next" );
-		exit( 1 );
-	}
-	printf( "message has tag 0x%x and length %ld\n", tag, len );
+  if ((tag = ber_get_next(sb, &len, ber)) == LBER_ERROR) {
+    perror("ber_get_next");
+    exit(1);
+  }
+  printf("message has tag 0x%x and length %ld\n", tag, len);
 
-	return( 0 );
+  return (0);
 }
--- a/ldap/c-sdk/libraries/liblber/encode.c
+++ b/ldap/c-sdk/libraries/liblber/encode.c
@@ -1,43 +1,43 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- * 
- * The contents of this file are subject to the Mozilla Public License Version 
- * 1.1 (the "License"); you may not use this file except in compliance with 
- * the License. You may obtain a copy of the License at 
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
- * 
+ *
  * The Original Code is Mozilla Communicator client code, released
  * March 31, 1998.
- * 
+ *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998-1999
  * the Initial Developer. All Rights Reserved.
- * 
+ *
  * Contributor(s):
- * 
+ *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
- * 
+ *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * Copyright (c) 1990 Regents of the University of Michigan.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * provided that this notice is preserved and that due credit is given
@@ -46,654 +46,552 @@
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  */
 
 /* encode.c - ber output encoding routines */
 
 #include "lber-int.h"
 
-static int
-ber_calc_taglen( ber_tag_t tag )
-{
-	int			i;
-	ber_int_t	mask;
+static int ber_calc_taglen(ber_tag_t tag) {
+  int i;
+  ber_int_t mask;
 
-	/* find the first non-all-zero byte in the tag */
-	for ( i = sizeof(ber_int_t) - 1; i > 0; i-- ) {
-		mask = (0xff << (i * 8));
-		/* not all zero */
-		if ( tag & mask )
-			break;
-	}
+  /* find the first non-all-zero byte in the tag */
+  for (i = sizeof(ber_int_t) - 1; i > 0; i--) {
+    mask = (0xff << (i * 8));
+    /* not all zero */
+    if (tag & mask) break;
+  }
 
-	return( i + 1 );
+  return (i + 1);
 }
 
-static int
-ber_put_tag( BerElement	*ber, ber_tag_t tag, int nosos )
-{
-	int			taglen;
-	ber_tag_t	ntag;
+static int ber_put_tag(BerElement *ber, ber_tag_t tag, int nosos) {
+  int taglen;
+  ber_tag_t ntag;
 
-	taglen = ber_calc_taglen( tag );
+  taglen = ber_calc_taglen(tag);
 
-	ntag = LBER_HTONL( tag );
+  ntag = LBER_HTONL(tag);
 
-	return( ber_write( ber, ((char *) &ntag) + sizeof(ber_int_t) - taglen,
-	    taglen, nosos ) );
+  return (ber_write(ber, ((char *)&ntag) + sizeof(ber_int_t) - taglen, taglen,
+                    nosos));
 }
 
-static int
-ber_calc_lenlen( ber_len_t len )
-{
-	/*
-	 * short len if it's less than 128 - one byte giving the len,
-	 * with bit 8 0.
-	 */
+static int ber_calc_lenlen(ber_len_t len) {
+  /*
+   * short len if it's less than 128 - one byte giving the len,
+   * with bit 8 0.
+   */
 
-	if ( len <= 0x7F )
-		return( 1 );
+  if (len <= 0x7F) return (1);
 
-	/*
-	 * long len otherwise - one byte with bit 8 set, giving the
-	 * length of the length, followed by the length itself.
-	 */
+  /*
+   * long len otherwise - one byte with bit 8 set, giving the
+   * length of the length, followed by the length itself.
+   */
 
-	if ( len <= 0xFF )
-		return( 2 );
-	if ( len <= 0xFFFF )
-		return( 3 );
-	if ( len <= 0xFFFFFF )
-		return( 4 );
+  if (len <= 0xFF) return (2);
+  if (len <= 0xFFFF) return (3);
+  if (len <= 0xFFFFFF) return (4);
 
-	return( 5 );
+  return (5);
 }
 
-static int
-ber_put_len( BerElement *ber, ber_len_t len, int nosos )
-{
-	int			i;
-	char		lenlen;
-	ber_int_t	mask;
-	ber_len_t	netlen;
+static int ber_put_len(BerElement *ber, ber_len_t len, int nosos) {
+  int i;
+  char lenlen;
+  ber_int_t mask;
+  ber_len_t netlen;
 
-	/*
-	 * short len if it's less than 128 - one byte giving the len,
-	 * with bit 8 0.
-	 */
+  /*
+   * short len if it's less than 128 - one byte giving the len,
+   * with bit 8 0.
+   */
 
-	if ( len <= 127 ) {
-		netlen = LBER_HTONL( len );
-		return( ber_write( ber, (char *) &netlen + sizeof(ber_int_t) - 1,
-		    1, nosos ) );
-	}
-
-	/*
-	 * long len otherwise - one byte with bit 8 set, giving the
-	 * length of the length, followed by the length itself.
-	 */
+  if (len <= 127) {
+    netlen = LBER_HTONL(len);
+    return (ber_write(ber, (char *)&netlen + sizeof(ber_int_t) - 1, 1, nosos));
+  }
 
-	/* find the first non-all-zero byte */
-	for ( i = sizeof(ber_int_t) - 1; i > 0; i-- ) {
-		mask = (0xff << (i * 8));
-		/* not all zero */
-		if ( len & mask )
-			break;
-	}
-	lenlen = ++i;
-	if ( lenlen > 4 )
-		return( -1 );
-	lenlen |= 0x80;
+  /*
+   * long len otherwise - one byte with bit 8 set, giving the
+   * length of the length, followed by the length itself.
+   */
 
-	/* write the length of the length */
-	if ( ber_write( ber, &lenlen, 1, nosos ) != 1 )
-		return( -1 );
+  /* find the first non-all-zero byte */
+  for (i = sizeof(ber_int_t) - 1; i > 0; i--) {
+    mask = (0xff << (i * 8));
+    /* not all zero */
+    if (len & mask) break;
+  }
+  lenlen = ++i;
+  if (lenlen > 4) return (-1);
+  lenlen |= 0x80;
 
-	/* write the length itself */
-	netlen = LBER_HTONL( len );
-	if ( ber_write( ber, (char *) &netlen + (sizeof(ber_int_t) - i), i, nosos )
-	    != i )
-		return( -1 );
+  /* write the length of the length */
+  if (ber_write(ber, &lenlen, 1, nosos) != 1) return (-1);
 
-	return( i + 1 );
+  /* write the length itself */
+  netlen = LBER_HTONL(len);
+  if (ber_write(ber, (char *)&netlen + (sizeof(ber_int_t) - i), i, nosos) != i)
+    return (-1);
+
+  return (i + 1);
 }
 
-static int
-ber_put_int_or_enum( BerElement *ber, ber_int_t num, ber_tag_t tag )
-{
-	int			i, sign, taglen;
-	int			len, lenlen;
-	ber_int_t	netnum, mask;
+static int ber_put_int_or_enum(BerElement *ber, ber_int_t num, ber_tag_t tag) {
+  int i, sign, taglen;
+  int len, lenlen;
+  ber_int_t netnum, mask;
+
+  sign = (num < 0);
 
-	sign = (num < 0);
-
-	/*
-	 * high bit is set - look for first non-all-one byte
-	 * high bit is clear - look for first non-all-zero byte
-	 */
-	for ( i = sizeof(ber_int_t) - 1; i > 0; i-- ) {
-		mask = (0xff << (i * 8));
+  /*
+   * high bit is set - look for first non-all-one byte
+   * high bit is clear - look for first non-all-zero byte
+   */
+  for (i = sizeof(ber_int_t) - 1; i > 0; i--) {
+    mask = (0xff << (i * 8));
 
-		if ( sign ) {
-			/* not all ones */
-			if ( (num & mask) != mask )
-				break;
-		} else {
-			/* not all zero */
-			if ( num & mask )
-				break;
-		}
-	}
+    if (sign) {
+      /* not all ones */
+      if ((num & mask) != mask) break;
+    } else {
+      /* not all zero */
+      if (num & mask) break;
+    }
+  }
 
-	/*
-	 * we now have the "leading byte".  if the high bit on this
-	 * byte matches the sign bit, we need to "back up" a byte.
-	 */
-	mask = (num & (0x80 << (i * 8)));
-	if ( (mask && !sign) || (sign && !mask) )
-		i++;
+  /*
+   * we now have the "leading byte".  if the high bit on this
+   * byte matches the sign bit, we need to "back up" a byte.
+   */
+  mask = (num & (0x80 << (i * 8)));
+  if ((mask && !sign) || (sign && !mask)) i++;
 
-	len = i + 1;
+  len = i + 1;
 
-	if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 )
-		return( -1 );
+  if ((taglen = ber_put_tag(ber, tag, 0)) == -1) return (-1);
 
-	if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 )
-		return( -1 );
-	i++;
-	netnum = LBER_HTONL( num );
-	if ( ber_write( ber, (char *) &netnum + (sizeof(ber_int_t) - i), i, 0 ) 
-		== i) 
-		/* length of tag + length + contents */
-		return( taglen + lenlen + i );
+  if ((lenlen = ber_put_len(ber, len, 0)) == -1) return (-1);
+  i++;
+  netnum = LBER_HTONL(num);
+  if (ber_write(ber, (char *)&netnum + (sizeof(ber_int_t) - i), i, 0) == i)
+    /* length of tag + length + contents */
+    return (taglen + lenlen + i);
 
-	return( -1 );
+  return (-1);
 }
 
-int
-LDAP_CALL
-ber_put_enum( BerElement *ber, ber_int_t num, ber_tag_t tag )
-{
-	if ( tag == LBER_DEFAULT )
-		tag = LBER_ENUMERATED;
+int LDAP_CALL ber_put_enum(BerElement *ber, ber_int_t num, ber_tag_t tag) {
+  if (tag == LBER_DEFAULT) tag = LBER_ENUMERATED;
 
-	return( ber_put_int_or_enum( ber, num, tag ) );
+  return (ber_put_int_or_enum(ber, num, tag));
 }
 
-int
-LDAP_CALL
-ber_put_int( BerElement *ber, ber_int_t num, ber_tag_t tag )
-{
-	if ( tag == LBER_DEFAULT )
-		tag = LBER_INTEGER;
+int LDAP_CALL ber_put_int(BerElement *ber, ber_int_t num, ber_tag_t tag) {
+  if (tag == LBER_DEFAULT) tag = LBER_INTEGER;
 
-	return( ber_put_int_or_enum( ber, num, tag ) );
+  return (ber_put_int_or_enum(ber, num, tag));
 }
 
-int
-LDAP_CALL
-ber_put_ostring( BerElement *ber, char *str, ber_len_t len,
-	ber_tag_t tag )
-{
-	int	taglen, lenlen, rc;
+int LDAP_CALL ber_put_ostring(BerElement *ber, char *str, ber_len_t len,
+                              ber_tag_t tag) {
+  int taglen, lenlen, rc;
 #ifdef STR_TRANSLATION
-	int	free_str;
+  int free_str;
 #endif /* STR_TRANSLATION */
 
-	if ( tag == LBER_DEFAULT )
-		tag = LBER_OCTETSTRING;
+  if (tag == LBER_DEFAULT) tag = LBER_OCTETSTRING;
 
-	if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 )
-		return( -1 );
+  if ((taglen = ber_put_tag(ber, tag, 0)) == -1) return (-1);
 
 #ifdef STR_TRANSLATION
-	if ( len > 0 && ( ber->ber_options & LBER_OPT_TRANSLATE_STRINGS ) != 0
-	    && ber->ber_encode_translate_proc != NULL ) {
-		if ( (*(ber->ber_encode_translate_proc))( &str, &len, 0 )
-		    != 0 ) {
-			return( -1 );
-		}
-		free_str = 1;
-	} else {
-		free_str = 0;
-	}
+  if (len > 0 && (ber->ber_options & LBER_OPT_TRANSLATE_STRINGS) != 0 &&
+      ber->ber_encode_translate_proc != NULL) {
+    if ((*(ber->ber_encode_translate_proc))(&str, &len, 0) != 0) {
+      return (-1);
+    }
+    free_str = 1;
+  } else {
+    free_str = 0;
+  }
 #endif /* STR_TRANSLATION */
 
-    /*  
-     *  Note:  below is a spot where we limit ber_write 
-     *         to signed long (instead of unsigned long)
-     */
+  /*
+   *  Note:  below is a spot where we limit ber_write
+   *         to signed long (instead of unsigned long)
+   */
 
-	if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 ||
-		ber_write( ber, str, len, 0 ) != (ber_int_t) len ) {
-		rc = -1;
-	} else {
-		/* return length of tag + length + contents */
-		rc = taglen + lenlen + len;
-	}
+  if ((lenlen = ber_put_len(ber, len, 0)) == -1 ||
+      ber_write(ber, str, len, 0) != (ber_int_t)len) {
+    rc = -1;
+  } else {
+    /* return length of tag + length + contents */
+    rc = taglen + lenlen + len;
+  }
 
 #ifdef STR_TRANSLATION
-	if ( free_str ) {
-		NSLBERI_FREE( str );
-	}
+  if (free_str) {
+    NSLBERI_FREE(str);
+  }
 #endif /* STR_TRANSLATION */
 
-	return( rc );
+  return (rc);
 }
 
-int
-LDAP_CALL
-ber_put_string( BerElement *ber, char *str, ber_tag_t tag )
-{
-	return( ber_put_ostring( ber, str, (ber_len_t) strlen( str ), tag ));
+int LDAP_CALL ber_put_string(BerElement *ber, char *str, ber_tag_t tag) {
+  return (ber_put_ostring(ber, str, (ber_len_t)strlen(str), tag));
 }
 
-int
-LDAP_CALL
-ber_put_bitstring( BerElement *ber, char *str,
-	ber_len_t blen /* in bits */, ber_tag_t tag )
-{
-	int		taglen, lenlen, len;
-	unsigned char	unusedbits;
+int LDAP_CALL ber_put_bitstring(BerElement *ber, char *str,
+                                ber_len_t blen /* in bits */, ber_tag_t tag) {
+  int taglen, lenlen, len;
+  unsigned char unusedbits;
 
-	if ( tag == LBER_DEFAULT )
-		tag = LBER_BITSTRING;
+  if (tag == LBER_DEFAULT) tag = LBER_BITSTRING;
 
-	if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 )
-		return( -1 );
+  if ((taglen = ber_put_tag(ber, tag, 0)) == -1) return (-1);
 
-	len = ( blen + 7 ) / 8;
-	unusedbits = (unsigned char) (len * 8 - blen);
-	if ( (lenlen = ber_put_len( ber, len + 1, 0 )) == -1 )
-		return( -1 );
+  len = (blen + 7) / 8;
+  unusedbits = (unsigned char)(len * 8 - blen);
+  if ((lenlen = ber_put_len(ber, len + 1, 0)) == -1) return (-1);
 
-	if ( ber_write( ber, (char *)&unusedbits, 1, 0 ) != 1 )
-		return( -1 );
+  if (ber_write(ber, (char *)&unusedbits, 1, 0) != 1) return (-1);
 
-	if ( ber_write( ber, str, len, 0 ) != len )
-		return( -1 );
+  if (ber_write(ber, str, len, 0) != len) return (-1);
 
-	/* return length of tag + length + unused bit count + contents */
-	return( taglen + 1 + lenlen + len );
+  /* return length of tag + length + unused bit count + contents */
+  return (taglen + 1 + lenlen + len);
 }
 
-int
-LDAP_CALL
-ber_put_null( BerElement *ber, ber_tag_t tag )
-{
-	int	taglen;
+int LDAP_CALL ber_put_null(BerElement *ber, ber_tag_t tag) {
+  int taglen;
+
+  if (tag == LBER_DEFAULT) tag = LBER_NULL;
 
-	if ( tag == LBER_DEFAULT )
-		tag = LBER_NULL;
+  if ((taglen = ber_put_tag(ber, tag, 0)) == -1) return (-1);
 
-	if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 )
-		return( -1 );
+  if (ber_put_len(ber, 0, 0) != 1) return (-1);
 
-	if ( ber_put_len( ber, 0, 0 ) != 1 )
-		return( -1 );
-
-	return( taglen + 1 );
+  return (taglen + 1);
 }
 
-int
-LDAP_CALL
-ber_put_boolean( BerElement *ber, ber_int_t boolval, ber_tag_t tag )
-{
-	int		taglen;
-	unsigned char	trueval = 0xff;
-	unsigned char	falseval = 0x00;
+int LDAP_CALL ber_put_boolean(BerElement *ber, ber_int_t boolval,
+                              ber_tag_t tag) {
+  int taglen;
+  unsigned char trueval = 0xff;
+  unsigned char falseval = 0x00;
 
-	if ( tag == LBER_DEFAULT )
-		tag = LBER_BOOLEAN;
+  if (tag == LBER_DEFAULT) tag = LBER_BOOLEAN;
 
-	if ( (taglen = ber_put_tag( ber, tag, 0 )) == -1 )
-		return( -1 );
+  if ((taglen = ber_put_tag(ber, tag, 0)) == -1) return (-1);
 
-	if ( ber_put_len( ber, 1, 0 ) != 1 )
-		return( -1 );
+  if (ber_put_len(ber, 1, 0) != 1) return (-1);
 
-	if ( ber_write( ber, (char *)(boolval ? &trueval : &falseval), 1, 0 )
-	    != 1 )
-		return( -1 );
+  if (ber_write(ber, (char *)(boolval ? &trueval : &falseval), 1, 0) != 1)
+    return (-1);
 
-	return( taglen + 2 );
+  return (taglen + 2);
 }
 
-#define FOUR_BYTE_LEN	5
-
+#define FOUR_BYTE_LEN 5
 
 /* the idea here is roughly this: we maintain a stack of these Seqorset
  * structures. This is pushed when we see the beginning of a new set or
  * sequence. It is popped when we see the end of a set or sequence.
  * Since we don't want to malloc and free these structures all the time,
  * we pre-allocate a small set of them within the ber element structure.
  * thus we need to spot when we've overflowed this stack and fall back to
  * malloc'ing instead.
  */
-static int
-ber_start_seqorset( BerElement *ber, ber_tag_t tag )
-{
-	Seqorset	*new_sos;
+static int ber_start_seqorset(BerElement *ber, ber_tag_t tag) {
+  Seqorset *new_sos;
 
-	/* can we fit into the local stack ? */
-	if (ber->ber_sos_stack_posn < SOS_STACK_SIZE) {
-		/* yes */
-		new_sos = &ber->ber_sos_stack[ber->ber_sos_stack_posn];
-	} else {
-		/* no */
-		if ( (new_sos = (Seqorset *)NSLBERI_MALLOC( sizeof(Seqorset)))
-		    == NULLSEQORSET ) {
-			return( -1 );
-		}
-	}
-	ber->ber_sos_stack_posn++;
+  /* can we fit into the local stack ? */
+  if (ber->ber_sos_stack_posn < SOS_STACK_SIZE) {
+    /* yes */
+    new_sos = &ber->ber_sos_stack[ber->ber_sos_stack_posn];
+  } else {
+    /* no */
+    if ((new_sos = (Seqorset *)NSLBERI_MALLOC(sizeof(Seqorset))) ==
+        NULLSEQORSET) {
+      return (-1);
+    }
+  }
+  ber->ber_sos_stack_posn++;
 
-	if ( ber->ber_sos == NULLSEQORSET )
-		new_sos->sos_first = ber->ber_ptr;
-	else
-		new_sos->sos_first = ber->ber_sos->sos_ptr;
+  if (ber->ber_sos == NULLSEQORSET)
+    new_sos->sos_first = ber->ber_ptr;
+  else
+    new_sos->sos_first = ber->ber_sos->sos_ptr;
 
-	/* Set aside room for a 4 byte length field */
-	new_sos->sos_ptr = new_sos->sos_first + ber_calc_taglen( tag ) + FOUR_BYTE_LEN;
-	new_sos->sos_tag = tag;
+  /* Set aside room for a 4 byte length field */
+  new_sos->sos_ptr = new_sos->sos_first + ber_calc_taglen(tag) + FOUR_BYTE_LEN;
+  new_sos->sos_tag = tag;
 
-	new_sos->sos_next = ber->ber_sos;
-	new_sos->sos_clen = 0;
+  new_sos->sos_next = ber->ber_sos;
+  new_sos->sos_clen = 0;
 
-	ber->ber_sos = new_sos;
-    if (ber->ber_sos->sos_ptr > ber->ber_end) {
-        nslberi_ber_realloc(ber, ber->ber_sos->sos_ptr - ber->ber_end);
-    }
-	return( 0 );
+  ber->ber_sos = new_sos;
+  if (ber->ber_sos->sos_ptr > ber->ber_end) {
+    nslberi_ber_realloc(ber, ber->ber_sos->sos_ptr - ber->ber_end);
+  }
+  return (0);
 }
 
-int
-LDAP_CALL
-ber_start_seq( BerElement *ber, ber_tag_t tag )
-{
-	if ( tag == LBER_DEFAULT )
-		tag = LBER_SEQUENCE;
+int LDAP_CALL ber_start_seq(BerElement *ber, ber_tag_t tag) {
+  if (tag == LBER_DEFAULT) tag = LBER_SEQUENCE;
 
-	return( ber_start_seqorset( ber, tag ) );
+  return (ber_start_seqorset(ber, tag));
 }
 
-int
-LDAP_CALL
-ber_start_set( BerElement *ber, ber_tag_t tag )
-{
-	if ( tag == LBER_DEFAULT )
-		tag = LBER_SET;
+int LDAP_CALL ber_start_set(BerElement *ber, ber_tag_t tag) {
+  if (tag == LBER_DEFAULT) tag = LBER_SET;
 
-	return( ber_start_seqorset( ber, tag ) );
+  return (ber_start_seqorset(ber, tag));
 }
 
-static int
-ber_put_seqorset( BerElement *ber )
-{
-	ber_len_t		len, netlen;
-	int				taglen, lenlen;
-	unsigned char	ltag = 0x80 + FOUR_BYTE_LEN - 1;
-	Seqorset		*next;
-	Seqorset		**sos = &ber->ber_sos;
+static int ber_put_seqorset(BerElement *ber) {
+  ber_len_t len, netlen;
+  int taglen, lenlen;
+  unsigned char ltag = 0x80 + FOUR_BYTE_LEN - 1;
+  Seqorset *next;
+  Seqorset **sos = &ber->ber_sos;
+
+  if (*sos == NULL) {
+    /* No sequence or set to put... fatal error. */
+    return (-1);
+  }
 
-	if ( *sos == NULL ) {
-        /* No sequence or set to put... fatal error. */
-        return( -1 );
-	}
+  /*
+   * If this is the toplevel sequence or set, we need to actually
+   * write the stuff out.  Otherwise, it's already been put in
+   * the appropriate buffer and will be written when the toplevel
+   * one is written.  In this case all we need to do is update the
+   * length and tag.
+   */
 
-    /*
-	 * If this is the toplevel sequence or set, we need to actually
-	 * write the stuff out.  Otherwise, it's already been put in
-	 * the appropriate buffer and will be written when the toplevel
-	 * one is written.  In this case all we need to do is update the
-	 * length and tag.
-	 */
-
-	len = (*sos)->sos_clen;
-	netlen = LBER_HTONL( len );
-	if ( sizeof(ber_int_t) > 4 && len > 0xFFFFFFFF )
-		return( -1 );
+  len = (*sos)->sos_clen;
+  netlen = LBER_HTONL(len);
+  if (sizeof(ber_int_t) > 4 && len > 0xFFFFFFFF) return (-1);
 
-	if ( ber->ber_options & LBER_OPT_USE_DER ) {
-		lenlen = ber_calc_lenlen( len );
-	} else {
-		lenlen = FOUR_BYTE_LEN;
-	}
+  if (ber->ber_options & LBER_OPT_USE_DER) {
+    lenlen = ber_calc_lenlen(len);
+  } else {
+    lenlen = FOUR_BYTE_LEN;
+  }
 
-	if ( (next = (*sos)->sos_next) == NULLSEQORSET ) {
-		/* write the tag */
-		if ( (taglen = ber_put_tag( ber, (*sos)->sos_tag, 1 )) == -1 )
-			return( -1 );
+  if ((next = (*sos)->sos_next) == NULLSEQORSET) {
+    /* write the tag */
+    if ((taglen = ber_put_tag(ber, (*sos)->sos_tag, 1)) == -1) return (-1);
 
-		if ( ber->ber_options & LBER_OPT_USE_DER ) {
-			/* Write the length in the minimum # of octets */
-			if ( ber_put_len( ber, len, 1 ) == -1 )
-				return( -1 );
+    if (ber->ber_options & LBER_OPT_USE_DER) {
+      /* Write the length in the minimum # of octets */
+      if (ber_put_len(ber, len, 1) == -1) return (-1);
 
-			if (lenlen != FOUR_BYTE_LEN) {
-				/*
-				 * We set aside FOUR_BYTE_LEN bytes for
-				 * the length field.  Move the data if
-				 * we don't actually need that much
-				 */
-				SAFEMEMCPY( (*sos)->sos_first + taglen +
-				    lenlen, (*sos)->sos_first + taglen +
-				    FOUR_BYTE_LEN, len );
-			}
-		} else {
-			/* Fill FOUR_BYTE_LEN bytes for length field */
-			/* one byte of length length */
-			if ( ber_write( ber, (char *)&ltag, 1, 1 ) != 1 )
-				return( -1 );
+      if (lenlen != FOUR_BYTE_LEN) {
+        /*
+         * We set aside FOUR_BYTE_LEN bytes for
+         * the length field.  Move the data if
+         * we don't actually need that much
+         */
+        SAFEMEMCPY((*sos)->sos_first + taglen + lenlen,
+                   (*sos)->sos_first + taglen + FOUR_BYTE_LEN, len);
+      }
+    } else {
+      /* Fill FOUR_BYTE_LEN bytes for length field */
+      /* one byte of length length */
+      if (ber_write(ber, (char *)&ltag, 1, 1) != 1) return (-1);
 
-			/* the length itself */
-			if ( ber_write( ber, (char *) &netlen + sizeof(ber_int_t)
-			    - (FOUR_BYTE_LEN - 1), FOUR_BYTE_LEN - 1, 1 )
-			    != FOUR_BYTE_LEN - 1 )
-				return( -1 );
-		}
-		/* The ber_ptr is at the set/seq start - move it to the end */
-		ber->ber_ptr += len;
-	} else {
-		ber_tag_t	ntag;
+      /* the length itself */
+      if (ber_write(ber,
+                    (char *)&netlen + sizeof(ber_int_t) - (FOUR_BYTE_LEN - 1),
+                    FOUR_BYTE_LEN - 1, 1) != FOUR_BYTE_LEN - 1)
+        return (-1);
+    }
+    /* The ber_ptr is at the set/seq start - move it to the end */
+    ber->ber_ptr += len;
+  } else {
+    ber_tag_t ntag;
 
-		/* the tag */
-		taglen = ber_calc_taglen( (*sos)->sos_tag );
-		ntag = LBER_HTONL( (*sos)->sos_tag );
-		SAFEMEMCPY( (*sos)->sos_first, (char *) &ntag +
-		    sizeof(ber_int_t) - taglen, taglen );
+    /* the tag */
+    taglen = ber_calc_taglen((*sos)->sos_tag);
+    ntag = LBER_HTONL((*sos)->sos_tag);
+    SAFEMEMCPY((*sos)->sos_first, (char *)&ntag + sizeof(ber_int_t) - taglen,
+               taglen);
 
-		if ( ber->ber_options & LBER_OPT_USE_DER ) {
-			ltag = (lenlen == 1) ? (unsigned char)len :  
-                (unsigned char) (0x80 + (lenlen - 1));
-		}
+    if (ber->ber_options & LBER_OPT_USE_DER) {
+      ltag = (lenlen == 1) ? (unsigned char)len
+                           : (unsigned char)(0x80 + (lenlen - 1));
+    }
 
-		/* one byte of length length */
-		SAFEMEMCPY( (*sos)->sos_first + 1, &ltag, 1 );
+    /* one byte of length length */
+    SAFEMEMCPY((*sos)->sos_first + 1, &ltag, 1);
 
-		if ( ber->ber_options & LBER_OPT_USE_DER ) {
-			if (lenlen > 1) {
-				/* Write the length itself */
-				SAFEMEMCPY( (*sos)->sos_first + 2,
-				    (char *)&netlen + sizeof(ber_uint_t) -
-				    (lenlen - 1),
-				    lenlen - 1 );
-			}
-			if (lenlen != FOUR_BYTE_LEN) {
-				/*
-				 * We set aside FOUR_BYTE_LEN bytes for
-				 * the length field.  Move the data if
-				 * we don't actually need that much
-				 */
-				SAFEMEMCPY( (*sos)->sos_first + taglen +
-				    lenlen, (*sos)->sos_first + taglen +
-				    FOUR_BYTE_LEN, len );
-			}
-		} else {
-			/* the length itself */
-			SAFEMEMCPY( (*sos)->sos_first + taglen + 1,
-			    (char *) &netlen + sizeof(ber_int_t) -
-			    (FOUR_BYTE_LEN - 1), FOUR_BYTE_LEN - 1 );
-		}
+    if (ber->ber_options & LBER_OPT_USE_DER) {
+      if (lenlen > 1) {
+        /* Write the length itself */
+        SAFEMEMCPY((*sos)->sos_first + 2,
+                   (char *)&netlen + sizeof(ber_uint_t) - (lenlen - 1),
+                   lenlen - 1);
+      }
+      if (lenlen != FOUR_BYTE_LEN) {
+        /*
+         * We set aside FOUR_BYTE_LEN bytes for
+         * the length field.  Move the data if
+         * we don't actually need that much
+         */
+        SAFEMEMCPY((*sos)->sos_first + taglen + lenlen,
+                   (*sos)->sos_first + taglen + FOUR_BYTE_LEN, len);
+      }
+    } else {
+      /* the length itself */
+      SAFEMEMCPY((*sos)->sos_first + taglen + 1,
+                 (char *)&netlen + sizeof(ber_int_t) - (FOUR_BYTE_LEN - 1),
+                 FOUR_BYTE_LEN - 1);
+    }
 
-		next->sos_clen += (taglen + lenlen + len);
-		next->sos_ptr += (taglen + lenlen + len);
-	}
+    next->sos_clen += (taglen + lenlen + len);
+    next->sos_ptr += (taglen + lenlen + len);
+  }
 
-	/* we're done with this seqorset, so free it up */
-	/* was this one from the local stack ? */
-	if (ber->ber_sos_stack_posn <= SOS_STACK_SIZE) {
-		/* yes */
-	} else {
-		/* no */
-		NSLBERI_FREE( (char *) (*sos) );
-	}
-	ber->ber_sos_stack_posn--;
-	*sos = next;
+  /* we're done with this seqorset, so free it up */
+  /* was this one from the local stack ? */
+  if (ber->ber_sos_stack_posn <= SOS_STACK_SIZE) {
+    /* yes */
+  } else {
+    /* no */
+    NSLBERI_FREE((char *)(*sos));
+  }
+  ber->ber_sos_stack_posn--;
+  *sos = next;
 
-	return( taglen + lenlen + len );
-}
-
-int
-LDAP_CALL
-ber_put_seq( BerElement *ber )
-{
-	return( ber_put_seqorset( ber ) );
+  return (taglen + lenlen + len);
 }
 
-int
-LDAP_CALL
-ber_put_set( BerElement *ber )
-{
-	return( ber_put_seqorset( ber ) );
-}
+int LDAP_CALL ber_put_seq(BerElement *ber) { return (ber_put_seqorset(ber)); }
+
+int LDAP_CALL ber_put_set(BerElement *ber) { return (ber_put_seqorset(ber)); }
 
 /* VARARGS */
-int
-LDAP_C
-ber_printf( BerElement *ber, const char *fmt, ... )
-{
-	va_list			ap;
-	char			*s, **ss;
-	struct berval	*bval, **bv;
-	int				rc, i;
-	ber_len_t		len;
+int LDAP_C ber_printf(BerElement *ber, const char *fmt, ...) {
+  va_list ap;
+  char *s, **ss;
+  struct berval *bval, **bv;
+  int rc, i;
+  ber_len_t len;
 
-	va_start( ap, fmt );
+  va_start(ap, fmt);
 
 #ifdef LDAP_DEBUG
-	if ( lber_debug & 64 ) {
-		char msg[80];
-		sprintf( msg, "ber_printf fmt (%s)\n", fmt );
-		ber_err_print( msg );
-	}
+  if (lber_debug & 64) {
+    char msg[80];
+    sprintf(msg, "ber_printf fmt (%s)\n", fmt);
+    ber_err_print(msg);
+  }
 #endif
 
-	for ( rc = 0; *fmt && rc != -1; fmt++ ) {
-		switch ( *fmt ) {
-		case 'b':	/* boolean */
-			i = va_arg( ap, int );
-			rc = ber_put_boolean( ber, i, ber->ber_tag );
-			break;
-
-		case 'i':	/* int */
-			i = va_arg( ap, int );
-			rc = ber_put_int( ber, (ber_int_t)i, ber->ber_tag );
-			break;
+  for (rc = 0; *fmt && rc != -1; fmt++) {
+    switch (*fmt) {
+      case 'b': /* boolean */
+        i = va_arg(ap, int);
+        rc = ber_put_boolean(ber, i, ber->ber_tag);
+        break;
 
-		case 'e':	/* enumeration */
-			i = va_arg( ap, int );
-			rc = ber_put_enum( ber, (ber_int_t)i, ber->ber_tag );
-			break;
+      case 'i': /* int */
+        i = va_arg(ap, int);
+        rc = ber_put_int(ber, (ber_int_t)i, ber->ber_tag);
+        break;
 
-		case 'n':	/* null */
-			rc = ber_put_null( ber, ber->ber_tag );
-			break;
+      case 'e': /* enumeration */
+        i = va_arg(ap, int);
+        rc = ber_put_enum(ber, (ber_int_t)i, ber->ber_tag);
+        break;
 
-		case 'o':	/* octet string (non-null terminated) */
-			s = va_arg( ap, char * );
-			len = va_arg( ap, int );
-			rc = ber_put_ostring( ber, s, len, ber->ber_tag );
-			break;
+      case 'n': /* null */
+        rc = ber_put_null(ber, ber->ber_tag);
+        break;
 
-		case 'O':	/* berval octet string */
-			if( ( bval = va_arg( ap, struct berval * ) ) == NULL )
-				break;
-			if( bval->bv_len == 0 ) {
-				rc = ber_put_ostring( ber, "", 0, ber->ber_tag );
-			} else {
-				rc = ber_put_ostring( ber, bval->bv_val, bval->bv_len,
-					ber->ber_tag );
-			}
- 			break;
+      case 'o': /* octet string (non-null terminated) */
+        s = va_arg(ap, char *);
+        len = va_arg(ap, int);
+        rc = ber_put_ostring(ber, s, len, ber->ber_tag);
+        break;
+
+      case 'O': /* berval octet string */
+        if ((bval = va_arg(ap, struct berval *)) == NULL) break;
+        if (bval->bv_len == 0) {
+          rc = ber_put_ostring(ber, "", 0, ber->ber_tag);
+        } else {
+          rc = ber_put_ostring(ber, bval->bv_val, bval->bv_len, ber->ber_tag);
+        }
+        break;
 
-		case 's':	/* string */
-			s = va_arg( ap, char * );
-			rc = ber_put_string( ber, s, ber->ber_tag );
-			break;
+      case 's': /* string */
+        s = va_arg(ap, char *);
+        rc = ber_put_string(ber, s, ber->ber_tag);
+        break;
 
-		case 'B':	/* bit string */
-			s = va_arg( ap, char * );
-			len = va_arg( ap, int );	/* in bits */
-			rc = ber_put_bitstring( ber, s, len, ber->ber_tag );
-			break;
+      case 'B': /* bit string */
+        s = va_arg(ap, char *);
+        len = va_arg(ap, int); /* in bits */
+        rc = ber_put_bitstring(ber, s, len, ber->ber_tag);
+        break;
 
-		case 't':	/* tag for the next element */
-			ber->ber_tag = va_arg( ap, ber_tag_t );
-			ber->ber_usertag = 1;
-			break;
+      case 't': /* tag for the next element */
+        ber->ber_tag = va_arg(ap, ber_tag_t);
+        ber->ber_usertag = 1;
+        break;
 
-		case 'v':	/* vector of strings */
-			if ( (ss = va_arg( ap, char ** )) == NULL )
-				break;
-			for ( i = 0; ss[i] != NULL; i++ ) {
-				if ( (rc = ber_put_string( ber, ss[i],
-				    ber->ber_tag )) == -1 )
-					break;
-			}
-			break;
+      case 'v': /* vector of strings */
+        if ((ss = va_arg(ap, char **)) == NULL) break;
+        for (i = 0; ss[i] != NULL; i++) {
+          if ((rc = ber_put_string(ber, ss[i], ber->ber_tag)) == -1) break;
+        }
+        break;
 
-		case 'V':	/* sequences of strings + lengths */
-			if ( (bv = va_arg( ap, struct berval ** )) == NULL )
-				break;
-			for ( i = 0; bv[i] != NULL; i++ ) {
-				if ( (rc = ber_put_ostring( ber, bv[i]->bv_val,
-				    bv[i]->bv_len, ber->ber_tag )) == -1 )
-					break;
-			}
-			break;
+      case 'V': /* sequences of strings + lengths */
+        if ((bv = va_arg(ap, struct berval **)) == NULL) break;
+        for (i = 0; bv[i] != NULL; i++) {
+          if ((rc = ber_put_ostring(ber, bv[i]->bv_val, bv[i]->bv_len,
+                                    ber->ber_tag)) == -1)
+            break;
+        }
+        break;
 
-		case '{':	/* begin sequence */
-			rc = ber_start_seq( ber, ber->ber_tag );
-			break;
+      case '{': /* begin sequence */
+        rc = ber_start_seq(ber, ber->ber_tag);
+        break;
 
-		case '}':	/* end sequence */
-			rc = ber_put_seqorset( ber );
-			break;
+      case '}': /* end sequence */
+        rc = ber_put_seqorset(ber);
+        break;
 
-		case '[':	/* begin set */
-			rc = ber_start_set( ber, ber->ber_tag );
-			break;
+      case '[': /* begin set */
+        rc = ber_start_set(ber, ber->ber_tag);
+        break;
 
-		case ']':	/* end set */
-			rc = ber_put_seqorset( ber );
-			break;
+      case ']': /* end set */
+        rc = ber_put_seqorset(ber);
+        break;
 
-		default: {
-				char msg[80];
-				sprintf( msg, "unknown fmt %c\n", *fmt );
-				ber_err_print( msg );
-				rc = -1;
-				break;
-			}
-		}
+      default: {
+        char msg[80];
+        sprintf(msg, "unknown fmt %c\n", *fmt);
+        ber_err_print(msg);
+        rc = -1;
+        break;
+      }
+    }
 
-		if ( ber->ber_usertag == 0 )
-			ber->ber_tag = LBER_DEFAULT;
-		else
-			ber->ber_usertag = 0;
-	}
+    if (ber->ber_usertag == 0)
+      ber->ber_tag = LBER_DEFAULT;
+    else
+      ber->ber_usertag = 0;
+  }
 
-	va_end( ap );
+  va_end(ap);
 
-	return( rc );
+  return (rc);
 }
--- a/ldap/c-sdk/libraries/liblber/etest.c
+++ b/ldap/c-sdk/libraries/liblber/etest.c
@@ -1,43 +1,43 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- * 
- * The contents of this file are subject to the Mozilla Public License Version 
- * 1.1 (the "License"); you may not use this file except in compliance with 
- * the License. You may obtain a copy of the License at 
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
- * 
+ *
  * The Original Code is Mozilla Communicator client code, released
  * March 31, 1998.
- * 
+ *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998-1999
  * the Initial Developer. All Rights Reserved.
- * 
+ *
  * Contributor(s):
- * 
+ *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
- * 
+ *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * Copyright (c) 1990 Regents of the University of Michigan.
  * All rights reserved.
  * Redistribution and use in source and binary forms are permitted
  * provided that this notice is preserved and that due credit is given
  * to the University of Michigan at Ann Arbor. The name of the University
@@ -46,148 +46,136 @@
  * is provided ``as is'' without express or implied warranty.
  */
 
 /* test.c - lber encoding test program */
 
 #include <stdio.h>
 #include <string.h>
 #ifdef MACOS
-#include <stdlib.h>
-#include <unix.h>
-#include <fcntl.h>
-#include <console.h>
+#  include <stdlib.h>
+#  include <unix.h>
+#  include <fcntl.h>
+#  include <console.h>
 #else /* MACOS */
-#include <sys/types.h>
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <sys/socket.h>
-#endif /* _WIN32 */
-#endif /* MACOS */
+#  include <sys/types.h>
+#  ifdef _WIN32
+#    include <windows.h>
+#  else
+#    include <sys/socket.h>
+#  endif /* _WIN32 */
+#endif   /* MACOS */
 #include "lber.h"
 
-int
-SSL_Recv( int s, char *b, unsigned l, int dummy )
-{
-	return( read( s, b, l ) );
-}
+int SSL_Recv(int s, char *b, unsigned l, int dummy) { return (read(s, b, l)); }
+
+SSL_Send(int s, char *b, unsigned l, int dummy) { return (write(s, b, l)); }
+
+int getline(char *prompt, char c, char *buf, int bsize) {
+  char *p;
 
-SSL_Send( int s, char *b, unsigned l, int dummy )
-{
-	return( write( s, b, l ) );
+  if (prompt != NULL) {
+    fprintf(stderr, "%s: ", prompt);
+  } else {
+    fprintf(stderr, "enter value for '%c': ", c);
+  }
+  if (fgets(buf, bsize, stdin) == NULL) {
+    return (-1);
+  }
+  if ((p = strchr(buf, '\n')) != NULL) {
+    *p = '\0';
+  }
+
+  return (0);
 }
 
-int
-getline( char *prompt, char c, char *buf, int bsize )
-{
-	char	*p;
-
-	if ( prompt != NULL ) {
-		fprintf( stderr, "%s: ", prompt );
-	} else {
-		fprintf( stderr, "enter value for '%c': ", c );
-	}
-	if ( fgets( buf, bsize, stdin ) == NULL ) {
-		return( -1 );
-	}
-	if ( (p = strchr( buf, '\n' )) != NULL ) {
-		*p = '\0';
-	}
-
-	return( 0 );
-}
-
-
-static void usage( char *name )
-{
-	fprintf( stderr, "usage: %s fmtstring\n", name );
+static void usage(char *name) {
+  fprintf(stderr, "usage: %s fmtstring\n", name);
 }
 
-main( int argc, char **argv )
-{
-	int		rc, fd;
-	char		*s, *p;
-	void		*arg1, *arg2;
-	Sockbuf		*sb;
-	BerElement	*ber;
-	char		fmt[2];
-	char		buf[BUFSIZ];
-	extern int	lber_debug;
+main(int argc, char **argv) {
+  int rc, fd;
+  char *s, *p;
+  void *arg1, *arg2;
+  Sockbuf *sb;
+  BerElement *ber;
+  char fmt[2];
+  char buf[BUFSIZ];
+  extern int lber_debug;
 
-	lber_debug = 255;
-	if ( argc < 2 ) {
-		usage( argv[0] );
-		exit( 1 );
-	}
+  lber_debug = 255;
+  if (argc < 2) {
+    usage(argv[0]);
+    exit(1);
+  }
+
+  sb = ber_sockbuf_alloc();
+  fd = 1;
+  ber_sockbuf_set_option(sb, LBER_SOCKBUF_OPT_DESC, &fd);
 
-	sb = ber_sockbuf_alloc();
-	fd = 1;
-	ber_sockbuf_set_option( sb, LBER_SOCKBUF_OPT_DESC, &fd );
-
-	if ( (ber = der_alloc()) == NULL ) {
-		perror( "ber_alloc" );
-		exit( 1 );
-	}
+  if ((ber = der_alloc()) == NULL) {
+    perror("ber_alloc");
+    exit(1);
+  }
 
-	rc = 0;
-	fmt[1] = '\0';
-	for ( s = argv[1]; *s; s++ ) {
-		switch ( *s ) {
-		case 'i':	/* int */
-		case 'b':	/* boolean */
-		case 'e':	/* enumeration */
-			getline( NULL, *s, buf, sizeof(buf) );
-			arg1 = (void *) atoi( buf );
-			break;
+  rc = 0;
+  fmt[1] = '\0';
+  for (s = argv[1]; *s; s++) {
+    switch (*s) {
+      case 'i': /* int */
+      case 'b': /* boolean */
+      case 'e': /* enumeration */
+        getline(NULL, *s, buf, sizeof(buf));
+        arg1 = (void *)atoi(buf);
+        break;
 
-		case 'n':	/* null */
-			arg1 = NULL;
-			break;
+      case 'n': /* null */
+        arg1 = NULL;
+        break;
 
-		case 'o':	/* octet string (non-null terminated) */
-			getline( NULL, *s, buf, sizeof(buf) );
-			arg1 = (void *) buf;
-			arg2 = (void *) strlen( buf );
-			break;
+      case 'o': /* octet string (non-null terminated) */
+        getline(NULL, *s, buf, sizeof(buf));
+        arg1 = (void *)buf;
+        arg2 = (void *)strlen(buf);
+        break;
 
-		case 's':	/* string */
-			getline( NULL, *s, buf, sizeof(buf) );
-			arg1 = (void *) buf;
-			break;
+      case 's': /* string */
+        getline(NULL, *s, buf, sizeof(buf));
+        arg1 = (void *)buf;
+        break;
 
-		case 'B':	/* bit string */
-			getline( NULL, *s, buf, sizeof(buf) );
-			arg1 = (void *) buf;
-			arg2 = (void *) strlen( buf );
-			break;
+      case 'B': /* bit string */
+        getline(NULL, *s, buf, sizeof(buf));
+        arg1 = (void *)buf;
+        arg2 = (void *)strlen(buf);
+        break;
 
-		case 't':	/* tag for the next element */
-			getline( NULL, *s, buf, sizeof(buf) );
-			arg1 = (void *) buf;
-			break;
+      case 't': /* tag for the next element */
+        getline(NULL, *s, buf, sizeof(buf));
+        arg1 = (void *)buf;
+        break;
 
-		case '{':	/* begin sequence */
-		case '}':	/* end sequence */
-		case '[':	/* begin set */
-		case ']':	/* end set */
-			break;
+      case '{': /* begin sequence */
+      case '}': /* end sequence */
+      case '[': /* begin set */
+      case ']': /* end set */
+        break;
 
-		default:
-			fprintf( stderr, "unknown fmt %c\n", *s );
-			rc = -1;
-			break;
-		}
+      default:
+        fprintf(stderr, "unknown fmt %c\n", *s);
+        rc = -1;
+        break;
+    }
 
-		fmt[0] = *s;
-		if ( ber_printf( ber, fmt, arg1, arg2 ) == -1 ) {
-			fprintf( stderr, "ber_printf\n" );
-			exit( 1 );
-		}
-	}
+    fmt[0] = *s;
+    if (ber_printf(ber, fmt, arg1, arg2) == -1) {
+      fprintf(stderr, "ber_printf\n");
+      exit(1);
+    }
+  }
 
-	if ( ber_flush( sb, ber, 1 ) != 0 ) {
-		perror( "ber_flush" );
-		rc = -1;
-	}
+  if (ber_flush(sb, ber, 1) != 0) {
+    perror("ber_flush");
+    rc = -1;
+  }
 
-	return( rc );
+  return (rc);
 }
--- a/ldap/c-sdk/libraries/liblber/idtest.c
+++ b/ldap/c-sdk/libraries/liblber/idtest.c
@@ -1,43 +1,43 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- * 
- * The contents of this file are subject to the Mozilla Public License Version 
- * 1.1 (the "License"); you may not use this file except in compliance with 
- * the License. You may obtain a copy of the License at 
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
- * 
+ *
  * The Original Code is Mozilla Communicator client code, released
  * March 31, 1998.
- * 
+ *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998-1999
  * the Initial Developer. All Rights Reserved.
- * 
+ *
  * Contributor(s):
- * 
+ *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
- * 
+ *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * Copyright (c) 1990 Regents of the University of Michigan.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * provided that this notice is preserved and that due credit is given
@@ -48,53 +48,49 @@
  */
 
 /* idtest.c - ber decoding test program using isode libraries */
 
 #include <stdio.h>
 #include <psap.h>
 #include <quipu/attr.h>
 
-static usage( char *name )
-{
-	fprintf( stderr, "usage: %s\n", name );
-}
+static usage(char *name) { fprintf(stderr, "usage: %s\n", name); }
 
-main( int argc, char **argv )
-{
-	PE	pe;
-	PS	psin, psout, pserr;
+main(int argc, char **argv) {
+  PE pe;
+  PS psin, psout, pserr;
 
-	/* read the pe from standard in */
-	if ( (psin = ps_alloc( std_open )) == NULLPS ) {
-		perror( "ps_alloc" );
-		exit( 1 );
-	}
-	if ( std_setup( psin, stdin ) == NOTOK ) {
-		perror( "std_setup" );
-		exit( 1 );
-	}
-	/* write the pe to standard out */
-	if ( (psout = ps_alloc( std_open )) == NULLPS ) {
-		perror( "ps_alloc" );
-		exit( 1 );
-	}
-	if ( std_setup( psout, stdout ) == NOTOK ) {
-		perror( "std_setup" );
-		exit( 1 );
-	}
-	/* pretty print it to standard error */
-	if ( (pserr = ps_alloc( std_open )) == NULLPS ) {
-		perror( "ps_alloc" );
-		exit( 1 );
-	}
-	if ( std_setup( pserr, stderr ) == NOTOK ) {
-		perror( "std_setup" );
-		exit( 1 );
-	}
+  /* read the pe from standard in */
+  if ((psin = ps_alloc(std_open)) == NULLPS) {
+    perror("ps_alloc");
+    exit(1);
+  }
+  if (std_setup(psin, stdin) == NOTOK) {
+    perror("std_setup");
+    exit(1);
+  }
+  /* write the pe to standard out */
+  if ((psout = ps_alloc(std_open)) == NULLPS) {
+    perror("ps_alloc");
+    exit(1);
+  }
+  if (std_setup(psout, stdout) == NOTOK) {
+    perror("std_setup");
+    exit(1);
+  }
+  /* pretty print it to standard error */
+  if ((pserr = ps_alloc(std_open)) == NULLPS) {
+    perror("ps_alloc");
+    exit(1);
+  }
+  if (std_setup(pserr, stderr) == NOTOK) {
+    perror("std_setup");
+    exit(1);
+  }
 
-	while ( (pe = ps2pe( psin )) != NULLPE ) {
-		pe2pl( pserr, pe );
-		pe2ps( psout, pe );
-	}
+  while ((pe = ps2pe(psin)) != NULLPE) {
+    pe2pl(pserr, pe);
+    pe2ps(psout, pe);
+  }
 
-	exit( 0 );
+  exit(0);
 }
--- a/ldap/c-sdk/libraries/liblber/io.c
+++ b/ldap/c-sdk/libraries/liblber/io.c
@@ -1,43 +1,43 @@
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- * 
- * The contents of this file are subject to the Mozilla Public License Version 
- * 1.1 (the "License"); you may not use this file except in compliance with 
- * the License. You may obtain a copy of the License at 
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
- * 
+ *
  * The Original Code is Mozilla Communicator client code, released
  * March 31, 1998.
- * 
+ *
  * The Initial Developer of the Original Code is
  * Netscape Communications Corporation.
  * Portions created by the Initial Developer are Copyright (C) 1998-1999
  * the Initial Developer. All Rights Reserved.
- * 
+ *
  * Contributor(s):
- * 
+ *
  * Alternatively, the contents of this file may be used under the terms of
  * either of the GNU General Public License Version 2 or later (the "GPL"),
  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
- * 
+ *
  * ***** END LICENSE BLOCK ***** */
 
 /*
  * Copyright (c) 1990 Regents of the University of Michigan.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms are permitted
  * provided that this notice is preserved and that due credit is given
@@ -45,1713 +45,1550 @@
  * may not be used to endorse or promote products derived from this
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  */
 /* io.c - ber general i/o routines */
 
 #include "lber-int.h"
 
-#define bergetc( sb, len )    ( sb->sb_ber.ber_end > sb->sb_ber.ber_ptr ? \
-			  (unsigned char)*sb->sb_ber.ber_ptr++ : \
-			  ber_filbuf( sb, len ))
+#define bergetc(sb, len)                      \
+  (sb->sb_ber.ber_end > sb->sb_ber.ber_ptr    \
+       ? (unsigned char)*sb->sb_ber.ber_ptr++ \
+       : ber_filbuf(sb, len))
 
-# ifdef macintosh
+#ifdef macintosh
 /*
  * MacTCP/OpenTransport
  */
-#  define read( s, b, l ) tcpread( s, 0, (unsigned char *)b, l, NULL )
-#  define MAX_WRITE	65535
-#  define BerWrite( sb, b, l )   tcpwrite( sb->sb_sd, (unsigned char *)(b), (l<MAX_WRITE)? l : MAX_WRITE )
-# else /* macintosh */
+#  define read(s, b, l) tcpread(s, 0, (unsigned char *)b, l, NULL)
+#  define MAX_WRITE 65535
+#  define BerWrite(sb, b, l) \
+    tcpwrite(sb->sb_sd, (unsigned char *)(b), (l < MAX_WRITE) ? l : MAX_WRITE)
+#else /* macintosh */
 #  if defined(_WIN32) || defined(_WINDOWS) || defined(XP_OS2)
 /*
  * 32-bit Windows Socket API (under Windows NT or Windows 95)
  */
-#   define read( s, b, l )		recv( s, b, l, 0 )
-#   define BerWrite( s, b, l )	send( s->sb_sd, b, l, 0 )
+#    define read(s, b, l) recv(s, b, l, 0)
+#    define BerWrite(s, b, l) send(s->sb_sd, b, l, 0)
 #  else /* _WIN32 */
 /*
  * everything else (Unix/BSD 4.3 socket API)
  */
-#   define BerWrite( sb, b, l )	write( sb->sb_sd, b, l )
-#   define udp_read( sb, b, l, al ) recvfrom(sb->sb_sd, (char *)b, l, 0, \
-		(struct sockaddr *)sb->sb_fromaddr, \
-		(al = sizeof(struct sockaddr), &al))
-#   define udp_write( sb, b, l ) sendto(sb->sb_sd, (char *)(b), l, 0, \
-		(struct sockaddr *)sb->sb_useaddr, sizeof(struct sockaddr))
+#    define BerWrite(sb, b, l) write(sb->sb_sd, b, l)
+#    define udp_read(sb, b, l, al)                                             \
+      recvfrom(sb->sb_sd, (char *)b, l, 0, (struct sockaddr *)sb->sb_fromaddr, \
+               (al = sizeof(struct sockaddr), &al))
+#    define udp_write(sb, b, l)                                               \
+      sendto(sb->sb_sd, (char *)(b), l, 0, (struct sockaddr *)sb->sb_useaddr, \
+             sizeof(struct sockaddr))
 #  endif /* _WIN32 */
-# endif /* macintosh */
+#endif   /* macintosh */
 
 #ifndef udp_read
-#define udp_read( sb, b, l, al )	CLDAP NOT SUPPORTED
-#define udp_write( sb, b, l )		CLDAP NOT SUPPORTED
+#  define udp_read(sb, b, l, al) CLDAP NOT SUPPORTED
+#  define udp_write(sb, b, l) CLDAP NOT SUPPORTED
 #endif /* udp_read */
 
-#define EXBUFSIZ			1024
-size_t  lber_bufsize = EXBUFSIZ;
+#define EXBUFSIZ 1024
+size_t lber_bufsize = EXBUFSIZ;
 
 #ifdef LDAP_DEBUG
-int	lber_debug;
+int lber_debug;
 #endif
 
 /*
  * function prototypes
  */
-static void nslberi_install_compat_io_fns( Sockbuf *sb );
-static int nslberi_extread_compat( int s, void *buf, int len,
-		struct lextiof_socket_private *arg );
-static int nslberi_extwrite_compat( int s, const void *buf, int len,
-		struct lextiof_socket_private *arg );
-static ber_tag_t get_tag( Sockbuf *sb, BerElement *ber);
-static ber_len_t get_ber_len( BerElement *ber);
-static ber_len_t read_len_in_ber( Sockbuf *sb, BerElement *ber);
+static void nslberi_install_compat_io_fns(Sockbuf *sb);
+static int nslberi_extread_compat(int s, void *buf, int len,
+                                  struct lextiof_socket_private *arg);
+static int nslberi_extwrite_compat(int s, const void *buf, int len,
+                                   struct lextiof_socket_private *arg);
+static ber_tag_t get_tag(Sockbuf *sb, BerElement *ber);
+static ber_len_t get_ber_len(BerElement *ber);
+static ber_len_t read_len_in_ber(Sockbuf *sb, BerElement *ber);
 
 /*
  * internal global structure for memory allocation callback functions
  */
 static struct lber_memalloc_fns nslberi_memalloc_fns;
 
-
 /*
  * buffered read from "sb".
  * returns value of first character read on success and -1 on error.
  */
-static int
-ber_filbuf( Sockbuf *sb, ber_slen_t len )
-{
-	ssize_t	rc;
+static int ber_filbuf(Sockbuf *sb, ber_slen_t len) {
+  ssize_t rc;
 #ifdef CLDAP
-	int	addrlen;
+  int addrlen;
 #endif /* CLDAP */
 
-	if ( sb->sb_ber.ber_buf == NULL ) {
-		if ( (sb->sb_ber.ber_buf = (char *)NSLBERI_MALLOC(
-		    READBUFSIZ )) == NULL ) {
-			return( -1 );
-		}
-		sb->sb_ber.ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER;
-		sb->sb_ber.ber_ptr = sb->sb_ber.ber_buf;
-		sb->sb_ber.ber_end = sb->sb_ber.ber_buf;
-	}
+  if (sb->sb_ber.ber_buf == NULL) {
+    if ((sb->sb_ber.ber_buf = (char *)NSLBERI_MALLOC(READBUFSIZ)) == NULL) {
+      return (-1);
+    }
+    sb->sb_ber.ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER;
+    sb->sb_ber.ber_ptr = sb->sb_ber.ber_buf;
+    sb->sb_ber.ber_end = sb->sb_ber.ber_buf;
+  }
 
-	if ( sb->sb_naddr > 0 ) {
+  if (sb->sb_naddr > 0) {
 #ifdef CLDAP
-		rc = udp_read(sb, sb->sb_ber.ber_buf, READBUFSIZ, addrlen );
-#ifdef LDAP_DEBUG
-		if ( lber_debug ) {
-			char msg[80];
-			sprintf( msg, "ber_filbuf udp_read %d bytes\n",
-				rc );
-			ber_err_print( msg );
-			if ( lber_debug > 1 && rc > 0 )
-				lber_bprint( sb->sb_ber.ber_buf, rc );
-		}
-#endif /* LDAP_DEBUG */
-#else /* CLDAP */
-		rc = -1;
-#endif /* CLDAP */
-	} else {
-		if ( sb->sb_ext_io_fns.lbextiofn_read != NULL ) {
-			rc = sb->sb_ext_io_fns.lbextiofn_read(
-			    sb->sb_sd, sb->sb_ber.ber_buf,
-			    ((sb->sb_options & LBER_SOCKBUF_OPT_NO_READ_AHEAD)
-			    && (len < READBUFSIZ)) ? len : READBUFSIZ,
-			    sb->sb_ext_io_fns.lbextiofn_socket_arg );
-		} else {
+    rc = udp_read(sb, sb->sb_ber.ber_buf, READBUFSIZ, addrlen);
+#  ifdef LDAP_DEBUG
+    if (lber_debug) {
+      char msg[80];
+      sprintf(msg, "ber_filbuf udp_read %d bytes\n", rc);
+      ber_err_print(msg);
+      if (lber_debug > 1 && rc > 0) lber_bprint(sb->sb_ber.ber_buf, rc);
+    }
+#  endif /* LDAP_DEBUG */
+#else    /* CLDAP */
+    rc = -1;
+#endif   /* CLDAP */
+  } else {
+    if (sb->sb_ext_io_fns.lbextiofn_read != NULL) {
+      rc = sb->sb_ext_io_fns.lbextiofn_read(
+          sb->sb_sd, sb->sb_ber.ber_buf,
+          ((sb->sb_options & LBER_SOCKBUF_OPT_NO_READ_AHEAD) &&
+           (len < READBUFSIZ))
+              ? len
+              : READBUFSIZ,
+          sb->sb_ext_io_fns.lbextiofn_socket_arg);
+    } else {
 #ifdef NSLDAPI_AVOID_OS_SOCKETS
-			return( -1 );
+      return (-1);
 #else
-			rc = read( sb->sb_sd, sb->sb_ber.ber_buf,
-			    ((sb->sb_options & LBER_SOCKBUF_OPT_NO_READ_AHEAD)
-			    && (len < READBUFSIZ)) ? len : READBUFSIZ );
+      rc = read(sb->sb_sd, sb->sb_ber.ber_buf,
+                ((sb->sb_options & LBER_SOCKBUF_OPT_NO_READ_AHEAD) &&
+                 (len < READBUFSIZ))
+                    ? len
+                    : READBUFSIZ);
 #endif
-		}
-	}
+    }
+  }
 
-	if ( rc > 0 ) {
-		sb->sb_ber.ber_ptr = sb->sb_ber.ber_buf + 1;
-		sb->sb_ber.ber_end = sb->sb_ber.ber_buf + rc;
-		return( (unsigned char)*sb->sb_ber.ber_buf );
-	}
+  if (rc > 0) {
+    sb->sb_ber.ber_ptr = sb->sb_ber.ber_buf + 1;
+    sb->sb_ber.ber_end = sb->sb_ber.ber_buf + rc;
+    return ((unsigned char)*sb->sb_ber.ber_buf);
+  }
 
-	return( -1 );
+  return (-1);
 }
 
-
-static ber_int_t
-BerRead( Sockbuf *sb, char *buf, ber_slen_t len )
-{
+static ber_int_t BerRead(Sockbuf *sb, char *buf, ber_slen_t len) {
   int c;
   ber_int_t nread = 0;
-  
-  while (len > 0)
-    {
-      ber_int_t inberbuf = sb->sb_ber.ber_end - sb->sb_ber.ber_ptr;
-      if (inberbuf > 0)
-	{
-	  size_t tocopy = len > inberbuf ? inberbuf : len;
-	  SAFEMEMCPY(buf, sb->sb_ber.ber_ptr, tocopy);
-	  buf += tocopy;
-	  sb->sb_ber.ber_ptr += tocopy;
-	  nread += tocopy;
-	  len -= tocopy;
-	}
-      else
-	{
-	  c = ber_filbuf(sb, len);
-	  if (c < 0)
-	    {
-	      if (nread > 0)
-		break;
-               else
-                 return c;
-             }
-           *buf++ = c;
-           nread++;
-           len--;
-         }
-     }
-   return (nread);
+
+  while (len > 0) {
+    ber_int_t inberbuf = sb->sb_ber.ber_end - sb->sb_ber.ber_ptr;
+    if (inberbuf > 0) {
+      size_t tocopy = len > inberbuf ? inberbuf : len;
+      SAFEMEMCPY(buf, sb->sb_ber.ber_ptr, tocopy);
+      buf += tocopy;
+      sb->sb_ber.ber_ptr += tocopy;
+      nread += tocopy;
+      len -= tocopy;
+    } else {
+      c = ber_filbuf(sb, len);
+      if (c < 0) {
+        if (nread > 0)
+          break;
+        else
+          return c;
+      }
+      *buf++ = c;
+      nread++;
+      len--;
+    }
+  }
+  return (nread);
 }
 
-
 /*
  * Note: ber_read() only uses the ber_end and ber_ptr elements of ber.
  * Functions like ber_get_tag(), ber_skip_tag, and ber_peek_tag() rely on
  * that fact, so if this code is changed to use any additional elements of
  * the ber structure, those functions will need to be changed as well.
  */
-ber_int_t
-LDAP_CALL
-ber_read( BerElement *ber, char *buf, ber_len_t len )
-{
-	ber_len_t	actuallen;
-	ber_uint_t  nleft;
+ber_int_t LDAP_CALL ber_read(BerElement *ber, char *buf, ber_len_t len) {
+  ber_len_t actuallen;
+  ber_uint_t nleft;
 
-	nleft = ber->ber_end - ber->ber_ptr;
-	actuallen = nleft < len ? nleft : len;
+  nleft = ber->ber_end - ber->ber_ptr;
+  actuallen = nleft < len ? nleft : len;
 
-	SAFEMEMCPY( buf, ber->ber_ptr, (size_t)actuallen );
+  SAFEMEMCPY(buf, ber->ber_ptr, (size_t)actuallen);
 
-	ber->ber_ptr += actuallen;
+  ber->ber_ptr += actuallen;
 
-	return( (ber_int_t)actuallen );
+  return ((ber_int_t)actuallen);
 }
 
 /*
  * enlarge the ber buffer.
  * return 0 on success, -1 on error.
  */
-int
-nslberi_ber_realloc( BerElement *ber, ber_len_t len )
-{
-	ber_uint_t	need, have, total;
-	size_t		have_bytes;
-	Seqorset	*s;
-	ber_int_t	off;
-	char		*oldbuf;
-	int			freeoldbuf = 0;
+int nslberi_ber_realloc(BerElement *ber, ber_len_t len) {
+  ber_uint_t need, have, total;
+  size_t have_bytes;
+  Seqorset *s;
+  ber_int_t off;
+  char *oldbuf;
+  int freeoldbuf = 0;
 
-	ber->ber_buf_reallocs++;
+  ber->ber_buf_reallocs++;
 
-	have_bytes = ber->ber_end - ber->ber_buf;
-	have = have_bytes / lber_bufsize;
-	need = (len < lber_bufsize ? 1 : (len + (lber_bufsize - 1)) / lber_bufsize);
-	total = have * lber_bufsize + need * lber_bufsize * ber->ber_buf_reallocs;
-	
-	oldbuf = ber->ber_buf;
+  have_bytes = ber->ber_end - ber->ber_buf;
+  have = have_bytes / lber_bufsize;
+  need = (len < lber_bufsize ? 1 : (len + (lber_bufsize - 1)) / lber_bufsize);
+  total = have * lber_bufsize + need * lber_bufsize * ber->ber_buf_reallocs;
+
+  oldbuf = ber->ber_buf;
 
-	if (ber->ber_buf == NULL) {
-		if ( (ber->ber_buf = (char *)NSLBERI_MALLOC( (size_t)total ))
-			 == NULL ) {
-			return( -1 );
-		}
-		ber->ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER;
-	} else {
-		if ( !(ber->ber_flags & LBER_FLAG_NO_FREE_BUFFER) ) {
-			freeoldbuf = 1;
-		}
-		/* transition to malloc'd buffer */
-		if ( (ber->ber_buf = (char *)NSLBERI_MALLOC(
-			(size_t)total )) == NULL ) {
-			return( -1 );
-		}
-		ber->ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER;
-		/* copy existing data into new malloc'd buffer */
-		SAFEMEMCPY( ber->ber_buf, oldbuf, have_bytes );
-	}
+  if (ber->ber_buf == NULL) {
+    if ((ber->ber_buf = (char *)NSLBERI_MALLOC((size_t)total)) == NULL) {
+      return (-1);
+    }
+    ber->ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER;
+  } else {
+    if (!(ber->ber_flags & LBER_FLAG_NO_FREE_BUFFER)) {
+      freeoldbuf = 1;
+    }
+    /* transition to malloc'd buffer */
+    if ((ber->ber_buf = (char *)NSLBERI_MALLOC((size_t)total)) == NULL) {
+      return (-1);
+    }
+    ber->ber_flags &= ~LBER_FLAG_NO_FREE_BUFFER;
+    /* copy existing data into new malloc'd buffer */
+    SAFEMEMCPY(ber->ber_buf, oldbuf, have_bytes);
+  }
 
-	ber->ber_end = ber->ber_buf + total;
+  ber->ber_end = ber->ber_buf + total;
 
-	/*
-	 * If the stinking thing was moved, we need to go through and
-	 * reset all the sos and ber pointers.  Offsets would've been
-	 * a better idea... oh well.
-	 */
+  /*
+   * If the stinking thing was moved, we need to go through and
+   * reset all the sos and ber pointers.  Offsets would've been
+   * a better idea... oh well.
+   */
 
-	if ( ber->ber_buf != oldbuf ) {	
-		ber->ber_ptr = ber->ber_buf + (ber->ber_ptr - oldbuf);
+  if (ber->ber_buf != oldbuf) {
+    ber->ber_ptr = ber->ber_buf + (ber->ber_ptr - oldbuf);
 
-		for ( s = ber->ber_sos; s != NULLSEQORSET; s = s->sos_next ) {
-			off = s->sos_first - oldbuf;
-			s->sos_first = ber->ber_buf + off;
+    for (s = ber->ber_sos; s != NULLSEQORSET; s = s->sos_next) {
+      off = s->sos_first - oldbuf;
+      s->sos_first = ber->ber_buf + off;
 
-			off = s->sos_ptr - oldbuf;
-			s->sos_ptr = ber->ber_buf + off;
-		}
-		
-		if ( freeoldbuf && oldbuf ) {
-			NSLBERI_FREE( oldbuf );
-		}
-	}
+      off = s->sos_ptr - oldbuf;
+      s->sos_ptr = ber->ber_buf + off;
+    }
 
-	return( 0 );
+    if (freeoldbuf && oldbuf) {
+      NSLBERI_FREE(oldbuf);
+    }
+  }
+
+  return (0);
 }
 
 /*
  * returns "len" on success and -1 on failure.
  */
-ber_int_t
-LDAP_CALL
-ber_write( BerElement *ber, char *buf, ber_len_t len, int nosos )
-{
-	if ( nosos || ber->ber_sos == NULL ) {
-		if ( ber->ber_ptr + len > ber->ber_end ) {
-			if ( nslberi_ber_realloc( ber, len ) !=