Make master build on Windows
Add strtoll()/strtoull() to lib/roken Add stdint.h to lib/roken (Windows only) Add logic to detect whether to use lib/roken's stdint.h based on Visual Studio version Add include of stdint.h in generated ASN.1 code Export missing symbols for 64-bit integers in lib/asn1 Export missing symbols for FAST Add missing sources to kdc/NTMakefile Fix issue in kuserok Fix bsearch issues
This commit is contained in:
@@ -37,6 +37,7 @@ INCFILES=$(INCDIR)\heimbase.h
|
|||||||
|
|
||||||
libheimbase_OBJS = \
|
libheimbase_OBJS = \
|
||||||
$(OBJ)\array.obj \
|
$(OBJ)\array.obj \
|
||||||
|
$(OBJ)\bsearch.obj \
|
||||||
$(OBJ)\bool.obj \
|
$(OBJ)\bool.obj \
|
||||||
$(OBJ)\dict.obj \
|
$(OBJ)\dict.obj \
|
||||||
$(OBJ)\error.obj \
|
$(OBJ)\error.obj \
|
||||||
|
@@ -33,16 +33,19 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef HAVE_STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
#endif
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <getopt.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file contains functions for binary searching flat text in memory
|
* This file contains functions for binary searching flat text in memory
|
||||||
@@ -267,9 +270,12 @@ bsearch_common(const char *buf, size_t sz, const char *key,
|
|||||||
*location = key_start;
|
*location = key_start;
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (val_len && value) {
|
if (val_len && value) {
|
||||||
*value = strndup(&buf[val_start], val_len);
|
/* Avoid strndup() so we don't need libroken here yet */
|
||||||
|
*value = malloc(val_len + 1);
|
||||||
if (!*value)
|
if (!*value)
|
||||||
ret = errno;
|
ret = errno;
|
||||||
|
(void) memcpy(*value, &buf[val_start], val_len);
|
||||||
|
(*value)[val_len] = '\0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -376,7 +382,11 @@ __bsearch_file_open(const char *fname, size_t max_sz, size_t page_sz,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (page_sz == 0)
|
if (page_sz == 0)
|
||||||
|
#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
|
||||||
page_sz = st.st_blksize;
|
page_sz = st.st_blksize;
|
||||||
|
#else
|
||||||
|
page_sz = 4096;
|
||||||
|
#endif
|
||||||
for (i = page_sz; i; i >>= 1) {
|
for (i = page_sz; i; i >>= 1) {
|
||||||
/* Make sure page_sz is a power of two */
|
/* Make sure page_sz is a power of two */
|
||||||
if ((i % 2) && (i >> 1)) {
|
if ((i % 2) && (i >> 1)) {
|
||||||
|
@@ -370,6 +370,8 @@ AC_BROKEN([ \
|
|||||||
strsep \
|
strsep \
|
||||||
strsep_copy \
|
strsep_copy \
|
||||||
strtok_r \
|
strtok_r \
|
||||||
|
strtoll \
|
||||||
|
strtoull \
|
||||||
strupr \
|
strupr \
|
||||||
swab \
|
swab \
|
||||||
tsearch \
|
tsearch \
|
||||||
@@ -391,6 +393,14 @@ AM_CONDITIONAL(have_fnmatch_h,
|
|||||||
AC_FOREACH([rk_func], [strndup strsep strtok_r],
|
AC_FOREACH([rk_func], [strndup strsep strtok_r],
|
||||||
[AC_NEED_PROTO([#include <string.h>], rk_func)])
|
[AC_NEED_PROTO([#include <string.h>], rk_func)])
|
||||||
|
|
||||||
|
AC_CHECK_FUNC([strtoll],
|
||||||
|
[AC_DEFINE_UNQUOTED(HAVE_STRTOLL, 1,
|
||||||
|
[Define if you have the function strtoll.])])
|
||||||
|
|
||||||
|
AC_CHECK_FUNC([strtoull],
|
||||||
|
[AC_DEFINE_UNQUOTED(HAVE_STRTOULL, 1,
|
||||||
|
[Define if you have the function strtoull.])])
|
||||||
|
|
||||||
AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
|
AC_FOREACH([rk_func], [strsvis strsvisx strunvis strvis strvisx svis unvis vis],
|
||||||
[AC_NEED_PROTO([#ifdef HAVE_VIS_H
|
[AC_NEED_PROTO([#ifdef HAVE_VIS_H
|
||||||
#include <vis.h>
|
#include <vis.h>
|
||||||
|
@@ -75,6 +75,8 @@ while(<>) {
|
|||||||
if ("$(ENV_HACK)") { print "#define ENV_HACK 1\n"; }
|
if ("$(ENV_HACK)") { print "#define ENV_HACK 1\n"; }
|
||||||
if ("$(HAVE_KCM)") { print "#define HAVE_KCM 1\n"; }
|
if ("$(HAVE_KCM)") { print "#define HAVE_KCM 1\n"; }
|
||||||
if ("$(HAVE_SCC)") { print "#define HAVE_SCC 1\n"; }
|
if ("$(HAVE_SCC)") { print "#define HAVE_SCC 1\n"; }
|
||||||
|
if ("$(HAVE_STDINT_H)") { print "#define HAVE_STDINT_H 1\n"; }
|
||||||
|
if ("$(HAVE_INT64_T)") { print "#define HAVE_INT64_T 1\n"; }
|
||||||
if ("$(DIR_hdbdir)") { print "#define HDB_DB_DIR \"".'$(DIR_hdbdir)'."\"\n"; }
|
if ("$(DIR_hdbdir)") { print "#define HDB_DB_DIR \"".'$(DIR_hdbdir)'."\"\n"; }
|
||||||
if ("$(HAVE_MSLSA_CACHE)") { print "#define HAVE_MSLSA_CACHE 1\n"; }
|
if ("$(HAVE_MSLSA_CACHE)") { print "#define HAVE_MSLSA_CACHE 1\n"; }
|
||||||
if ("$(NO_LOCALNAME)") { print "#define NO_LOCALNAME 1\n"; }
|
if ("$(NO_LOCALNAME)") { print "#define NO_LOCALNAME 1\n"; }
|
||||||
|
@@ -94,6 +94,7 @@ LIBKDC_OBJS=\
|
|||||||
$(OBJ)\default_config.obj \
|
$(OBJ)\default_config.obj \
|
||||||
$(OBJ)\set_dbinfo.obj \
|
$(OBJ)\set_dbinfo.obj \
|
||||||
$(OBJ)\digest.obj \
|
$(OBJ)\digest.obj \
|
||||||
|
$(OBJ)\fast.obj \
|
||||||
$(OBJ)\kerberos5.obj \
|
$(OBJ)\kerberos5.obj \
|
||||||
$(OBJ)\krb5tgs.obj \
|
$(OBJ)\krb5tgs.obj \
|
||||||
$(OBJ)\pkinit.obj \
|
$(OBJ)\pkinit.obj \
|
||||||
@@ -105,6 +106,7 @@ LIBKDC_OBJS=\
|
|||||||
|
|
||||||
LIBKDC_LIBS=\
|
LIBKDC_LIBS=\
|
||||||
$(LIBHDB) \
|
$(LIBHDB) \
|
||||||
|
$(LIBHEIMBASE) \
|
||||||
$(LIBHEIMDAL) \
|
$(LIBHEIMDAL) \
|
||||||
$(LIBHEIMNTLM) \
|
$(LIBHEIMNTLM) \
|
||||||
$(LIBROKEN)
|
$(LIBROKEN)
|
||||||
@@ -124,6 +126,7 @@ libkdc_la_SOURCES = \
|
|||||||
default_config.c \
|
default_config.c \
|
||||||
set_dbinfo.c \
|
set_dbinfo.c \
|
||||||
digest.c \
|
digest.c \
|
||||||
|
fast.c \
|
||||||
kdc_locl.h \
|
kdc_locl.h \
|
||||||
kerberos5.c \
|
kerberos5.c \
|
||||||
krb5tgs.c \
|
krb5tgs.c \
|
||||||
|
@@ -4,6 +4,8 @@ include $(top_srcdir)/Makefile.am.common
|
|||||||
|
|
||||||
YFLAGS = -d -t
|
YFLAGS = -d -t
|
||||||
|
|
||||||
|
AM_CPPFLAGS += $(ROKEN_RENAME)
|
||||||
|
|
||||||
lib_LTLIBRARIES = libasn1.la
|
lib_LTLIBRARIES = libasn1.la
|
||||||
libasn1_la_LDFLAGS = -version-info 8:0:0
|
libasn1_la_LDFLAGS = -version-info 8:0:0
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
RELDIR=lib\asn1
|
RELDIR=lib\asn1
|
||||||
|
|
||||||
intcflags=-I$(SRCDIR) -I$(OBJ)
|
intcflags=-I$(SRCDIR) -I$(OBJ) -DROKEN_RENAME
|
||||||
|
|
||||||
!include ../../windows/NTMakefile.w32
|
!include ../../windows/NTMakefile.w32
|
||||||
|
|
||||||
|
@@ -36,6 +36,8 @@
|
|||||||
#ifndef __DER_H__
|
#ifndef __DER_H__
|
||||||
#define __DER_H__
|
#define __DER_H__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ASN1_C_UNIV = 0,
|
ASN1_C_UNIV = 0,
|
||||||
ASN1_C_APPL = 1,
|
ASN1_C_APPL = 1,
|
||||||
|
@@ -264,6 +264,7 @@ init_generate (const char *filename, const char *base)
|
|||||||
"/* Do not edit */\n\n"
|
"/* Do not edit */\n\n"
|
||||||
"#include <stdio.h>\n"
|
"#include <stdio.h>\n"
|
||||||
"#include <stdlib.h>\n"
|
"#include <stdlib.h>\n"
|
||||||
|
"#include <stdint.h>\n"
|
||||||
"#include <time.h>\n"
|
"#include <time.h>\n"
|
||||||
"#include <string.h>\n"
|
"#include <string.h>\n"
|
||||||
"#include <errno.h>\n"
|
"#include <errno.h>\n"
|
||||||
@@ -363,6 +364,7 @@ generate_header_of_codefile(const char *name)
|
|||||||
"#define ASN1_LIB\n\n"
|
"#define ASN1_LIB\n\n"
|
||||||
"#include <stdio.h>\n"
|
"#include <stdio.h>\n"
|
||||||
"#include <stdlib.h>\n"
|
"#include <stdlib.h>\n"
|
||||||
|
"#include <stdint.h>\n"
|
||||||
"#include <time.h>\n"
|
"#include <time.h>\n"
|
||||||
"#include <string.h>\n"
|
"#include <string.h>\n"
|
||||||
"#include <errno.h>\n"
|
"#include <errno.h>\n"
|
||||||
|
@@ -34,6 +34,8 @@
|
|||||||
#ifndef __HEIM_ANY_H__
|
#ifndef __HEIM_ANY_H__
|
||||||
#define __HEIM_ANY_H__ 1
|
#define __HEIM_ANY_H__ 1
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
int encode_heim_any(unsigned char *, size_t, const heim_any *, size_t *);
|
int encode_heim_any(unsigned char *, size_t, const heim_any *, size_t *);
|
||||||
int decode_heim_any(const unsigned char *, size_t, heim_any *, size_t *);
|
int decode_heim_any(const unsigned char *, size_t, heim_any *, size_t *);
|
||||||
void free_heim_any(heim_any *);
|
void free_heim_any(heim_any *);
|
||||||
|
@@ -299,6 +299,8 @@ EXPORTS
|
|||||||
copy_IssuerAndSerialNumber
|
copy_IssuerAndSerialNumber
|
||||||
copy_KDCDHKeyInfo
|
copy_KDCDHKeyInfo
|
||||||
copy_KDCDHKeyInfo_Win2k
|
copy_KDCDHKeyInfo_Win2k
|
||||||
|
copy_KDCFastCookie
|
||||||
|
copy_KDCFastState
|
||||||
copy_KDCOptions
|
copy_KDCOptions
|
||||||
copy_KDC_REP
|
copy_KDC_REP
|
||||||
copy_KDC_REQ
|
copy_KDC_REQ
|
||||||
@@ -551,6 +553,8 @@ EXPORTS
|
|||||||
decode_IssuerAndSerialNumber
|
decode_IssuerAndSerialNumber
|
||||||
decode_KDCDHKeyInfo
|
decode_KDCDHKeyInfo
|
||||||
decode_KDCDHKeyInfo_Win2k
|
decode_KDCDHKeyInfo_Win2k
|
||||||
|
decode_KDCFastCookie
|
||||||
|
decode_KDCFastState
|
||||||
decode_KDCOptions
|
decode_KDCOptions
|
||||||
decode_KDC_REP
|
decode_KDC_REP
|
||||||
decode_KDC_REQ
|
decode_KDC_REQ
|
||||||
@@ -699,6 +703,7 @@ EXPORTS
|
|||||||
der_copy_heim_integer
|
der_copy_heim_integer
|
||||||
der_copy_ia5_string
|
der_copy_ia5_string
|
||||||
der_copy_integer
|
der_copy_integer
|
||||||
|
der_copy_integer64
|
||||||
der_copy_octet_string
|
der_copy_octet_string
|
||||||
der_copy_oid
|
der_copy_oid
|
||||||
der_copy_printable_string
|
der_copy_printable_string
|
||||||
@@ -714,6 +719,7 @@ EXPORTS
|
|||||||
der_free_heim_integer
|
der_free_heim_integer
|
||||||
der_free_ia5_string
|
der_free_ia5_string
|
||||||
der_free_integer
|
der_free_integer
|
||||||
|
der_free_integer64
|
||||||
der_free_octet_string
|
der_free_octet_string
|
||||||
der_free_oid
|
der_free_oid
|
||||||
der_free_printable_string
|
der_free_printable_string
|
||||||
@@ -732,6 +738,7 @@ EXPORTS
|
|||||||
der_get_heim_integer
|
der_get_heim_integer
|
||||||
der_get_ia5_string
|
der_get_ia5_string
|
||||||
der_get_integer
|
der_get_integer
|
||||||
|
der_get_integer64
|
||||||
der_get_length
|
der_get_length
|
||||||
der_get_octet_string
|
der_get_octet_string
|
||||||
der_get_octet_string_ber
|
der_get_octet_string_ber
|
||||||
@@ -763,6 +770,7 @@ EXPORTS
|
|||||||
der_length_heim_integer
|
der_length_heim_integer
|
||||||
der_length_ia5_string
|
der_length_ia5_string
|
||||||
der_length_integer
|
der_length_integer
|
||||||
|
der_length_integer64
|
||||||
der_length_len
|
der_length_len
|
||||||
der_length_octet_string
|
der_length_octet_string
|
||||||
der_length_oid
|
der_length_oid
|
||||||
@@ -789,6 +797,8 @@ EXPORTS
|
|||||||
der_put_heim_integer
|
der_put_heim_integer
|
||||||
der_put_ia5_string
|
der_put_ia5_string
|
||||||
der_put_integer
|
der_put_integer
|
||||||
|
der_put_integer64
|
||||||
|
der_put_integer64
|
||||||
der_put_length
|
der_put_length
|
||||||
der_put_length_and_tag
|
der_put_length_and_tag
|
||||||
der_put_octet_string
|
der_put_octet_string
|
||||||
@@ -911,6 +921,8 @@ EXPORTS
|
|||||||
encode_IssuerAndSerialNumber
|
encode_IssuerAndSerialNumber
|
||||||
encode_KDCDHKeyInfo
|
encode_KDCDHKeyInfo
|
||||||
encode_KDCDHKeyInfo_Win2k
|
encode_KDCDHKeyInfo_Win2k
|
||||||
|
encode_KDCFastCookie
|
||||||
|
encode_KDCFastState
|
||||||
encode_KDCOptions
|
encode_KDCOptions
|
||||||
encode_KDC_REP
|
encode_KDC_REP
|
||||||
encode_KDC_REQ
|
encode_KDC_REQ
|
||||||
@@ -1163,6 +1175,8 @@ EXPORTS
|
|||||||
free_IssuerAndSerialNumber
|
free_IssuerAndSerialNumber
|
||||||
free_KDCDHKeyInfo
|
free_KDCDHKeyInfo
|
||||||
free_KDCDHKeyInfo_Win2k
|
free_KDCDHKeyInfo_Win2k
|
||||||
|
free_KDCFastCookie
|
||||||
|
free_KDCFastState
|
||||||
free_KDCOptions
|
free_KDCOptions
|
||||||
free_KDC_REP
|
free_KDC_REP
|
||||||
free_KDC_REQ
|
free_KDC_REQ
|
||||||
@@ -1426,6 +1440,8 @@ EXPORTS
|
|||||||
length_IssuerAndSerialNumber
|
length_IssuerAndSerialNumber
|
||||||
length_KDCDHKeyInfo
|
length_KDCDHKeyInfo
|
||||||
length_KDCDHKeyInfo_Win2k
|
length_KDCDHKeyInfo_Win2k
|
||||||
|
length_KDCFastCookie
|
||||||
|
length_KDCFastState
|
||||||
length_KDCOptions
|
length_KDCOptions
|
||||||
length_KDC_REP
|
length_KDC_REP
|
||||||
length_KDC_REQ
|
length_KDC_REQ
|
||||||
|
46
lib/asn1/roken_rename.h
Normal file
46
lib/asn1/roken_rename.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 1998 Kungliga Tekniska Högskolan
|
||||||
|
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Neither the name of the Institute nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
#ifndef __roken_rename_h__
|
||||||
|
#define __roken_rename_h__
|
||||||
|
|
||||||
|
#ifndef HAVE_STRTOLL
|
||||||
|
#define strtoll rk_strtoll
|
||||||
|
#endif
|
||||||
|
#ifndef HAVE_STRTOULL
|
||||||
|
#define strtoull rk_strtoull
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __roken_rename_h__ */
|
@@ -37,6 +37,7 @@
|
|||||||
#define _SYMBOL_H
|
#define _SYMBOL_H
|
||||||
|
|
||||||
#include "asn1_queue.h"
|
#include "asn1_queue.h"
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
enum typetype {
|
enum typetype {
|
||||||
TBitString,
|
TBitString,
|
||||||
|
@@ -205,7 +205,7 @@ check_owner_file(krb5_context context,
|
|||||||
* NFSv4 servers do?). Checking the owner means doing an LSARPC
|
* NFSv4 servers do?). Checking the owner means doing an LSARPC
|
||||||
* lookup at least (to get the user's SID).
|
* lookup at least (to get the user's SID).
|
||||||
*/
|
*/
|
||||||
if (is_system_location || owner == NULL)
|
if (owner == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
krb5_set_error_message(context, EACCES,
|
krb5_set_error_message(context, EACCES,
|
||||||
|
@@ -760,6 +760,19 @@ EXPORTS
|
|||||||
krb5_get_init_creds_opt_set_pkinit_user_certs
|
krb5_get_init_creds_opt_set_pkinit_user_certs
|
||||||
krb5_pk_enterprise_cert
|
krb5_pk_enterprise_cert
|
||||||
|
|
||||||
|
krb5_auth_con_getsendsubkey
|
||||||
|
krb5_init_creds_free
|
||||||
|
krb5_init_creds_get
|
||||||
|
krb5_init_creds_get_creds
|
||||||
|
krb5_init_creds_get_error
|
||||||
|
krb5_init_creds_init
|
||||||
|
krb5_init_creds_set_fast_ccache
|
||||||
|
krb5_init_creds_set_keytab
|
||||||
|
krb5_init_creds_set_password
|
||||||
|
krb5_init_creds_set_service
|
||||||
|
krb5_init_creds_store
|
||||||
|
krb5_process_last_request
|
||||||
|
|
||||||
; testing
|
; testing
|
||||||
;! _krb5_aes_cts_encrypt
|
;! _krb5_aes_cts_encrypt
|
||||||
_krb5_n_fold
|
_krb5_n_fold
|
||||||
|
@@ -114,7 +114,6 @@ libroken_la_SOURCES = \
|
|||||||
socket.c \
|
socket.c \
|
||||||
strcollect.c \
|
strcollect.c \
|
||||||
strerror_r.c \
|
strerror_r.c \
|
||||||
strtoll.c \
|
|
||||||
strpool.c \
|
strpool.c \
|
||||||
timeval.c \
|
timeval.c \
|
||||||
tm2time.c \
|
tm2time.c \
|
||||||
|
@@ -99,6 +99,8 @@ libroken_la_OBJS = \
|
|||||||
$(OBJ)\strsep.obj \
|
$(OBJ)\strsep.obj \
|
||||||
$(OBJ)\strsep_copy.obj \
|
$(OBJ)\strsep_copy.obj \
|
||||||
$(OBJ)\strtok_r.obj \
|
$(OBJ)\strtok_r.obj \
|
||||||
|
$(OBJ)\strtoll.obj \
|
||||||
|
$(OBJ)\strtoull.obj \
|
||||||
$(OBJ)\syslogc.obj \
|
$(OBJ)\syslogc.obj \
|
||||||
$(OBJ)\timegm.obj \
|
$(OBJ)\timegm.obj \
|
||||||
$(OBJ)\timeval.obj \
|
$(OBJ)\timeval.obj \
|
||||||
@@ -162,6 +164,10 @@ INCFILES = \
|
|||||||
$(INCDIR)\vis.h \
|
$(INCDIR)\vis.h \
|
||||||
$(INCDIR)\xdbm.h
|
$(INCDIR)\xdbm.h
|
||||||
|
|
||||||
|
#!ifndef HAVE_STDINT_H
|
||||||
|
#INCFILES += $(INCDIR)\stdint.h
|
||||||
|
#!endif
|
||||||
|
|
||||||
clean::
|
clean::
|
||||||
-$(RM) $(XHEADERS)
|
-$(RM) $(XHEADERS)
|
||||||
|
|
||||||
|
@@ -1033,6 +1033,22 @@ ROKEN_LIB_FUNCTION struct tm * ROKEN_LIB_CALL
|
|||||||
localtime_r(const time_t *, struct tm *);
|
localtime_r(const time_t *, struct tm *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(HAVE_STRTOLL) || defined(NEED_STRTOLL_PROTO)
|
||||||
|
#ifndef HAVE_STRTOLL
|
||||||
|
#define strtoll rk_strtoll
|
||||||
|
#endif
|
||||||
|
ROKEN_LIB_FUNCTION long long ROKEN_LIB_CALL
|
||||||
|
strtoll(const char * __restrict nptr, char ** __restrict endptr, int base);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(HAVE_STRTOULL) || defined(NEED_STRTOULL_PROTO)
|
||||||
|
#ifndef HAVE_STRTOULL
|
||||||
|
#define strtoull rk_strtoull
|
||||||
|
#endif
|
||||||
|
ROKEN_LIB_FUNCTION unsigned long long ROKEN_LIB_CALL
|
||||||
|
strtoull(const char * __restrict nptr, char ** __restrict endptr, int base);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_STRSVIS) || defined(NEED_STRSVIS_PROTO)
|
#if !defined(HAVE_STRSVIS) || defined(NEED_STRSVIS_PROTO)
|
||||||
#ifndef HAVE_STRSVIS
|
#ifndef HAVE_STRSVIS
|
||||||
#define strsvis rk_strsvis
|
#define strsvis rk_strsvis
|
||||||
|
15
lib/roken/stdint.hin
Normal file
15
lib/roken/stdint.hin
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#ifndef _STDINT_H
|
||||||
|
#define _STDINT_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef long long int64_t;
|
||||||
|
typedef unsigned long long uint64_t;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _STDINT_H */
|
@@ -1,6 +1,11 @@
|
|||||||
/*-
|
/*
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
* The Regents of the University of California. All rights reserved.
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 The FreeBSD Foundation
|
||||||
|
* All rights reserved.
|
||||||
|
* Portions of this software were developed by David Chisnall
|
||||||
|
* under sponsorship from the FreeBSD Foundation.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -27,26 +32,19 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if 1
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "roken.h"
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
|
|
||||||
#else
|
#include <string.h>
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
|
||||||
static char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93";
|
#include "roken.h"
|
||||||
#endif /* LIBC_SCCS and not lint */
|
|
||||||
#include <sys/cdefs.h>
|
/* #include <sys/cdefs.h> */
|
||||||
__FBSDID("$FreeBSD$");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
ROKEN_LIB_FUNCTION long long ROKEN_LIB_CALL
|
|
||||||
rk_strtoll(const char * __restrict nptr, char ** __restrict endptr, int base);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert a string to a long long integer.
|
* Convert a string to a long long integer.
|
||||||
@@ -54,98 +52,98 @@ rk_strtoll(const char * __restrict nptr, char ** __restrict endptr, int base);
|
|||||||
* Assumes that the upper and lower case
|
* Assumes that the upper and lower case
|
||||||
* alphabets and digits are each contiguous.
|
* alphabets and digits are each contiguous.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ROKEN_LIB_FUNCTION long long ROKEN_LIB_CALL
|
ROKEN_LIB_FUNCTION long long ROKEN_LIB_CALL
|
||||||
rk_strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
|
strtoll(const char * __restrict nptr, char ** __restrict endptr, int base)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
unsigned long long acc;
|
unsigned long long acc;
|
||||||
char c;
|
char c;
|
||||||
unsigned long long cutoff;
|
unsigned long long cutoff;
|
||||||
int neg, any, cutlim;
|
int neg, any, cutlim;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip white space and pick up leading +/- sign if any.
|
* Skip white space and pick up leading +/- sign if any.
|
||||||
* If base is 0, allow 0x for hex and 0 for octal, else
|
* If base is 0, allow 0x for hex and 0 for octal, else
|
||||||
* assume decimal; if base is already 16, allow 0x.
|
* assume decimal; if base is already 16, allow 0x.
|
||||||
*/
|
*/
|
||||||
s = nptr;
|
s = nptr;
|
||||||
do {
|
do {
|
||||||
c = *s++;
|
c = *s++;
|
||||||
} while (isspace((unsigned char)c));
|
} while (isspace((unsigned char)c));
|
||||||
if (c == '-') {
|
if (c == '-') {
|
||||||
neg = 1;
|
neg = 1;
|
||||||
c = *s++;
|
c = *s++;
|
||||||
} else {
|
} else {
|
||||||
neg = 0;
|
neg = 0;
|
||||||
if (c == '+')
|
if (c == '+')
|
||||||
c = *s++;
|
c = *s++;
|
||||||
}
|
}
|
||||||
if ((base == 0 || base == 16) &&
|
if ((base == 0 || base == 16) &&
|
||||||
c == '0' && (*s == 'x' || *s == 'X') &&
|
c == '0' && (*s == 'x' || *s == 'X') &&
|
||||||
((s[1] >= '0' && s[1] <= '9') ||
|
((s[1] >= '0' && s[1] <= '9') ||
|
||||||
(s[1] >= 'A' && s[1] <= 'F') ||
|
(s[1] >= 'A' && s[1] <= 'F') ||
|
||||||
(s[1] >= 'a' && s[1] <= 'f'))) {
|
(s[1] >= 'a' && s[1] <= 'f'))) {
|
||||||
c = s[1];
|
c = s[1];
|
||||||
s += 2;
|
s += 2;
|
||||||
base = 16;
|
base = 16;
|
||||||
}
|
}
|
||||||
if (base == 0)
|
if (base == 0)
|
||||||
base = c == '0' ? 8 : 10;
|
base = c == '0' ? 8 : 10;
|
||||||
acc = any = 0;
|
acc = any = 0;
|
||||||
if (base < 2 || base > 36)
|
if (base < 2 || base > 36)
|
||||||
goto noconv;
|
goto noconv;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compute the cutoff value between legal numbers and illegal
|
* Compute the cutoff value between legal numbers and illegal
|
||||||
* numbers. That is the largest legal value, divided by the
|
* numbers. That is the largest legal value, divided by the
|
||||||
* base. An input number that is greater than this value, if
|
* base. An input number that is greater than this value, if
|
||||||
* followed by a legal input character, is too big. One that
|
* followed by a legal input character, is too big. One that
|
||||||
* is equal to this value may be valid or not; the limit
|
* is equal to this value may be valid or not; the limit
|
||||||
* between valid and invalid numbers is then based on the last
|
* between valid and invalid numbers is then based on the last
|
||||||
* digit. For instance, if the range for quads is
|
* digit. For instance, if the range for quads is
|
||||||
* [-9223372036854775808..9223372036854775807] and the input base
|
* [-9223372036854775808..9223372036854775807] and the input base
|
||||||
* is 10, cutoff will be set to 922337203685477580 and cutlim to
|
* is 10, cutoff will be set to 922337203685477580 and cutlim to
|
||||||
* either 7 (neg==0) or 8 (neg==1), meaning that if we have
|
* either 7 (neg==0) or 8 (neg==1), meaning that if we have
|
||||||
* accumulated a value > 922337203685477580, or equal but the
|
* accumulated a value > 922337203685477580, or equal but the
|
||||||
* next digit is > 7 (or 8), the number is too big, and we will
|
* next digit is > 7 (or 8), the number is too big, and we will
|
||||||
* return a range error.
|
* return a range error.
|
||||||
*
|
*
|
||||||
* Set 'any' if any `digits' consumed; make it negative to indicate
|
* Set 'any' if any `digits' consumed; make it negative to indicate
|
||||||
* overflow.
|
* overflow.
|
||||||
*/
|
*/
|
||||||
cutoff = neg ? (unsigned long long)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX
|
cutoff = neg ? (unsigned long long)-(LLONG_MIN + LLONG_MAX) + LLONG_MAX
|
||||||
: LLONG_MAX;
|
: LLONG_MAX;
|
||||||
cutlim = cutoff % base;
|
cutlim = cutoff % base;
|
||||||
cutoff /= base;
|
cutoff /= base;
|
||||||
for ( ; ; c = *s++) {
|
for ( ; ; c = *s++) {
|
||||||
if (c >= '0' && c <= '9')
|
if (c >= '0' && c <= '9')
|
||||||
c -= '0';
|
c -= '0';
|
||||||
else if (c >= 'A' && c <= 'Z')
|
else if (c >= 'A' && c <= 'Z')
|
||||||
c -= 'A' - 10;
|
c -= 'A' - 10;
|
||||||
else if (c >= 'a' && c <= 'z')
|
else if (c >= 'a' && c <= 'z')
|
||||||
c -= 'a' - 10;
|
c -= 'a' - 10;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
if (c >= base)
|
if (c >= base)
|
||||||
break;
|
break;
|
||||||
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
||||||
any = -1;
|
any = -1;
|
||||||
else {
|
else {
|
||||||
any = 1;
|
any = 1;
|
||||||
acc *= base;
|
acc *= base;
|
||||||
acc += c;
|
acc += c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (any < 0) {
|
if (any < 0) {
|
||||||
acc = neg ? LLONG_MIN : LLONG_MAX;
|
acc = neg ? LLONG_MIN : LLONG_MAX;
|
||||||
errno = ERANGE;
|
errno = ERANGE;
|
||||||
} else if (!any) {
|
} else if (!any) {
|
||||||
noconv:
|
noconv:
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
} else if (neg)
|
} else if (neg)
|
||||||
acc = -acc;
|
acc = -acc;
|
||||||
if (endptr != NULL)
|
if (endptr != NULL)
|
||||||
*endptr = (char *)(any ? s - 1 : nptr);
|
*endptr = (char *)(any ? s - 1 : nptr);
|
||||||
return (acc);
|
return (acc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
127
lib/roken/strtoull.c
Normal file
127
lib/roken/strtoull.c
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
/*-
|
||||||
|
* Copyright (c) 1992, 1993
|
||||||
|
* The Regents of the University of California. All rights reserved.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2011 The FreeBSD Foundation
|
||||||
|
* All rights reserved.
|
||||||
|
* Portions of this software were developed by David Chisnall
|
||||||
|
* under sponsorship from the FreeBSD Foundation.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
* may be used to endorse or promote products derived from this software
|
||||||
|
* without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
|
* SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "roken.h"
|
||||||
|
|
||||||
|
/* #include <sys/cdefs.h> */
|
||||||
|
|
||||||
|
#include <limits.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Convert a string to an unsigned long long integer.
|
||||||
|
*
|
||||||
|
* Assumes that the upper and lower case
|
||||||
|
* alphabets and digits are each contiguous.
|
||||||
|
*/
|
||||||
|
ROKEN_LIB_FUNCTION unsigned long long ROKEN_LIB_CALL
|
||||||
|
strtoull(const char * __restrict nptr, char ** __restrict endptr, int base)
|
||||||
|
{
|
||||||
|
const char *s;
|
||||||
|
unsigned long long acc;
|
||||||
|
char c;
|
||||||
|
unsigned long long cutoff;
|
||||||
|
int neg, any, cutlim;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* See strtoq for comments as to the logic used.
|
||||||
|
*/
|
||||||
|
s = nptr;
|
||||||
|
do {
|
||||||
|
c = *s++;
|
||||||
|
} while (isspace((unsigned char)c));
|
||||||
|
if (c == '-') {
|
||||||
|
neg = 1;
|
||||||
|
c = *s++;
|
||||||
|
} else {
|
||||||
|
neg = 0;
|
||||||
|
if (c == '+')
|
||||||
|
c = *s++;
|
||||||
|
}
|
||||||
|
if ((base == 0 || base == 16) &&
|
||||||
|
c == '0' && (*s == 'x' || *s == 'X') &&
|
||||||
|
((s[1] >= '0' && s[1] <= '9') ||
|
||||||
|
(s[1] >= 'A' && s[1] <= 'F') ||
|
||||||
|
(s[1] >= 'a' && s[1] <= 'f'))) {
|
||||||
|
c = s[1];
|
||||||
|
s += 2;
|
||||||
|
base = 16;
|
||||||
|
}
|
||||||
|
if (base == 0)
|
||||||
|
base = c == '0' ? 8 : 10;
|
||||||
|
acc = any = 0;
|
||||||
|
if (base < 2 || base > 36)
|
||||||
|
goto noconv;
|
||||||
|
|
||||||
|
cutoff = ULLONG_MAX / base;
|
||||||
|
cutlim = ULLONG_MAX % base;
|
||||||
|
for ( ; ; c = *s++) {
|
||||||
|
if (c >= '0' && c <= '9')
|
||||||
|
c -= '0';
|
||||||
|
else if (c >= 'A' && c <= 'Z')
|
||||||
|
c -= 'A' - 10;
|
||||||
|
else if (c >= 'a' && c <= 'z')
|
||||||
|
c -= 'a' - 10;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
if (c >= base)
|
||||||
|
break;
|
||||||
|
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
||||||
|
any = -1;
|
||||||
|
else {
|
||||||
|
any = 1;
|
||||||
|
acc *= base;
|
||||||
|
acc += c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (any < 0) {
|
||||||
|
acc = ULLONG_MAX;
|
||||||
|
errno = ERANGE;
|
||||||
|
} else if (!any) {
|
||||||
|
noconv:
|
||||||
|
errno = EINVAL;
|
||||||
|
} else if (neg)
|
||||||
|
acc = -acc;
|
||||||
|
if (endptr != NULL)
|
||||||
|
*endptr = (char *)(any ? s - 1 : nptr);
|
||||||
|
return (acc);
|
||||||
|
}
|
||||||
|
|
@@ -125,6 +125,8 @@ HEIMDAL_ROKEN_1.0 {
|
|||||||
rk_strsvis;
|
rk_strsvis;
|
||||||
rk_strsvis;
|
rk_strsvis;
|
||||||
rk_strsvisx;
|
rk_strsvisx;
|
||||||
|
rk_strtoll;
|
||||||
|
rk_strtoull;
|
||||||
rk_strunvis;
|
rk_strunvis;
|
||||||
rk_strunvis;
|
rk_strunvis;
|
||||||
rk_strunvisx;
|
rk_strunvisx;
|
||||||
|
@@ -8,6 +8,14 @@
|
|||||||
! include <windows\NTMakefile.version>
|
! include <windows\NTMakefile.version>
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!if [ $(PERL) $(SRC)\cf\w32-detect-vc-version.pl $(CC) ]==16
|
||||||
|
HAVE_STDINT_H=1
|
||||||
|
HAVE_INT64_T=1
|
||||||
|
!endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Features
|
# Features
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user