1 /* $NetBSD: ldap_pvt.h,v 1.4 2021/08/14 16:14:55 christos Exp $ */ 2 3 /* $OpenLDAP$ */ 4 /* This work is part of OpenLDAP Software <http://www.openldap.org/>. 5 * 6 * Copyright 1998-2021 The OpenLDAP Foundation. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted only as authorized by the OpenLDAP 11 * Public License. 12 * 13 * A copy of this license is available in file LICENSE in the 14 * top-level directory of the distribution or, alternatively, at 15 * <http://www.OpenLDAP.org/license.html>. 16 */ 17 18 /* ldap-pvt.h - Header for ldap_pvt_ functions. 19 * These are meant to be internal to OpenLDAP Software. 20 */ 21 22 #ifndef _LDAP_PVT_H 23 #define _LDAP_PVT_H 1 24 25 #include <openldap.h> /* get public interfaces */ 26 #include <lber.h> /* get ber_slen_t */ 27 #include <lber_pvt.h> /* get Sockbuf_Buf */ 28 29 LDAP_BEGIN_DECL 30 31 LDAP_F ( int ) 32 ldap_pvt_url_scheme2proto LDAP_P(( 33 const char * )); 34 LDAP_F ( int ) 35 ldap_pvt_url_scheme2tls LDAP_P(( 36 const char * )); 37 LDAP_F ( int ) 38 ldap_pvt_url_scheme2proxied LDAP_P(( 39 const char * )); 40 41 LDAP_F ( int ) 42 ldap_pvt_url_scheme_port LDAP_P(( 43 const char *, int )); 44 45 struct ldap_url_desc; /* avoid pulling in <ldap.h> */ 46 47 #define LDAP_PVT_URL_PARSE_NONE (0x00U) 48 #define LDAP_PVT_URL_PARSE_NOEMPTY_HOST (0x01U) 49 #define LDAP_PVT_URL_PARSE_DEF_PORT (0x02U) 50 #define LDAP_PVT_URL_PARSE_NOEMPTY_DN (0x04U) 51 #define LDAP_PVT_URL_PARSE_NODEF_SCOPE (0x08U) 52 #define LDAP_PVT_URL_PARSE_HISTORIC (LDAP_PVT_URL_PARSE_NODEF_SCOPE | \ 53 LDAP_PVT_URL_PARSE_NOEMPTY_HOST | \ 54 LDAP_PVT_URL_PARSE_DEF_PORT) 55 56 LDAP_F( int ) 57 ldap_url_parse_ext LDAP_P(( 58 LDAP_CONST char *url, 59 struct ldap_url_desc **ludpp, 60 unsigned flags )); 61 62 LDAP_F (int) ldap_url_parselist LDAP_P(( /* deprecated, use ldap_url_parselist_ext() */ 63 struct ldap_url_desc **ludlist, 64 const char *url )); 65 66 LDAP_F (int) ldap_url_parselist_ext LDAP_P(( 67 struct ldap_url_desc **ludlist, 68 const char *url, 69 const char *sep, 70 unsigned flags )); 71 72 LDAP_F (char *) ldap_url_list2urls LDAP_P(( 73 struct ldap_url_desc *ludlist )); 74 75 LDAP_F (void) ldap_free_urllist LDAP_P(( 76 struct ldap_url_desc *ludlist )); 77 78 LDAP_F (int) ldap_pvt_scope2bv LDAP_P (( 79 int scope, struct berval *bv )); 80 81 LDAP_F (LDAP_CONST char *) ldap_pvt_scope2str LDAP_P (( 82 int scope )); 83 84 LDAP_F (int) ldap_pvt_bv2scope LDAP_P (( 85 struct berval *bv )); 86 87 LDAP_F (int) ldap_pvt_str2scope LDAP_P (( 88 LDAP_CONST char * )); 89 90 LDAP_F( char * ) 91 ldap_pvt_ctime LDAP_P(( 92 const time_t *tp, 93 char *buf )); 94 95 # if defined( HAVE_GMTIME_R ) 96 # define USE_GMTIME_R 97 # define ldap_pvt_gmtime(timep, result) gmtime_r((timep), (result)) 98 # else 99 LDAP_F( struct tm * ) 100 ldap_pvt_gmtime LDAP_P(( 101 LDAP_CONST time_t *timep, 102 struct tm *result )); 103 #endif 104 105 # if defined( HAVE_LOCALTIME_R ) 106 # define USE_LOCALTIME_R 107 # define ldap_pvt_localtime(timep, result) localtime_r((timep), (result)) 108 # else 109 LDAP_F( struct tm * ) 110 ldap_pvt_localtime LDAP_P(( 111 LDAP_CONST time_t *timep, 112 struct tm *result )); 113 # endif 114 115 #if defined( USE_GMTIME_R ) && defined( USE_LOCALTIME_R ) 116 # define ldap_pvt_gmtime_lock() (0) 117 # define ldap_pvt_gmtime_unlock() (0) 118 #else 119 LDAP_F( int ) 120 ldap_pvt_gmtime_lock LDAP_P(( void )); 121 122 LDAP_F( int ) 123 ldap_pvt_gmtime_unlock LDAP_P(( void )); 124 #endif /* USE_GMTIME_R && USE_LOCALTIME_R */ 125 126 /* Get current time as a structured time */ 127 struct lutil_tm; 128 LDAP_F( void ) 129 ldap_pvt_gettime LDAP_P(( struct lutil_tm * )); 130 131 #ifdef _WIN32 132 #define gettimeofday(tv,tz) ldap_pvt_gettimeofday(tv,tz) 133 struct timeval; 134 LDAP_F( int ) 135 ldap_pvt_gettimeofday LDAP_P(( struct timeval *tv, void *unused )); 136 #ifndef CLOCK_REALTIME 137 #define CLOCK_REALTIME 0 138 #endif 139 #define clock_gettime(clkid,tv) ldap_pvt_clock_gettime(clkid,tv) 140 struct timespec; 141 LDAP_F( int ) 142 ldap_pvt_clock_gettime LDAP_P(( int clkid, struct timespec *tv )); 143 #endif 144 145 /* use this macro to allocate buffer for ldap_pvt_csnstr */ 146 #define LDAP_PVT_CSNSTR_BUFSIZE 64 147 LDAP_F( size_t ) 148 ldap_pvt_csnstr( char *buf, size_t len, unsigned int replica, unsigned int mod ); 149 150 LDAP_F( char *) ldap_pvt_get_fqdn LDAP_P(( char * )); 151 152 struct hostent; /* avoid pulling in <netdb.h> */ 153 154 LDAP_F( int ) 155 ldap_pvt_gethostbyname_a LDAP_P(( 156 const char *name, 157 struct hostent *resbuf, 158 char **buf, 159 struct hostent **result, 160 int *herrno_ptr )); 161 162 LDAP_F( int ) 163 ldap_pvt_gethostbyaddr_a LDAP_P(( 164 const char *addr, 165 int len, 166 int type, 167 struct hostent *resbuf, 168 char **buf, 169 struct hostent **result, 170 int *herrno_ptr )); 171 172 struct sockaddr; 173 174 LDAP_F( int ) 175 ldap_pvt_get_hname LDAP_P(( 176 const struct sockaddr * sa, 177 int salen, 178 char *name, 179 int namelen, 180 char **herr )); 181 182 #ifdef LDAP_PF_LOCAL 183 #define LDAP_IPADDRLEN (MAXPATHLEN + sizeof("PATH=")) 184 #elif defined(LDAP_PF_INET6) 185 #define LDAP_IPADDRLEN sizeof("IP=[ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]:65535") 186 #else 187 #define LDAP_IPADDRLEN sizeof("IP=255.255.255.255:65336") 188 #endif 189 190 typedef union Sockaddr Sockaddr; 191 192 LDAP_F (void) 193 ldap_pvt_sockaddrstr LDAP_P(( 194 Sockaddr *sa, 195 struct berval * )); 196 197 198 /* charray.c */ 199 200 LDAP_F( int ) 201 ldap_charray_add LDAP_P(( 202 char ***a, 203 const char *s )); 204 205 LDAP_F( int ) 206 ldap_charray_merge LDAP_P(( 207 char ***a, 208 char **s )); 209 210 LDAP_F( void ) 211 ldap_charray_free LDAP_P(( char **a )); 212 213 LDAP_F( int ) 214 ldap_charray_inlist LDAP_P(( 215 char **a, 216 const char *s )); 217 218 LDAP_F( char ** ) 219 ldap_charray_dup LDAP_P(( char **a )); 220 221 LDAP_F( char ** ) 222 ldap_str2charray LDAP_P(( 223 const char *str, 224 const char *brkstr )); 225 226 LDAP_F( char * ) 227 ldap_charray2str LDAP_P(( 228 char **array, const char* sep )); 229 230 /* getdn.c */ 231 232 #ifdef LDAP_AVA_NULL /* in ldap.h */ 233 LDAP_F( void ) ldap_rdnfree_x LDAP_P(( LDAPRDN rdn, void *ctx )); 234 LDAP_F( void ) ldap_dnfree_x LDAP_P(( LDAPDN dn, void *ctx )); 235 236 LDAP_F( int ) ldap_bv2dn_x LDAP_P(( 237 struct berval *bv, LDAPDN *dn, unsigned flags, void *ctx )); 238 LDAP_F( int ) ldap_dn2bv_x LDAP_P(( 239 LDAPDN dn, struct berval *bv, unsigned flags, void *ctx )); 240 LDAP_F( int ) ldap_bv2rdn_x LDAP_P(( 241 struct berval *, LDAPRDN *, char **, unsigned flags, void *ctx )); 242 LDAP_F( int ) ldap_rdn2bv_x LDAP_P(( 243 LDAPRDN rdn, struct berval *bv, unsigned flags, void *ctx )); 244 #endif /* LDAP_AVA_NULL */ 245 246 /* url.c */ 247 LDAP_F (void) ldap_pvt_hex_unescape LDAP_P(( char *s )); 248 249 /* 250 * these macros assume 'x' is an ASCII x 251 * and assume the "C" locale 252 */ 253 #define LDAP_ASCII(c) (!((c) & 0x80)) 254 #define LDAP_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n') 255 #define LDAP_DIGIT(c) ((c) >= '0' && (c) <= '9') 256 #define LDAP_LOWER(c) ((c) >= 'a' && (c) <= 'z') 257 #define LDAP_UPPER(c) ((c) >= 'A' && (c) <= 'Z') 258 #define LDAP_ALPHA(c) (LDAP_LOWER(c) || LDAP_UPPER(c)) 259 #define LDAP_ALNUM(c) (LDAP_ALPHA(c) || LDAP_DIGIT(c)) 260 261 #define LDAP_LDH(c) (LDAP_ALNUM(c) || (c) == '-') 262 263 #define LDAP_HEXLOWER(c) ((c) >= 'a' && (c) <= 'f') 264 #define LDAP_HEXUPPER(c) ((c) >= 'A' && (c) <= 'F') 265 #define LDAP_HEX(c) (LDAP_DIGIT(c) || \ 266 LDAP_HEXLOWER(c) || LDAP_HEXUPPER(c)) 267 268 /* controls.c */ 269 struct ldapcontrol; 270 LDAP_F (int) 271 ldap_pvt_put_control LDAP_P(( 272 const struct ldapcontrol *c, 273 BerElement *ber )); 274 LDAP_F (int) ldap_pvt_get_controls LDAP_P(( 275 BerElement *be, 276 struct ldapcontrol ***ctrlsp)); 277 278 #ifdef HAVE_CYRUS_SASL 279 /* cyrus.c */ 280 struct sasl_security_properties; /* avoid pulling in <sasl.h> */ 281 LDAP_F (int) ldap_pvt_sasl_secprops LDAP_P(( 282 const char *in, 283 struct sasl_security_properties *secprops )); 284 LDAP_F (void) ldap_pvt_sasl_secprops_unparse LDAP_P(( 285 struct sasl_security_properties *secprops, 286 struct berval *out )); 287 288 LDAP_F (void *) ldap_pvt_sasl_mutex_new LDAP_P((void)); 289 LDAP_F (int) ldap_pvt_sasl_mutex_lock LDAP_P((void *mutex)); 290 LDAP_F (int) ldap_pvt_sasl_mutex_unlock LDAP_P((void *mutex)); 291 LDAP_F (void) ldap_pvt_sasl_mutex_dispose LDAP_P((void *mutex)); 292 293 LDAP_F (int) ldap_pvt_sasl_cbinding_parse LDAP_P(( const char *arg )); 294 LDAP_F (void *) ldap_pvt_sasl_cbinding LDAP_P(( void *ssl, int type, 295 int is_server )); 296 #endif /* HAVE_CYRUS_SASL */ 297 298 struct sockbuf; /* avoid pulling in <lber.h> */ 299 LDAP_F (int) ldap_pvt_sasl_install LDAP_P(( struct sockbuf *, void * )); 300 LDAP_F (void) ldap_pvt_sasl_remove LDAP_P(( struct sockbuf * )); 301 302 LDAP_F (int) ldap_pvt_tls_check_hostname LDAP_P(( LDAP *, void *, const char *)); 303 304 305 /* 306 * SASL encryption support for LBER Sockbufs 307 */ 308 309 struct sb_sasl_generic_data; 310 311 struct sb_sasl_generic_ops { 312 void (*init)(struct sb_sasl_generic_data *p, 313 ber_len_t *min_send, 314 ber_len_t *max_send, 315 ber_len_t *max_recv); 316 ber_int_t (*encode)(struct sb_sasl_generic_data *p, 317 unsigned char *buf, 318 ber_len_t len, 319 Sockbuf_Buf *dst); 320 ber_int_t (*decode)(struct sb_sasl_generic_data *p, 321 const Sockbuf_Buf *src, 322 Sockbuf_Buf *dst); 323 void (*reset_buf)(struct sb_sasl_generic_data *p, 324 Sockbuf_Buf *buf); 325 void (*fini)(struct sb_sasl_generic_data *p); 326 }; 327 328 struct sb_sasl_generic_install { 329 const struct sb_sasl_generic_ops *ops; 330 void *ops_private; 331 }; 332 333 struct sb_sasl_generic_data { 334 const struct sb_sasl_generic_ops *ops; 335 void *ops_private; 336 Sockbuf_IO_Desc *sbiod; 337 ber_len_t min_send; 338 ber_len_t max_send; 339 ber_len_t max_recv; 340 Sockbuf_Buf sec_buf_in; 341 Sockbuf_Buf buf_in; 342 Sockbuf_Buf buf_out; 343 unsigned int flags; 344 #define LDAP_PVT_SASL_PARTIAL_WRITE 1 345 }; 346 347 #ifndef LDAP_PVT_SASL_LOCAL_SSF 348 #define LDAP_PVT_SASL_LOCAL_SSF 71 /* SSF for Unix Domain Sockets */ 349 #endif /* ! LDAP_PVT_SASL_LOCAL_SSF */ 350 351 struct ldap; 352 struct ldapmsg; 353 struct ldifrecord; 354 355 /* abandon */ 356 LDAP_F ( int ) ldap_pvt_discard LDAP_P(( 357 struct ldap *ld, ber_int_t msgid )); 358 359 /* init.c */ 360 LDAP_F( int ) 361 ldap_pvt_conf_option LDAP_P(( 362 char *cmd, char *opt, int userconf )); 363 364 /* ldifutil.c */ 365 LDAP_F( int ) 366 ldap_parse_ldif_record_x LDAP_P(( 367 struct berval *rbuf, 368 unsigned long linenum, 369 struct ldifrecord *lr, 370 const char *errstr, 371 unsigned int flags, 372 void *ctx )); 373 374 /* messages.c */ 375 LDAP_F( BerElement * ) 376 ldap_get_message_ber LDAP_P(( 377 struct ldapmsg * )); 378 379 /* open */ 380 LDAP_F (int) ldap_open_internal_connection LDAP_P(( 381 struct ldap **ldp, ber_socket_t *fdp )); 382 383 /* sasl.c */ 384 LDAP_F (int) ldap_pvt_sasl_generic_install LDAP_P(( Sockbuf *sb, 385 struct sb_sasl_generic_install *install_arg )); 386 LDAP_F (void) ldap_pvt_sasl_generic_remove LDAP_P(( Sockbuf *sb )); 387 388 /* search.c */ 389 LDAP_F( int ) ldap_pvt_put_filter LDAP_P(( 390 BerElement *ber, 391 const char *str )); 392 393 LDAP_F( char * ) 394 ldap_pvt_find_wildcard LDAP_P(( const char *s )); 395 396 LDAP_F( ber_slen_t ) 397 ldap_pvt_filter_value_unescape LDAP_P(( char *filter )); 398 399 LDAP_F( ber_len_t ) 400 ldap_bv2escaped_filter_value_len LDAP_P(( struct berval *in )); 401 402 LDAP_F( int ) 403 ldap_bv2escaped_filter_value_x LDAP_P(( struct berval *in, struct berval *out, 404 int inplace, void *ctx )); 405 406 LDAP_F (int) ldap_pvt_search LDAP_P(( 407 struct ldap *ld, 408 LDAP_CONST char *base, 409 int scope, 410 LDAP_CONST char *filter, 411 char **attrs, 412 int attrsonly, 413 struct ldapcontrol **sctrls, 414 struct ldapcontrol **cctrls, 415 struct timeval *timeout, 416 int sizelimit, 417 int deref, 418 int *msgidp )); 419 420 LDAP_F(int) ldap_pvt_search_s LDAP_P(( 421 struct ldap *ld, 422 LDAP_CONST char *base, 423 int scope, 424 LDAP_CONST char *filter, 425 char **attrs, 426 int attrsonly, 427 struct ldapcontrol **sctrls, 428 struct ldapcontrol **cctrls, 429 struct timeval *timeout, 430 int sizelimit, 431 int deref, 432 struct ldapmsg **res )); 433 434 /* string.c */ 435 LDAP_F( char * ) 436 ldap_pvt_str2upper LDAP_P(( char *str )); 437 438 LDAP_F( char * ) 439 ldap_pvt_str2lower LDAP_P(( char *str )); 440 441 LDAP_F( struct berval * ) 442 ldap_pvt_str2upperbv LDAP_P(( char *str, struct berval *bv )); 443 444 LDAP_F( struct berval * ) 445 ldap_pvt_str2lowerbv LDAP_P(( char *str, struct berval *bv )); 446 447 /* tls.c */ 448 LDAP_F (int) ldap_pvt_tls_config LDAP_P(( struct ldap *ld, 449 int option, const char *arg )); 450 LDAP_F (int) ldap_pvt_tls_get_option LDAP_P(( struct ldap *ld, 451 int option, void *arg )); 452 LDAP_F (int) ldap_pvt_tls_set_option LDAP_P(( struct ldap *ld, 453 int option, void *arg )); 454 455 LDAP_F (void) ldap_pvt_tls_destroy LDAP_P(( void )); 456 LDAP_F (int) ldap_pvt_tls_init LDAP_P(( int do_threads )); 457 LDAP_F (int) ldap_pvt_tls_init_def_ctx LDAP_P(( int is_server )); 458 LDAP_F (int) ldap_pvt_tls_accept LDAP_P(( Sockbuf *sb, void *ctx_arg )); 459 LDAP_F (int) ldap_pvt_tls_connect LDAP_P(( struct ldap *ld, Sockbuf *sb, const char *host )); 460 LDAP_F (int) ldap_pvt_tls_inplace LDAP_P(( Sockbuf *sb )); 461 LDAP_F (void *) ldap_pvt_tls_sb_ctx LDAP_P(( Sockbuf *sb )); 462 LDAP_F (void) ldap_pvt_tls_ctx_free LDAP_P(( void * )); 463 464 typedef int LDAPDN_rewrite_dummy LDAP_P (( void *dn, unsigned flags )); 465 466 typedef int (LDAP_TLS_CONNECT_CB) LDAP_P (( struct ldap *ld, void *ssl, 467 void *ctx, void *arg )); 468 469 LDAP_F (int) ldap_pvt_tls_get_my_dn LDAP_P(( void *ctx, struct berval *dn, 470 LDAPDN_rewrite_dummy *func, unsigned flags )); 471 LDAP_F (int) ldap_pvt_tls_get_peer_dn LDAP_P(( void *ctx, struct berval *dn, 472 LDAPDN_rewrite_dummy *func, unsigned flags )); 473 LDAP_F (int) ldap_pvt_tls_get_strength LDAP_P(( void *ctx )); 474 LDAP_F (int) ldap_pvt_tls_get_unique LDAP_P(( void *ctx, struct berval *buf, int is_server )); 475 LDAP_F (int) ldap_pvt_tls_get_endpoint LDAP_P(( void *ctx, struct berval *buf, int is_server )); 476 LDAP_F (const char *) ldap_pvt_tls_get_version LDAP_P(( void *ctx )); 477 LDAP_F (const char *) ldap_pvt_tls_get_cipher LDAP_P(( void *ctx )); 478 479 LDAP_END_DECL 480 481 /* 482 * Multiple precision stuff 483 * 484 * May use OpenSSL's BIGNUM if built with TLS, 485 * or GNU's multiple precision library. But if 486 * long long is available, that's big enough 487 * and much more efficient. 488 * 489 * If none is available, unsigned long data is used. 490 */ 491 492 LDAP_BEGIN_DECL 493 494 #ifdef USE_MP_BIGNUM 495 /* 496 * Use OpenSSL's BIGNUM 497 */ 498 #include <openssl/crypto.h> 499 #include <openssl/bn.h> 500 501 typedef BIGNUM* ldap_pvt_mp_t; 502 #define LDAP_PVT_MP_INIT (NULL) 503 504 #define ldap_pvt_mp_init(mp) \ 505 do { (mp) = BN_new(); } while (0) 506 507 /* FIXME: we rely on mpr being initialized */ 508 #define ldap_pvt_mp_init_set(mpr,mpv) \ 509 do { ldap_pvt_mp_init((mpr)); BN_add((mpr), (mpr), (mpv)); } while (0) 510 511 #define ldap_pvt_mp_add(mpr,mpv) \ 512 BN_add((mpr), (mpr), (mpv)) 513 514 #define ldap_pvt_mp_add_ulong(mp,v) \ 515 BN_add_word((mp), (v)) 516 517 #define ldap_pvt_mp_clear(mp) \ 518 do { BN_free((mp)); (mp) = 0; } while (0) 519 520 #elif defined(USE_MP_GMP) 521 /* 522 * Use GNU's multiple precision library 523 */ 524 #include <gmp.h> 525 526 typedef mpz_t ldap_pvt_mp_t; 527 #define LDAP_PVT_MP_INIT { 0 } 528 529 #define ldap_pvt_mp_init(mp) \ 530 mpz_init((mp)) 531 532 #define ldap_pvt_mp_init_set(mpr,mpv) \ 533 mpz_init_set((mpr), (mpv)) 534 535 #define ldap_pvt_mp_add(mpr,mpv) \ 536 mpz_add((mpr), (mpr), (mpv)) 537 538 #define ldap_pvt_mp_add_ulong(mp,v) \ 539 mpz_add_ui((mp), (mp), (v)) 540 541 #define ldap_pvt_mp_clear(mp) \ 542 mpz_clear((mp)) 543 544 #else 545 /* 546 * Use unsigned long long 547 */ 548 549 #ifdef USE_MP_LONG_LONG 550 typedef unsigned long long ldap_pvt_mp_t; 551 #define LDAP_PVT_MP_INIT (0LL) 552 #elif defined(USE_MP_LONG) 553 typedef unsigned long ldap_pvt_mp_t; 554 #define LDAP_PVT_MP_INIT (0L) 555 #elif defined(HAVE_LONG_LONG) 556 typedef unsigned long long ldap_pvt_mp_t; 557 #define LDAP_PVT_MP_INIT (0LL) 558 #else 559 typedef unsigned long ldap_pvt_mp_t; 560 #define LDAP_PVT_MP_INIT (0L) 561 #endif 562 563 #define ldap_pvt_mp_init(mp) \ 564 do { (mp) = 0; } while (0) 565 566 #define ldap_pvt_mp_init_set(mpr,mpv) \ 567 do { (mpr) = (mpv); } while (0) 568 569 #define ldap_pvt_mp_add(mpr,mpv) \ 570 do { (mpr) += (mpv); } while (0) 571 572 #define ldap_pvt_mp_add_ulong(mp,v) \ 573 do { (mp) += (v); } while (0) 574 575 #define ldap_pvt_mp_clear(mp) \ 576 do { (mp) = 0; } while (0) 577 578 #endif /* MP */ 579 580 #include "ldap_pvt_uc.h" 581 582 LDAP_END_DECL 583 584 LDAP_BEGIN_DECL 585 586 #include <limits.h> /* get CHAR_BIT */ 587 588 /* Buffer space for sign, decimal digits and \0. Note: log10(2) < 146/485. */ 589 #define LDAP_PVT_INTTYPE_CHARS(type) (((sizeof(type)*CHAR_BIT-1)*146)/485 + 3) 590 591 LDAP_END_DECL 592 593 #endif /* _LDAP_PVT_H */ 594