From b1063ea8fcfe5f8b0bbdc8d98dbeb7e186d70890 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 22 Jul 2009 15:55:45 -0400 Subject: [PATCH 001/134] Initial Windows port --- NTMakefile | 37 + admin/NTMakefile | 35 + appl/NTMakefile | 35 + appl/afsutil/NTMakefile | 35 + appl/dceutils/NTMakefile | 35 + appl/dceutils/k5dce.h | 2 +- appl/ftp/NTMakefile | 35 + appl/ftp/common/NTMakefile | 35 + appl/ftp/ftp/NTMakefile | 35 + appl/ftp/ftpd/NTMakefile | 35 + appl/gssmask/NTMakefile | 35 + appl/kf/NTMakefile | 35 + appl/kx/NTMakefile | 35 + appl/login/NTMakefile | 35 + appl/otp/NTMakefile | 35 + appl/popper/NTMakefile | 35 + appl/push/NTMakefile | 35 + appl/rcp/NTMakefile | 35 + appl/rsh/NTMakefile | 35 + appl/su/NTMakefile | 35 + appl/telnet/NTMakefile | 35 + appl/telnet/libtelnet/NTMakefile | 35 + appl/telnet/telnet/NTMakefile | 35 + appl/telnet/telnetd/NTMakefile | 35 + appl/test/NTMakefile | 35 + appl/xnlock/NTMakefile | 35 + cf/make-proto.pl | 12 +- cf/win32.m4 | 3 +- doc/NTMakefile | 35 + etc/NTMakefile | 35 + include/NTMakefile | 116 +++ include/config.h.w32 | 1535 ++++++++++++++++++++++++++++ include/gssapi/NTMakefile | 34 + include/hcrypto/NTMakefile | 34 + include/kadm5/NTMakefile | 34 + include/krb5-types.h.w32 | 61 ++ kadmin/NTMakefile | 35 + kcm/NTMakefile | 35 + kdc/NTMakefile | 35 + kpasswd/NTMakefile | 35 + kuser/NTMakefile | 35 + lib/45/NTMakefile | 35 + lib/NTMakefile | 54 + lib/asn1/NTMakefile | 690 +++++++++++++ lib/asn1/asn1-common.h | 3 + lib/auth/NTMakefile | 35 + lib/auth/afskauthlib/NTMakefile | 35 + lib/auth/pam/NTMakefile | 35 + lib/auth/sia/NTMakefile | 35 + lib/com_err/NTMakefile | 88 ++ lib/com_err/compile_et.c | 4 + lib/com_err/libcom_err-exports.def | 12 + lib/com_err/libcom_err-version.rc | 36 + lib/editline/NTMakefile | 62 ++ lib/editline/edit_locl.h | 2 + lib/editline/editline.c | 2 +- lib/editline/syswin.c | 47 + lib/gssapi/NTMakefile | 499 +++++++++ lib/gssapi/gssapi/gssapi.h | 4 +- lib/gssapi/gssapi/gssapi_krb5.h | 16 +- lib/gssapi/ntlm/ntlm.h | 3 +- lib/gssapi/spnego/spnego_locl.h | 4 +- lib/hcrypto/NTMakefile | 242 +++++ lib/hcrypto/aes.h | 2 +- lib/hcrypto/bn.c | 1 + lib/hcrypto/evp.c | 1 + lib/hcrypto/hash.h | 1 + lib/hcrypto/rand-fortuna.c | 9 + lib/hcrypto/rijndael-alg-fst.c | 3 +- lib/hcrypto/rnd_keys.c | 4 +- lib/hcrypto/test_crypto.in | 6 +- lib/hcrypto/test_rand.c | 4 + lib/hcrypto/ui.c | 52 + lib/hdb/NTMakefile | 161 +++ lib/hx509/NTMakefile | 231 +++++ lib/hx509/hx_locl.h | 5 +- lib/hx509/softp11.c | 90 +- lib/kadm5/NTMakefile | 35 + lib/kadm5/get_s.c | 2 +- lib/kafs/NTMakefile | 35 + lib/kdfs/NTMakefile | 35 + lib/krb5/NTMakefile | 442 ++++++++ lib/krb5/acl.c | 4 +- lib/krb5/add_et_list.c | 2 +- lib/krb5/addr_families.c | 50 +- lib/krb5/aname_to_localname.c | 4 +- lib/krb5/appdefault.c | 4 +- lib/krb5/asn1_glue.c | 4 +- lib/krb5/auth_context.c | 68 +- lib/krb5/build_ap_req.c | 4 +- lib/krb5/build_auth.c | 18 +- lib/krb5/cache.c | 137 ++- lib/krb5/changepw.c | 10 +- lib/krb5/codec.c | 32 +- lib/krb5/config_file.c | 105 +- lib/krb5/constants.c | 7 +- lib/krb5/context.c | 66 +- lib/krb5/convert_creds.c | 4 +- lib/krb5/copy_host_realm.c | 2 +- lib/krb5/creds.c | 10 +- lib/krb5/crypto.c | 117 ++- lib/krb5/data.c | 16 +- lib/krb5/deprecated.c | 42 +- lib/krb5/derived-key-test.c | 2 +- lib/krb5/eai_to_heim_errno.c | 8 +- lib/krb5/error_string.c | 16 +- lib/krb5/expand_hostname.c | 4 +- lib/krb5/expand_path_w32.c | 377 +++++++ lib/krb5/fcache.c | 29 + lib/krb5/free.c | 4 +- lib/krb5/free_host_realm.c | 2 +- lib/krb5/generate_seq_number.c | 4 +- lib/krb5/generate_subkey.c | 4 +- lib/krb5/get_addrs.c | 4 +- lib/krb5/get_cred.c | 26 +- lib/krb5/get_default_principal.c | 55 +- lib/krb5/get_default_realm.c | 4 +- lib/krb5/get_for_creds.c | 6 +- lib/krb5/get_host_realm.c | 4 +- lib/krb5/get_in_tkt.c | 4 +- lib/krb5/get_port.c | 4 +- lib/krb5/init_creds.c | 40 +- lib/krb5/init_creds_pw.c | 26 +- lib/krb5/keyblock.c | 12 +- lib/krb5/keytab.c | 40 +- lib/krb5/krb5-v4compat.h | 21 +- lib/krb5/krb5.h | 8 + lib/krb5/krb5_locl.h | 8 + lib/krb5/krbhst.c | 26 +- lib/krb5/kuserok.c | 23 +- lib/krb5/log.c | 18 +- lib/krb5/misc.c | 2 +- lib/krb5/mit_glue.c | 46 +- lib/krb5/mk_error.c | 2 +- lib/krb5/mk_priv.c | 4 +- lib/krb5/mk_rep.c | 4 +- lib/krb5/mk_req.c | 6 +- lib/krb5/mk_req_ext.c | 4 +- lib/krb5/mk_safe.c | 4 +- lib/krb5/n-fold.c | 2 +- lib/krb5/net_read.c | 2 +- lib/krb5/net_write.c | 4 +- lib/krb5/padata.c | 2 +- lib/krb5/parse-name-test.c | 2 +- lib/krb5/pkinit.c | 14 +- lib/krb5/principal.c | 57 +- lib/krb5/prog_setup.c | 4 +- lib/krb5/prompter_posix.c | 2 +- lib/krb5/rd_cred.c | 6 +- lib/krb5/rd_error.c | 8 +- lib/krb5/rd_priv.c | 4 +- lib/krb5/rd_rep.c | 6 +- lib/krb5/rd_req.c | 39 +- lib/krb5/rd_safe.c | 4 +- lib/krb5/read_message.c | 6 +- lib/krb5/recvauth.c | 4 +- lib/krb5/replay.c | 32 +- lib/krb5/scache.c | 4 + lib/krb5/send_to_kdc.c | 54 +- lib/krb5/sendauth.c | 2 +- lib/krb5/set_default_realm.c | 2 +- lib/krb5/sock_principal.c | 2 +- lib/krb5/store.c | 103 +- lib/krb5/store_emem.c | 2 +- lib/krb5/store_fd.c | 2 +- lib/krb5/store_mem.c | 6 +- lib/krb5/test_addr.c | 29 + lib/krb5/test_cc.c | 28 +- lib/krb5/ticket.c | 12 +- lib/krb5/time.c | 10 +- lib/krb5/transited.c | 8 +- lib/krb5/v4_glue.c | 28 +- lib/krb5/verify_init.c | 6 +- lib/krb5/verify_user.c | 22 +- lib/krb5/warn.c | 28 +- lib/krb5/write_message.c | 6 +- lib/ntlm/NTMakefile | 63 ++ lib/ntlm/ntlm.c | 2 +- lib/otp/NTMakefile | 35 + lib/roken/NTMakefile | 243 +++++ lib/roken/base64.c | 4 +- lib/roken/base64.h | 8 +- lib/roken/bswap.c | 4 +- lib/roken/chown.c | 2 +- lib/roken/closefrom.c | 2 +- lib/roken/concat.c | 8 +- lib/roken/copyhostent.c | 2 +- lib/roken/daemon.c | 2 +- lib/roken/dirent-test.c | 278 +++++ lib/roken/dirent.c | 180 ++++ lib/roken/dirent.h | 66 ++ lib/roken/dlfcn.h | 78 ++ lib/roken/dlfcn_w32.c | 96 ++ lib/roken/dumpdata.c | 4 +- lib/roken/ecalloc.c | 2 +- lib/roken/emalloc.c | 2 +- lib/roken/environment.c | 4 +- lib/roken/eread.c | 3 +- lib/roken/erealloc.c | 2 +- lib/roken/err.c | 2 +- lib/roken/err.hin | 20 +- lib/roken/errx.c | 2 +- lib/roken/esetenv.c | 2 +- lib/roken/estrdup.c | 2 +- lib/roken/ewrite.c | 3 +- lib/roken/fchown.c | 2 +- lib/roken/flock.c | 76 +- lib/roken/fnmatch.c | 8 +- lib/roken/fnmatch.hin | 4 +- lib/roken/freeaddrinfo.c | 2 +- lib/roken/freehostent.c | 2 +- lib/roken/gai_strerror.c | 2 +- lib/roken/get_default_username.c | 8 +- lib/roken/get_window_size.c | 16 +- lib/roken/getaddrinfo.c | 2 +- lib/roken/getaddrinfo_hostspec.c | 4 +- lib/roken/getarg.c | 21 +- lib/roken/getarg.h | 12 +- lib/roken/getcap.c | 30 +- lib/roken/getcwd.c | 2 +- lib/roken/getdtablesize.c | 2 +- lib/roken/getegid.c | 2 +- lib/roken/geteuid.c | 2 +- lib/roken/getgid.c | 2 +- lib/roken/gethostname.c | 2 +- lib/roken/getifaddrs-test.c | 46 + lib/roken/getifaddrs.c | 10 +- lib/roken/getifaddrs_w32.c | 163 +++ lib/roken/getipnodebyaddr.c | 2 +- lib/roken/getipnodebyname.c | 2 +- lib/roken/getnameinfo.c | 2 +- lib/roken/getnameinfo_verified.c | 2 +- lib/roken/getopt.c | 2 +- lib/roken/getprogname.c | 2 +- lib/roken/gettimeofday.c | 4 +- lib/roken/getuid.c | 2 +- lib/roken/getusershell.c | 6 +- lib/roken/glob.c | 4 +- lib/roken/hex.c | 4 +- lib/roken/hex.h | 8 +- lib/roken/hostent_find_fqdn.c | 2 +- lib/roken/hstrerror.c | 2 +- lib/roken/inet_aton.c | 2 +- lib/roken/inet_ntop.c | 2 +- lib/roken/inet_pton.c | 61 +- lib/roken/initgroups.c | 2 +- lib/roken/innetgr.c | 2 +- lib/roken/iruserok.c | 2 +- lib/roken/issuid.c | 2 +- lib/roken/k_getpwnam.c | 2 +- lib/roken/k_getpwuid.c | 2 +- lib/roken/localtime_r.c | 2 +- lib/roken/lstat.c | 2 +- lib/roken/memmove.c | 2 +- lib/roken/mini_inetd.c | 38 +- lib/roken/mkstemp.c | 4 +- lib/roken/ndbm_wrap.c | 16 +- lib/roken/ndbm_wrap.h | 22 +- lib/roken/net_read.c | 37 +- lib/roken/net_write.c | 35 +- lib/roken/parse_bytes.c | 6 +- lib/roken/parse_bytes.h | 10 +- lib/roken/parse_time-test.c | 6 +- lib/roken/parse_time.c | 8 +- lib/roken/parse_time.h | 12 +- lib/roken/parse_units.c | 20 +- lib/roken/parse_units.h | 18 +- lib/roken/putenv.c | 2 +- lib/roken/rcmd.c | 2 +- lib/roken/readv.c | 2 +- lib/roken/realloc.c | 2 +- lib/roken/recvmsg.c | 2 +- lib/roken/resolve-test.c | 4 +- lib/roken/resolve.c | 16 +- lib/roken/resolve.h | 14 +- lib/roken/rkpty.c | 2 + lib/roken/roken-common.h | 111 +- lib/roken/roken.h.in | 274 +++-- lib/roken/roken_gethostby.c | 6 +- lib/roken/rtbl.c | 44 +- lib/roken/rtbl.h | 36 +- lib/roken/sendmsg.c | 4 +- lib/roken/sendmsg_w32.c | 86 ++ lib/roken/setegid.c | 2 +- lib/roken/setenv.c | 2 +- lib/roken/seteuid.c | 2 +- lib/roken/setprogname.c | 2 +- lib/roken/signal.c | 2 +- lib/roken/simple_exec.c | 18 +- lib/roken/simple_exec_w32.c | 430 ++++++++ lib/roken/sleep.c | 47 + lib/roken/snprintf.c | 30 +- lib/roken/socket.c | 53 +- lib/roken/sockstartup_w32.c | 77 ++ lib/roken/strcasecmp.c | 2 +- lib/roken/strcollect.c | 4 +- lib/roken/strdup.c | 2 +- lib/roken/strerror.c | 2 +- lib/roken/strftime.c | 4 +- lib/roken/strlcat.c | 2 +- lib/roken/strlcpy.c | 2 +- lib/roken/strlwr.c | 2 +- lib/roken/strncasecmp.c | 2 +- lib/roken/strndup.c | 2 +- lib/roken/strnlen.c | 2 +- lib/roken/strpftime-test.h | 7 + lib/roken/strpool.c | 6 +- lib/roken/strptime.c | 4 +- lib/roken/strsep.c | 2 +- lib/roken/strsep_copy.c | 2 +- lib/roken/strtok_r.c | 2 +- lib/roken/strupr.c | 2 +- lib/roken/swab.c | 2 +- lib/roken/syslog.h | 248 +++++ lib/roken/syslogc.c | 341 ++++++ lib/roken/test-mem.c | 24 +- lib/roken/test-mem.h | 4 +- lib/roken/timeval.c | 6 +- lib/roken/tm2time.c | 2 +- lib/roken/unsetenv.c | 2 +- lib/roken/unvis.c | 8 +- lib/roken/verify.c | 2 +- lib/roken/verr.c | 2 +- lib/roken/verrx.c | 2 +- lib/roken/vis.c | 25 +- lib/roken/vis.hin | 22 +- lib/roken/vsyslog.c | 2 +- lib/roken/vwarn.c | 2 +- lib/roken/vwarnx.c | 2 +- lib/roken/warnerr.c | 2 +- lib/roken/warnx.c | 2 +- lib/roken/write_pid.c | 11 +- lib/roken/writev.c | 2 +- lib/sl/NTMakefile | 76 ++ lib/sqlite/NTMakefile | 47 + lib/vers/NTMakefile | 60 ++ lib/wind/NTMakefile | 155 +++ lib/wind/gen-bidi.py | 1 + lib/wind/gen-combining.py | 1 + lib/wind/gen-errorlist.py | 1 + lib/wind/gen-normalize.py | 1 + lib/wind/gen-punycode-examples.py | 1 + lib/wind/test-bidi.c | 2 +- lib/wind/test-ldap.c | 2 +- lib/wind/test-map.c | 5 +- lib/wind/test-rw.c | 10 +- lib/wind/test-utf8.c | 2 +- lib/wind/windlocl.h | 1 + packages/NTMakefile | 35 + tests/NTMakefile | 35 + tests/can/NTMakefile | 35 + tests/db/NTMakefile | 35 + tests/gss/NTMakefile | 35 + tests/java/NTMakefile | 35 + tests/kdc/NTMakefile | 35 + tests/ldap/NTMakefile | 35 + tests/plugin/NTMakefile | 35 + tools/NTMakefile | 35 + windows/NTMakefile.config | 91 ++ windows/NTMakefile.w32 | 375 +++++++ windows/version.rc | 87 ++ 361 files changed, 11994 insertions(+), 1334 deletions(-) create mode 100644 NTMakefile create mode 100644 admin/NTMakefile create mode 100644 appl/NTMakefile create mode 100644 appl/afsutil/NTMakefile create mode 100644 appl/dceutils/NTMakefile create mode 100644 appl/ftp/NTMakefile create mode 100644 appl/ftp/common/NTMakefile create mode 100644 appl/ftp/ftp/NTMakefile create mode 100644 appl/ftp/ftpd/NTMakefile create mode 100644 appl/gssmask/NTMakefile create mode 100644 appl/kf/NTMakefile create mode 100644 appl/kx/NTMakefile create mode 100644 appl/login/NTMakefile create mode 100644 appl/otp/NTMakefile create mode 100644 appl/popper/NTMakefile create mode 100644 appl/push/NTMakefile create mode 100644 appl/rcp/NTMakefile create mode 100644 appl/rsh/NTMakefile create mode 100644 appl/su/NTMakefile create mode 100644 appl/telnet/NTMakefile create mode 100644 appl/telnet/libtelnet/NTMakefile create mode 100644 appl/telnet/telnet/NTMakefile create mode 100644 appl/telnet/telnetd/NTMakefile create mode 100644 appl/test/NTMakefile create mode 100644 appl/xnlock/NTMakefile create mode 100644 doc/NTMakefile create mode 100644 etc/NTMakefile create mode 100644 include/NTMakefile create mode 100644 include/config.h.w32 create mode 100644 include/gssapi/NTMakefile create mode 100644 include/hcrypto/NTMakefile create mode 100644 include/kadm5/NTMakefile create mode 100644 include/krb5-types.h.w32 create mode 100644 kadmin/NTMakefile create mode 100644 kcm/NTMakefile create mode 100644 kdc/NTMakefile create mode 100644 kpasswd/NTMakefile create mode 100644 kuser/NTMakefile create mode 100644 lib/45/NTMakefile create mode 100644 lib/NTMakefile create mode 100644 lib/asn1/NTMakefile create mode 100644 lib/auth/NTMakefile create mode 100644 lib/auth/afskauthlib/NTMakefile create mode 100644 lib/auth/pam/NTMakefile create mode 100644 lib/auth/sia/NTMakefile create mode 100644 lib/com_err/NTMakefile create mode 100644 lib/com_err/libcom_err-exports.def create mode 100644 lib/com_err/libcom_err-version.rc create mode 100644 lib/editline/NTMakefile create mode 100644 lib/editline/syswin.c create mode 100644 lib/gssapi/NTMakefile create mode 100644 lib/hcrypto/NTMakefile create mode 100644 lib/hdb/NTMakefile create mode 100644 lib/hx509/NTMakefile create mode 100644 lib/kadm5/NTMakefile create mode 100644 lib/kafs/NTMakefile create mode 100644 lib/kdfs/NTMakefile create mode 100644 lib/krb5/NTMakefile create mode 100644 lib/krb5/expand_path_w32.c create mode 100644 lib/ntlm/NTMakefile create mode 100644 lib/otp/NTMakefile create mode 100644 lib/roken/NTMakefile create mode 100644 lib/roken/dirent-test.c create mode 100644 lib/roken/dirent.c create mode 100644 lib/roken/dirent.h create mode 100644 lib/roken/dlfcn.h create mode 100644 lib/roken/dlfcn_w32.c create mode 100644 lib/roken/getifaddrs_w32.c create mode 100644 lib/roken/sendmsg_w32.c create mode 100644 lib/roken/simple_exec_w32.c create mode 100644 lib/roken/sleep.c create mode 100644 lib/roken/sockstartup_w32.c create mode 100644 lib/roken/syslog.h create mode 100644 lib/roken/syslogc.c create mode 100644 lib/sl/NTMakefile create mode 100644 lib/sqlite/NTMakefile create mode 100644 lib/vers/NTMakefile create mode 100644 lib/wind/NTMakefile create mode 100644 packages/NTMakefile create mode 100644 tests/NTMakefile create mode 100644 tests/can/NTMakefile create mode 100644 tests/db/NTMakefile create mode 100644 tests/gss/NTMakefile create mode 100644 tests/java/NTMakefile create mode 100644 tests/kdc/NTMakefile create mode 100644 tests/ldap/NTMakefile create mode 100644 tests/plugin/NTMakefile create mode 100644 tools/NTMakefile create mode 100644 windows/NTMakefile.config create mode 100644 windows/NTMakefile.w32 create mode 100644 windows/version.rc diff --git a/NTMakefile b/NTMakefile new file mode 100644 index 000000000..45008cb46 --- /dev/null +++ b/NTMakefile @@ -0,0 +1,37 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +SUBDIRS = include lib kuser kdc admin kadmin kpasswd appl doc tools tests packages etc + +!include windows/NTMakefile.w32 + +all:: + @echo Build finished succesfully diff --git a/admin/NTMakefile b/admin/NTMakefile new file mode 100644 index 000000000..943be2e7a --- /dev/null +++ b/admin/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=admin + +!include ../windows/NTMakefile.w32 + diff --git a/appl/NTMakefile b/appl/NTMakefile new file mode 100644 index 000000000..6bae479d0 --- /dev/null +++ b/appl/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl + +!include ../windows/NTMakefile.w32 + diff --git a/appl/afsutil/NTMakefile b/appl/afsutil/NTMakefile new file mode 100644 index 000000000..f1f696c02 --- /dev/null +++ b/appl/afsutil/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\afsutil + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/dceutils/NTMakefile b/appl/dceutils/NTMakefile new file mode 100644 index 000000000..eb27eb4f6 --- /dev/null +++ b/appl/dceutils/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\dceutils + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/dceutils/k5dce.h b/appl/dceutils/k5dce.h index 258a3c598..49036249f 100644 --- a/appl/dceutils/k5dce.h +++ b/appl/dceutils/k5dce.h @@ -55,7 +55,7 @@ typedef unsigned char krb5_octet; typedef krb5_octet krb5_boolean; typedef krb5short krb5_keytype; /* in k5.2 it's a short */ typedef krb5_int32 krb5_flags; -typedef krb5_int32 krb5_timestamp; +typedef krb5_int32 krb5_timestamp; /* is a time_t in krb5.h */ typedef char * krb5_pointer; /* pointer to unexposed data */ diff --git a/appl/ftp/NTMakefile b/appl/ftp/NTMakefile new file mode 100644 index 000000000..097379d80 --- /dev/null +++ b/appl/ftp/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\ftp + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/ftp/common/NTMakefile b/appl/ftp/common/NTMakefile new file mode 100644 index 000000000..8f61c745f --- /dev/null +++ b/appl/ftp/common/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\ftp\common + +!include ../../../windows/NTMakefile.w32 + diff --git a/appl/ftp/ftp/NTMakefile b/appl/ftp/ftp/NTMakefile new file mode 100644 index 000000000..8bb7c982e --- /dev/null +++ b/appl/ftp/ftp/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\ftp\ftp + +!include ../../../windows/NTMakefile.w32 + diff --git a/appl/ftp/ftpd/NTMakefile b/appl/ftp/ftpd/NTMakefile new file mode 100644 index 000000000..3b88d326f --- /dev/null +++ b/appl/ftp/ftpd/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\ftp\ftpd + +!include ../../../windows/NTMakefile.w32 + diff --git a/appl/gssmask/NTMakefile b/appl/gssmask/NTMakefile new file mode 100644 index 000000000..4ad1dc4f7 --- /dev/null +++ b/appl/gssmask/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\gssmask + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/kf/NTMakefile b/appl/kf/NTMakefile new file mode 100644 index 000000000..6ade4ab9b --- /dev/null +++ b/appl/kf/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\kf + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/kx/NTMakefile b/appl/kx/NTMakefile new file mode 100644 index 000000000..7d4b89a83 --- /dev/null +++ b/appl/kx/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\kx + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/login/NTMakefile b/appl/login/NTMakefile new file mode 100644 index 000000000..b19ecfa8b --- /dev/null +++ b/appl/login/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\login + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/otp/NTMakefile b/appl/otp/NTMakefile new file mode 100644 index 000000000..625630993 --- /dev/null +++ b/appl/otp/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\otp + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/popper/NTMakefile b/appl/popper/NTMakefile new file mode 100644 index 000000000..20f681bfd --- /dev/null +++ b/appl/popper/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\popper + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/push/NTMakefile b/appl/push/NTMakefile new file mode 100644 index 000000000..52ce4b01f --- /dev/null +++ b/appl/push/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\push + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/rcp/NTMakefile b/appl/rcp/NTMakefile new file mode 100644 index 000000000..48a05b82e --- /dev/null +++ b/appl/rcp/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\rcp + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/rsh/NTMakefile b/appl/rsh/NTMakefile new file mode 100644 index 000000000..c7b4e643d --- /dev/null +++ b/appl/rsh/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\rsh + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/su/NTMakefile b/appl/su/NTMakefile new file mode 100644 index 000000000..7afe814fa --- /dev/null +++ b/appl/su/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\su + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/telnet/NTMakefile b/appl/telnet/NTMakefile new file mode 100644 index 000000000..38031e713 --- /dev/null +++ b/appl/telnet/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\telnet + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/telnet/libtelnet/NTMakefile b/appl/telnet/libtelnet/NTMakefile new file mode 100644 index 000000000..25da4ec4d --- /dev/null +++ b/appl/telnet/libtelnet/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\telnet\libtelnet + +!include ../../../windows/NTMakefile.w32 + diff --git a/appl/telnet/telnet/NTMakefile b/appl/telnet/telnet/NTMakefile new file mode 100644 index 000000000..9b0844692 --- /dev/null +++ b/appl/telnet/telnet/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\telnet\telnet + +!include ../../../windows/NTMakefile.w32 + diff --git a/appl/telnet/telnetd/NTMakefile b/appl/telnet/telnetd/NTMakefile new file mode 100644 index 000000000..03bead101 --- /dev/null +++ b/appl/telnet/telnetd/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\telnet\telnetd + +!include ../../../windows/NTMakefile.w32 + diff --git a/appl/test/NTMakefile b/appl/test/NTMakefile new file mode 100644 index 000000000..15bea96ee --- /dev/null +++ b/appl/test/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\test + +!include ../../windows/NTMakefile.w32 + diff --git a/appl/xnlock/NTMakefile b/appl/xnlock/NTMakefile new file mode 100644 index 000000000..16f305b88 --- /dev/null +++ b/appl/xnlock/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=appl\xnlock + +!include ../../windows/NTMakefile.w32 + diff --git a/cf/make-proto.pl b/cf/make-proto.pl index 02e407e15..cad5ced74 100644 --- a/cf/make-proto.pl +++ b/cf/make-proto.pl @@ -316,24 +316,30 @@ extern \"C\" { } if ($opt_E) { $public_h_header .= "#ifndef $opt_E +#ifndef ${opt_E}_FUNCTION #if defined(_WIN32) -#define ${opt_E}_FUNCTION __stdcall __declspec(dllimport) +#define ${opt_E}_FUNCTION __declspec(dllimport) +#define ${opt_E}_CALL __stdcall #define ${opt_E}_VARIABLE __declspec(dllimport) #else #define ${opt_E}_FUNCTION #define ${opt_E}_VARIABLE #endif #endif - +#endif "; $private_h_header .= "#ifndef $opt_E +#ifndef ${opt_E}_FUNCTION #if defined(_WIN32) -#define ${opt_E}_FUNCTION __stdcall __declspec(dllimport) +#define ${opt_E}_FUNCTION __declspec(dllimport) +#define ${opt_E}_CALL __stdcall #define ${opt_E}_VARIABLE __declspec(dllimport) #else #define ${opt_E}_FUNCTION #define ${opt_E}_VARIABLE +#define ${opt_E}_CALL +#endif #endif #endif diff --git a/cf/win32.m4 b/cf/win32.m4 index 9954ec3ca..ac53bd0c9 100644 --- a/cf/win32.m4 +++ b/cf/win32.m4 @@ -3,7 +3,8 @@ dnl rk_WIN32_EXPORT buildsymbol symbol-that-export AC_DEFUN([rk_WIN32_EXPORT],[AH_TOP([#ifdef $1 #ifndef $2 #ifdef _WIN32_ -#define $2_FUNCTION __declspec(dllexport) __stdcall +#define $2_FUNCTION __declspec(dllexport) +#define $2_CALL __stdcall #define $2_VARIABLE __declspec(dllexport) #else #define $2_FUNCTION diff --git a/doc/NTMakefile b/doc/NTMakefile new file mode 100644 index 000000000..0be84e22f --- /dev/null +++ b/doc/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=doc + +!include ../windows/NTMakefile.w32 + diff --git a/etc/NTMakefile b/etc/NTMakefile new file mode 100644 index 000000000..aab3f7a17 --- /dev/null +++ b/etc/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=etc + +!include ../windows/NTMakefile.w32 + diff --git a/include/NTMakefile b/include/NTMakefile new file mode 100644 index 000000000..1a5454877 --- /dev/null +++ b/include/NTMakefile @@ -0,0 +1,116 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=include + +SUBDIRS=kadm5 hcrypto gssapi + +!include ../windows/NTMakefile.w32 +!include ../windows/NTMakefile.config + +INCFILES= \ + $(INCDIR)\config.h \ + $(INCDIR)\version.h \ + $(INCDIR)\krb5-types.h \ + $(INCDIR)\crypto-headers.h + +MAKECRYPTO=$(OBJ)\make_crypto.exe + +$(MAKECRYPTO): $(OBJ)\make_crypto.obj + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(INCDIR)\krb5-types.h: krb5-types.h.w32 + $(CP) $** $@ + +$(INCDIR)\crypto-headers.h: $(MAKECRYPTO) + $(MAKECRYPTO) $@ + +$(INCDIR)\config.h: config.h.w32 ..\windows\NTMakefile.config NTMakefile + $(PERL) << < config.h.w32 > $@ + +while(<>) { + + if (m/\@FEATURE_DEFS\@/) { + + if ("$(KRB5)") { print "#define KRB5 1\n"; } + if ("$(PKINIT)") { print "#define PKINIT 1\n"; } + if ("$(NO_AFS)") { print "#define NO_AFS 1\n"; } + if ("$(OPENLDAP)") { print "#define OPENLDAP 1\n"; } + if ("$(OPENLDAP_MODULE)") { print "#define OPENLDAP_MODULE 1\n"; } + if ("$(OTP)") { print "#define OTP 1 \n"; } + if ("$(AUTHENTICATION)") { print "#define AUTHENTICATION 1\n"; } + if ("$(DIAGNOSTICS)") { print "#define DIAGNOSTICS 1\n"; } + if ("$(ENCRYPTION)") { print "#define ENCRYPTION 1\n"; } + if ("$(ENABLE_AFS_STRING_TO_KEY)") { print "#define ENABLE_AFS_STRING_TO_KEY 1\n"; } + if ("$(ENABLE_PTHREAD_SUPPORT)") { print "#define ENABLE_PTHREAD_SUPPORT 1\n"; } + if ("$(HAVE_PTHREAD_H)") { print "#define HAVE_PTHREAD_H 1\n"; } + if ("$(ENV_HACK)") { print "#define ENV_HACK 1\n"; } + if ("$(HAVE_KCM)") { print "#define HAVE_KCM 1\n"; } + + } elsif (m/\@VERSION_OPTDEFS\@/) { + + if ("$(VER_PRERELEASE)") { print "#define VER_PRERELEASE 1\n"; } + if ("$(VER_PRIVATE)") { print "#define VER_PRIVATE \"$(VER_PRIVATE)\""; } + if ("$(VER_SPECIAL)") { print "#define VER_SPECIAL \"$(VER_SPECIAL)\""; } + if ("$(BUILD)" =~ "dbg") { print "#define VER_DEBUG 1\n"; } + + } else { + + s/\@PACKAGE\@/$(VER_PACKAGE)/; + s/\@PACKAGE_NAME\@/$(VER_PACKAGE_NAME)/; + s/\@PACKAGE_BUGREPORT\@/$(VER_PACKAGE_BUGREPORT:@=\@)/; + s/\@PACKAGE_VERSION\@/$(VER_PACKAGE_VERSION)/; + s/\@PACKAGE_COPYRIGHT\@/$(VER_PACKAGE_COPYRIGHT)/; + s/\@PACKAGE_COMPANY\@/$(VER_PACKAGE_COMPANY)/; + s/\@MAJOR\@/$(VER_PRODUCT_MAJOR)/; + s/\@MINOR\@/$(VER_PRODUCT_MINOR)/; + s/\@AUX\@/$(VER_PRODUCT_AUX)/; + s/\@PATCH\@/$(VER_PRODUCT_PATCH)/; + + print $_; + } +} +<< + +$(INCDIR)\version.h: ..\windows\NTMakefile.config NTMakefile + $(CP) << $@ +const char *heimdal_long_version = "@(#)$$Version: $(VER_PACKAGE_NAME) $(VER_PACKAGE_VERSION) by $(USERNAME) on $(COMPUTERNAME) ($(CPU)-pc-windows) $$"; +const char *heimdal_version = "$(VER_PACKAGE_NAME) $(VER_PACKAGE_VERSION)"; +<< + +all:: $(INCFILES) + +clean:: + $(RM) $(INCFILES) + diff --git a/include/config.h.w32 b/include/config.h.w32 new file mode 100644 index 000000000..0248bf061 --- /dev/null +++ b/include/config.h.w32 @@ -0,0 +1,1535 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#ifndef RCSID +#define RCSID(msg) \ +static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } +#endif + +/* If this file is being included by a resource script, don't bother + with anything other than the version macros. */ +#ifndef RC_INVOKED + +#define MaxHostNameLen (64+4) +#define MaxPathLen MAX_PATH + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN MaxHostNameLen +#endif +#ifndef MAXPATHLEN +#define MAXPATHLEN MaxPathLen +#endif + +#ifdef BUILD_KRB5_LIB +#ifndef KRB5_LIB +#ifdef _WIN32 +#define KRB5_LIB_FUNCTION __declspec(dllexport) +#define KRB5_LIB_CALL __stdcall +#define KRB5_LIB_VARIABLE __declspec(dllexport) +#else +#define KRB5_LIB_FUNCTION +#define KRB5_LIB_CALL +#define KRB5_LIB_VARIABLE +#endif +#endif +#endif + + +#ifdef BUILD_ROKEN_LIB +#ifndef ROKEN_LIB +#ifdef _WIN32 +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl +#define ROKEN_LIB_VARIABLE +#else +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL +#define ROKEN_LIB_VARIABLE +#endif +#endif +#endif + + +#ifdef BUILD_GSSAPI_LIB +#ifndef GSSAPI_LIB +#ifdef _WIN32 +#define GSSAPI_LIB_FUNCTION __declspec(dllexport) +#define GSSAPI_LIB_CALL __stdcall +#define GSSAPI_LIB_VARIABLE __declspec(dllexport) +#else +#define GSSAPI_LIB_FUNCTION +#define GSSAPI_LIB_CALL +#define GSSAPI_LIB_VARIABLE +#endif +#endif +#endif + +#define _STR2(x) #x +#define _STR(x) _STR2(x) + +#ifdef _HOST +#define HOST _STR(_HOST) +#endif + +#ifdef _HDB_DB_DIR +#define HDB_DB_DIR _STR(_HDB_DB_DIR) +#endif + +/* Feature macros */ + +@FEATURE_DEFS@ + +/* Define is backslashes act as path delimiters */ +#define BACKSLASH_PATH_DELIM 1 + +/* Define if you want to use DES encryption in telnet. */ +#define DES_ENCRYPTION 1 + +/* Define this if you want support for broken ENV_{VAR,VAL} telnets. */ +/* #undef ENV_HACK */ + +/* define if prototype of gethostbyaddr is compatible with struct hostent + *gethostbyaddr(const void *, size_t, int) */ +/* #undef GETHOSTBYADDR_PROTO_COMPATIBLE */ + +/* define if prototype of gethostbyname is compatible with struct hostent + *gethostbyname(const char *) */ +#define GETHOSTBYNAME_PROTO_COMPATIBLE 1 + +/* define if prototype of getservbyname is compatible with struct servent + *getservbyname(const char *, const char *) */ +#define GETSERVBYNAME_PROTO_COMPATIBLE 1 + +/* define if prototype of getsockname is compatible with int getsockname(int, + struct sockaddr*, socklen_t*) */ +/* #undef GETSOCKNAME_PROTO_COMPATIBLE */ + +/* Define if you have the `altzone' variable. */ +/* #undef HAVE_ALTZONE */ + +/* Define to 1 if you have the `arc4random' function. */ +/* #undef HAVE_ARC4RANDOM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_FTP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_INET_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_NAMESER_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ARPA_TELNET_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ASL_H */ + +/* Define to 1 if you have the `asnprintf' function. */ +/* #undef HAVE_ASNPRINTF */ + +/* Define to 1 if you have the `asprintf' function. */ +/* #undef HAVE_ASPRINTF */ + +/* Define to 1 if you have the `atexit' function. */ +#define HAVE_ATEXIT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BIND_BITYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BSDSETJMP_H */ + +/* Define to 1 if you have the `bswap16' function. */ +/* #undef HAVE_BSWAP16 */ + +/* Define to 1 if you have the `bswap32' function. */ +/* #undef HAVE_BSWAP32 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CAPABILITY_H */ + +/* Define to 1 if you have the `cap_set_proc' function. */ +/* #undef HAVE_CAP_SET_PROC */ + +/* Define to 1 if you have the `cgetent' function. */ +/* #undef HAVE_CGETENT */ + +/* Define if the system defines 'CHAR' type */ +#define HAVE_CHAR 1 + +/* Define if you have the function `chown'. */ +#define HAVE_CHOWN 1 + +/* Define if you have the function `closefrom'. */ +/* #undef HAVE_CLOSEFROM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CONFIG_H */ + +/* Define if is present on the system is should be used for + handling low level console operations. */ +#define HAVE_CONIO_H + +/* Define if you have the function `copyhostent'. */ +/* #undef HAVE_COPYHOSTENT */ + +/* Define to 1 if you have the `crypt' function. */ +/* #undef HAVE_CRYPT */ + +/* Define to 1 if you have the header file. */ +/* #ndef HAVE_CRYPT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CURSES_H */ + +/* Define if you have the function `daemon'. */ +/* #define HAVE_DAEMON 1 */ + +/* define if you have a berkeley db1/2 library */ +/* #undef HAVE_DB1 */ + +/* define if you have a berkeley db3/4 library */ +/* #define HAVE_DB3 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DB3_DB_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_DB4_DB_H 1 */ + +/* Define to 1 if you have the `dbm_firstkey' function. */ +/* #define HAVE_DBM_FIRSTKEY 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DBM_H */ + +/* Define to 1 if you have the `dbopen' function. */ +/* #undef HAVE_DBOPEN */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_DB_185_H 1 */ + +/* Define to 1 if you have the `db_create' function. */ +/* #define HAVE_DB_CREATE 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_DB_H 1 */ + +/* define if you have ndbm compat in db */ +/* #define HAVE_DB_NDBM 1 */ + +/* Define to 1 if you have the declaration of `altzone', and to 0 if you + don't. */ +/* #undef HAVE_DECL_ALTZONE */ + +/* Define to 1 if you have the declaration of `environ', and to 0 if you + don't. */ +#define HAVE_DECL_ENVIRON 1 + +/* Define to 1 if you have the declaration of `h_errlist', and to 0 if you + don't. */ +/* #undef HAVE_DECL_H_ERRLIST */ + +/* Define to 1 if you have the declaration of `h_errno', and to 0 if you + don't. */ +#define HAVE_DECL_H_ERRNO 1 + +/* Define to 1 if you have the declaration of `h_nerr', and to 0 if you don't. + */ +/* #undef HAVE_DECL_H_NERR */ + +/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. + */ +/* #undef HAVE_DECL_OPTARG */ + +/* Define to 1 if you have the declaration of `opterr', and to 0 if you don't. + */ +/* #undef HAVE_DECL_OPTERR */ + +/* Define to 1 if you have the declaration of `optind', and to 0 if you don't. + */ +/* #undef HAVE_DECL_OPTIND */ + +/* Define to 1 if you have the declaration of `optopt', and to 0 if you don't. + */ +/* #undef HAVE_DECL_OPTOPT */ + +/* Define to 1 if you have the declaration of `timezone', and to 0 if you + don't. */ +#define HAVE_DECL_TIMEZONE 1 + +/* Define to 1 if you have the declaration of `_res', and to 0 if you don't. + */ +/* #undef HAVE_DECL__RES */ + +/* Define to 1 if you have the declaration of `__progname', and to 0 if you + don't. */ +#define HAVE_DECL___PROGNAME 0 + +/* Define to 1 if you have the header file. */ +/* MSVC doesn't provide a , but we implement it in + lib/roken. */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +/* MSVC doesn't provide a , but we implement it in lib/roken. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `dlopen' function. */ +/* MSVC doesn't provide a , but we implement it in lib/roken. */ +#define HAVE_DLOPEN 1 + +/* Define to 1 if you have the `dn_expand' function. */ +/* #undef HAVE_DN_EXPAND */ + +/* Define to 1 if you have the `door_create' function. */ +/* #undef HAVE_DOOR_CREATE */ + +/* Define if you have the function `ecalloc'. */ +/* #undef HAVE_ECALLOC */ + +/* Define to 1 if you have the `el_init' function. */ +/* #undef HAVE_EL_INIT */ + +/* Define if you have the function `emalloc'. */ +/* #undef HAVE_EMALLOC */ + +/* Define if you have the function `erealloc'. */ +/* #undef HAVE_EREALLOC */ + +/* Define if you have the function `err'. */ +#define HAVE_ERR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define if you have the function `errx'. */ +#define HAVE_ERRX 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERR_H 1 + +/* Define if you have the function `estrdup'. */ +/* #undef HAVE_ESTRDUP */ + +/* Define if you have the function `fchown'. */ +/* #undef HAVE_FCHOWN */ + +/* Define to 1 if you have the `fcntl' function. */ +/* #undef HAVE_FCNTL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the function `flock'. */ +/* #undef HAVE_FLOCK */ + +/* Define if you have the function `fnmatch'. */ +/* #undef HAVE_FNMATCH */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_FNMATCH_H */ + +/* Define if el_init takes four arguments. */ +/* #undef HAVE_FOUR_VALUED_EL_INIT */ + +/* Have -framework Security */ +/* #undef HAVE_FRAMEWORK_SECURITY */ + +/* Define to 1 if you have the `freeaddrinfo' function. */ +#define HAVE_FREEADDRINFO 1 + +/* Define if you have the function `freehostent'. */ +/* #undef HAVE_FREEHOSTENT */ + +/* Define to 1 if you have the `gai_strerror' function. */ +#define HAVE_GAI_STRERROR 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GDBM_NDBM_H */ + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getconfattr' function. */ +/* #undef HAVE_GETCONFATTR */ + +/* Define if you have the function `getcwd'. */ +#define HAVE_GETCWD 1 + +/* Define if you have the function `getdtablesize'. */ +/* #define HAVE_GETDTABLESIZE 1 */ + +/* Define if you have the function `getegid'. */ +/* #define HAVE_GETEGID 1 */ + +/* Define if you have the function `geteuid'. */ +/* #define HAVE_GETEUID 1 */ + +/* Define if you have the function `getgid'. */ +/* #define HAVE_GETGID 1 */ + +/* Define to 1 if you have the `gethostbyname' function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gethostbyname2' function. */ +/* #undef HAVE_GETHOSTBYNAME2 */ + +/* Define if you have the function `gethostname'. */ +#define HAVE_GETHOSTNAME 1 + +/* Define if you have the function `getifaddrs'. */ +/* #undef HAVE_GETIFADDRS */ + +/* Define if you have the function `getipnodebyaddr'. */ +/* #undef HAVE_GETIPNODEBYADDR */ + +/* Define if you have the function `getipnodebyname'. */ +/* #undef HAVE_GETIPNODEBYNAME */ + +/* Define to 1 if you have the `getlogin' function. */ +/* #define HAVE_GETLOGIN 1 */ + +/* Define if you have a working getmsg. */ +/* #undef HAVE_GETMSG */ + +/* Define to 1 if you have the `getnameinfo' function. */ +#define HAVE_GETNAMEINFO 1 + +/* Define if you have the function `getopt'. */ +/* #define HAVE_GETOPT 1 */ + +/* Define to 1 if you have the `getpagesize' function. */ +/* #define HAVE_GETPAGESIZE 1 */ + +/* Define to 1 if you have the `getpeereid' function. */ +/* #define HAVE_GETPEEREID 1 */ + +/* Define to 1 if you have the `getpeerucred' function. */ +/* #undef HAVE_GETPEERUCRED */ + +/* Define to 1 if you have the `getprogname' function. */ +/* #define HAVE_GETPROGNAME 1 */ + +/* Define to 1 if you have the `getpwnam_r' function. */ +/* #define HAVE_GETPWNAM_R 1 */ + +/* Define to 1 if you have the `getrlimit' function. */ +/* #define HAVE_GETRLIMIT 1 */ + +/* Define to 1 if you have the `getsockopt' function. */ +#define HAVE_GETSOCKOPT 1 + +/* Define to 1 if you have the `getspnam' function. */ +/* #undef HAVE_GETSPNAM */ + +/* Define if you have the function `gettimeofday'. */ +/* #define HAVE_GETTIMEOFDAY 1 */ + +/* Define to 1 if you have the `getudbnam' function. */ +/* #undef HAVE_GETUDBNAM */ + +/* Define if you have the function `getuid'. */ +/* #define HAVE_GETUID 1 */ + +/* Define if you have the function `getusershell'. */ +/* #define HAVE_GETUSERSHELL 1 */ + +/* define if you have a glob() that groks GLOB_BRACE, GLOB_NOCHECK, + GLOB_QUOTE, GLOB_TILDE, and GLOB_LIMIT */ +/* #define HAVE_GLOB 1 */ + +/* Define to 1 if you have the `grantpt' function. */ +/* #define HAVE_GRANTPT 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_GRP_H 1 */ + +/* Define to 1 if you have the `hstrerror' function. */ +/* #define HAVE_HSTRERROR 1 */ + +/* Define if you have the `h_errlist' variable. */ +/* #undef HAVE_H_ERRLIST */ + +/* Define if you have the `h_errno' variable. */ +/* #define HAVE_H_ERRNO 1 */ + +/* Define if you have the `h_nerr' variable. */ +/* #undef HAVE_H_NERR */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IFADDRS_H */ + +/* Define if you have the in6addr_loopback variable */ +/* #undef HAVE_IN6ADDR_LOOPBACK */ + +/* */ +#define HAVE_INET_ADDR 1 + +/* define */ +/* #define HAVE_INET_ATON 1 */ + +/* define */ +/* #define HAVE_INET_NTOP 1 */ + +/* define */ +/* #define HAVE_INET_PTON 1 */ + +#if _WIN32_WINNT >= 0x0600 + +#define HAVE_INET_NTOP 1 + +#define HAVE_INET_PTON 1 + +#endif + +/* Define if you have the function `initgroups'. */ +/* #define HAVE_INITGROUPS 1 */ + +/* Define to 1 if you have the `initstate' function. */ +/* #define HAVE_INITSTATE 1 */ + +/* Define if you have the function `innetgr'. */ +/* #undef HAVE_INNETGR */ + +/* Define to 1 if the system has the type `int16_t'. */ +/* #define HAVE_INT16_T 1 */ + +/* Define to 1 if the system has the type `int32_t'. */ +/* #define HAVE_INT32_T 1 */ + +/* Define to 1 if the system has the type `int64_t'. */ +/* #define HAVE_INT64_T 1 */ + +/* Define to 1 if the system has the type `int8_t'. */ +/* #define HAVE_INT8_T 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_INTTYPES_H 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_IO_H 1 + +/* Define if you have IPv6. */ +#define HAVE_IPV6 1 + +/* Define if you have the function `iruserok'. */ +/* #define HAVE_IRUSEROK 1 */ + +/* Define to 1 if you have the `issetugid' function. */ +/* #undef HAVE_ISSETUGID */ + +/* Define if you want to use the Kerberos Credentials Manager. */ +/* #define HAVE_KCM 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBUTIL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `loadquery' function. */ +/* #undef HAVE_LOADQUERY */ + +/* Define if you have the function `localtime_r'. */ +/* #define HAVE_LOCALTIME_R 1 */ + +/* Define to 1 if you have the `logout' function. */ +/* #define HAVE_LOGOUT 1 */ + +/* Define to 1 if you have the `logwtmp' function. */ +/* #define HAVE_LOGWTMP 1 */ + +/* Define to 1 if the system has the type `long long'. */ +#define HAVE_LONG_LONG 1 + +/* Define if you have the function `lstat'. */ +/* #define HAVE_LSTAT 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MAILLOCK_H */ + +/* Define if you have the function `memmove'. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define if you have the function `mkstemp'. */ +/* #define HAVE_MKSTEMP 1 */ + +/* Define to 1 if you have the `mktime' function. */ +#define HAVE_MKTIME 1 + +/* Define to 1 if you have a working `mmap' system call. */ +/* #undef HAVE_MMAP */ + +/* define if you have a ndbm library */ +/* #undef HAVE_NDBM */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NDBM_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_NETDB_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETGROUP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET6_IN6_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET6_IN6_VAR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_IN6_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINET_IN6_MACHTYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_NETINET_IN_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_NETINET_IN_SYSTM_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_NETINET_IP_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_NETINET_TCP_H 1 */ + +/* Define if you want to use Netinfo instead of krb5.conf. */ +/* #undef HAVE_NETINFO */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETINFO_NI_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_NET_IF_H 1 */ + +/* Define if NDBM really is DB (creates files *.db) */ +/* #define HAVE_NEW_DB 1 */ + +/* Define to 1 if you have the `on_exit' function. */ +/* #define HAVE_ON_EXIT 1 */ + +/* Define to 1 if you have the '_onexit' function */ +#define HAVE__ONEXIT 1 + +/* Define to 1 if you have the `openpty' function. */ +/* #define HAVE_OPENPTY 1 */ + +/* define to use openssl's libcrypto */ +/* #undef HAVE_OPENSSL */ + +/* Define to enable basic OSF C2 support. */ +/* #undef HAVE_OSFC2 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_PATHS_H 1 */ + +/* Define to 1 if you have the `pidfile' function. */ +/* #undef HAVE_PIDFILE */ + +/* Define to 1 if you have the `poll' function. */ +/* #define HAVE_POLL 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_POLL_H 1 */ + +/* Define to 1 if you have the header file. */ +/* This option is added by the NTMakefile if we have a . */ +/* #define HAVE_PTHREAD_H 1 */ + +/* Define to 1 if you have the `ptsname' function. */ +/* #define HAVE_PTSNAME 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_PTY_H 1 */ + +/* Define if you have the function `putenv'. */ +#define HAVE_PUTENV 1 + +/* Define to 1 if you have the header file. */ +/* #define HAVE_PWD_H 1 */ + +/* Define to 1 if you have the `rand' function. */ +#define HAVE_RAND 1 + +/* Define to 1 if you have the `random' function. */ +/* #define HAVE_RANDOM 1 */ + +/* Define if you have the function `rcmd'. */ +/* #define HAVE_RCMD 1 */ + +/* Define if you have a readline compatible library. */ +/* #define HAVE_READLINE 1 */ + +/* Define if you have the function `readv'. */ +/* #define HAVE_READV 1 */ + +/* Define if you have the function `recvmsg'. */ +/* #define HAVE_RECVMSG 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RESOLV_H */ + +/* Define to 1 if you have the `res_ndestroy' function. */ +/* #undef HAVE_RES_NDESTROY */ + +/* Define to 1 if you have the `res_nsearch' function. */ +/* #undef HAVE_RES_NSEARCH */ + +/* Define to 1 if you have the `res_search' function. */ +/* #undef HAVE_RES_SEARCH */ + +/* Define to 1 if you have the `revoke' function. */ +/* #define HAVE_REVOKE 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RPCSVC_YPCLNT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SAC_H */ + +/* Define to 1 if the system has the type `sa_family_t'. */ +/* #define HAVE_SA_FAMILY_T 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SECURITY_PAM_MODULES_H */ + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define if you have the function `sendmsg'. */ +/* #define HAVE_SENDMSG 1 */ + +/* Define if you have the function `setegid'. */ +/* #define HAVE_SETEGID 1 */ + +/* Define if you have the function `setenv'. */ +#define HAVE_SETENV 1 + +/* Define if you have the function `seteuid'. */ +/* #define HAVE_SETEUID 1 */ + +/* Define to 1 if you have the `setitimer' function. */ +/* #define HAVE_SETITIMER 1 */ + +/* Define to 1 if you have the `setlim' function. */ +/* #undef HAVE_SETLIM */ + +/* Define to 1 if you have the `setlogin' function. */ +/* #undef HAVE_SETLOGIN */ + +/* Define to 1 if you have the `setpcred' function. */ +/* #undef HAVE_SETPCRED */ + +/* Define to 1 if you have the `setpgid' function. */ +/* #define HAVE_SETPGID 1 */ + +/* Define to 1 if you have the `setproctitle' function. */ +/* #undef HAVE_SETPROCTITLE */ + +/* Define to 1 if you have the `setprogname' function. */ +/* #define HAVE_SETPROGNAME 1 */ + +/* Define to 1 if you have the `setregid' function. */ +/* #define HAVE_SETREGID 1 */ + +/* Define to 1 if you have the `setresgid' function. */ +/* #undef HAVE_SETRESGID */ + +/* Define to 1 if you have the `setresuid' function. */ +/* #undef HAVE_SETRESUID */ + +/* Define to 1 if you have the `setreuid' function. */ +/* #define HAVE_SETREUID 1 */ + +/* Define to 1 if you have the `setsid' function. */ +/* #define HAVE_SETSID 1 */ + +/* Define to 1 if you have the `setsockopt' function. */ +#define HAVE_SETSOCKOPT 1 + +/* Define to 1 if you have the `setstate' function. */ +/* #define HAVE_SETSTATE 1 */ + +/* Define to 1 if you have the `setutent' function. */ +/* #define HAVE_SETUTENT 1 */ + +/* Define to 1 if you have the `sgi_getcapabilitybyname' function. */ +/* #undef HAVE_SGI_GETCAPABILITYBYNAME */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SGTTY_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SHADOW_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SIAD_H */ + +/* Define to 1 if you have the `sigaction' function. */ +/* #define HAVE_SIGACTION 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* define if you have a working snprintf */ +/* snprintf() and vsnprintf() do exist. But the implementations are + not C99 compliant. */ +/* #define HAVE_SNPRINTF 1 */ + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if the system has the type `socklen_t'. */ +#define HAVE_SOCKLEN_T 1 + +/* Define to 1 if the system has the type `ssize_t'. */ +/* #define HAVE_SSIZE_T 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STANDARDS_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_STDINT_H 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the function `strcasecmp'. */ +#define HAVE_STRCASECMP 1 +#define strcasecmp _stricmp + +/* Define if you have the function `strdup'. */ +#define HAVE_STRDUP 1 + +/* Define if you have the function `strerror'. */ +#define HAVE_STRERROR 1 + +/* Define if you have the function `strftime'. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +/* #define HAVE_STRINGS_H 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the function `strlcat'. */ +#define HAVE_STRLCAT 1 +#define strlcat(d,s,dsz) strcat_s((d),(dsz),(s)) + +/* Define if you have the function `strlcpy'. */ +#define HAVE_STRLCPY 1 +#define strlcpy(d,s,dsz) strcpy_s((d),(dsz),(s)) + +/* Define if you have the function `strlwr'. */ +#define HAVE_STRLWR 1 + +/* Define if you have the function `strncasecmp'. */ +#define HAVE_STRNCASECMP 1 +#define strncasecmp _strnicmp + +/* Define if you have the function `strndup'. */ +/* #define HAVE_STRNDUP 1 */ + +/* Define if you have the function `strnlen'. */ +#define HAVE_STRNLEN 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STROPTS_H */ + +/* Define if you have the function `strptime'. */ +/* #define HAVE_STRPTIME 1 */ + +/* Define if you have the function `strsep'. */ +/* #define HAVE_STRSEP 1 */ + +/* Define if you have the function `strsep_copy'. */ +/* #undef HAVE_STRSEP_COPY */ + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strsvis' function. */ +/* #undef HAVE_STRSVIS */ + +/* Define if you have the function `strtok_r'. */ +/* #define HAVE_STRTOK_R 1 */ + +/* Define to 1 if the system has the type `struct addrinfo'. */ +#define HAVE_STRUCT_ADDRINFO 1 + +/* Define to 1 if the system has the type `struct ifaddrs'. */ +/* #undef HAVE_STRUCT_IFADDRS */ + +/* Define to 1 if the system has the type `struct iovec'. */ +/* #define HAVE_STRUCT_IOVEC 1 */ + +/* Define to 1 if the system has the type `struct msghdr'. */ +/* #define HAVE_STRUCT_MSGHDR 1 */ + +/* Define to 1 if the system has the type `struct sockaddr'. */ +#define HAVE_STRUCT_SOCKADDR 1 + +/* Define if struct sockaddr has field sa_len. */ +/* #undef HAVE_STRUCT_SOCKADDR_SA_LEN */ + +/* Define to 1 if the system has the type `struct sockaddr_storage'. */ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* define if you have struct spwd */ +/* #undef HAVE_STRUCT_SPWD */ + +/* Define if struct tm has field tm_gmtoff. */ +/* #undef HAVE_STRUCT_TM_TM_GMTOFF */ + +/* Define if struct tm has field tm_zone. */ +/* #undef HAVE_STRUCT_TM_TM_ZONE */ + +/* Define if struct utmpx has field ut_exit. */ +/* #undef HAVE_STRUCT_UTMPX_UT_EXIT */ + +/* Define if struct utmpx has field ut_syslen. */ +/* #undef HAVE_STRUCT_UTMPX_UT_SYSLEN */ + +/* Define if struct utmp has field ut_addr. */ +/* #define HAVE_STRUCT_UTMP_UT_ADDR 1 */ + +/* Define if struct utmp has field ut_host. */ +/* #define HAVE_STRUCT_UTMP_UT_HOST 1 */ + +/* Define if struct utmp has field ut_id. */ +/* #define HAVE_STRUCT_UTMP_UT_ID 1 */ + +/* Define if struct utmp has field ut_pid. */ +/* #define HAVE_STRUCT_UTMP_UT_PID 1 */ + +/* Define if struct utmp has field ut_type. */ +/* #define HAVE_STRUCT_UTMP_UT_TYPE 1 */ + +/* Define if struct utmp has field ut_user. */ +/* #define HAVE_STRUCT_UTMP_UT_USER 1 */ + +/* define if struct winsize is declared in sys/termios.h */ +/* #define HAVE_STRUCT_WINSIZE 1 */ + +/* Define to 1 if you have the `strunvis' function. */ +/* #undef HAVE_STRUNVIS */ + +/* Define if you have the function `strupr'. */ +#define HAVE_STRUPR 1 + +/* Define to 1 if you have the `strvis' function. */ +/* #undef HAVE_STRVIS */ + +/* Define to 1 if you have the `strvisx' function. */ +/* #undef HAVE_STRVISX */ + +/* Define to 1 if you have the `svis' function. */ +/* #undef HAVE_SVIS */ + +/* Define if you have the function `swab'. */ +#define HAVE_SWAB 1 + +/* Define to 1 if you have the `sysconf' function. */ +/* #define HAVE_SYSCONF 1 */ + +/* Define to 1 if you have the `sysctl' function. */ +/* #undef HAVE_SYSCTL */ + +/* syslog is provided for _win32 in lib/roken */ + +/* Define to 1 if you have the `syslog' function. */ +#define HAVE_SYSLOG 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSLOG_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BITYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BSWAP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_CAPABILITY_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_CATEGORY_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_FILE_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_FILIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_IOCCOM_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_IOCTL_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_MMAN_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_PARAM_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PROC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PTYIO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PTYVAR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_PTY_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_RESOURCE_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_SELECT_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_SOCKET_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STREAM_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STROPTS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STRTTY_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STR_TTY_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SYSCALL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SYSCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_TERMIO_H 1 */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIMEB_H 1 + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_TIMES_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_TIME_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_TTY_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UCRED_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_UIO_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_UN_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_UTSNAME_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_SYS_WAIT_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_TERMCAP_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_TERMIOS_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_TERMIO_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TERM_H */ + +/* Define to 1 if you have the `tgetent' function. */ +/* #define HAVE_TGETENT 1 */ + +/* Define if you have the function `timegm'. */ +/* #define HAVE_TIMEGM 1 */ + +/* Define if you have the `timezone' variable. */ +#define HAVE_TIMEZONE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_TMPDIR_H */ + +/* Define to 1 if you have the `ttyname' function. */ +/* #define HAVE_TTYNAME 1 */ + +/* Define to 1 if you have the `ttyslot' function. */ +/* #define HAVE_TTYSLOT 1 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UDB_H */ + +/* Define to 1 if the system has the type `uint16_t'. */ +/* #define HAVE_UINT16_T 1 */ + +/* Define to 1 if the system has the type `uint32_t'. */ +/* #define HAVE_UINT32_T 1 */ + +/* Define to 1 if the system has the type `uint64_t'. */ +/* #define HAVE_UINT64_T 1 */ + +/* Define to 1 if the system has the type `uint8_t'. */ +/* #define HAVE_UINT8_T 1 */ + +/* Define to 1 if the system has the type `uintptr_t'. */ +#define HAVE_UINTPTR_T 1 + +/* Define to 1 if you have the `umask' function. */ +/* #define HAVE_UMASK 1 */ + +/* Define to 1 if you have the `uname' function. */ +/* #define HAVE_UNAME 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_UNISTD_H 1 */ + +/* Define to 1 if you have the `unlockpt' function. */ +/* #define HAVE_UNLOCKPT 1 */ + +/* Define if you have the function `unsetenv'. */ +/* #define HAVE_UNSETENV 1 */ + +/* Define to 1 if you have the `unvis' function. */ +/* #undef HAVE_UNVIS */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_USERCONF_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_USERSEC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_UTIL_H */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_UTMPX_H 1 */ + +/* Define to 1 if you have the header file. */ +/* #define HAVE_UTMP_H 1 */ + +/* Define to 1 if the system has the type `u_int16_t'. */ +/* #define HAVE_U_INT16_T 1 */ + +/* Define to 1 if the system has the type `u_int32_t'. */ +/* #define HAVE_U_INT32_T 1 */ + +/* Define to 1 if the system has the type `u_int64_t'. */ +/* #define HAVE_U_INT64_T 1 */ + +/* Define to 1 if the system has the type `u_int8_t'. */ +/* #define HAVE_U_INT8_T 1 */ + +/* Define to 1 if you have the `vasnprintf' function. */ +/* #undef HAVE_VASNPRINTF */ + +/* Define to 1 if you have the `vasprintf' function. */ +/* #define HAVE_VASPRINTF 1 */ + +/* Define if you have the function `verr'. */ +/* #define HAVE_VERR 1 */ + +/* Define if you have the function `verrx'. */ +/* #define HAVE_VERRX 1 */ + +/* Define to 1 if you have the `vhangup' function. */ +/* #define HAVE_VHANGUP 1 */ + +/* Define to 1 if you have the `vis' function. */ +/* #undef HAVE_VIS */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_VIS_H */ + +/* define if you have a working vsnprintf */ +/* snprintf() and vsnprintf() do exist. But the implementations are + not C99 compliant. */ +/* #define HAVE_VSNPRINTF 1 */ + +/* Define if you have the function `vsyslog'. */ +#define HAVE_VSYSLOG 1 + +/* Define if you have the function `vwarn'. */ +/* #define HAVE_VWARN 1 */ + +/* Define if you have the function `vwarnx'. */ +/* #define HAVE_VWARNX 1 */ + +/* Define if you have the function `warn'. */ +/* #define HAVE_WARN 1 */ + +/* Define if you have the function `warnx'. */ +/* #define HAVE_WARNX 1 */ + +/* Define if you have the function `writev'. */ +/* #define HAVE_WRITEV 1 */ + +/* Defined if we have WinSock */ +#define HAVE_WINSOCK 1 + +/* define if struct winsize has ws_xpixel */ +/* #define HAVE_WS_XPIXEL 1 */ + +/* define if struct winsize has ws_ypixel */ +/* #define HAVE_WS_YPIXEL 1 */ + +/* Define to 1 if you have the `XauFileName' function. */ +/* #undef HAVE_XAUFILENAME */ + +/* Define to 1 if you have the `XauReadAuth' function. */ +/* #undef HAVE_XAUREADAUTH */ + +/* Define to 1 if you have the `XauWriteAuth' function. */ +/* #undef HAVE_XAUWRITEAUTH */ + +/* Define to 1 if you have the `yp_get_default_domain' function. */ +/* #undef HAVE_YP_GET_DEFAULT_DOMAIN */ + +/* Define to 1 if you have the `_getpty' function. */ +/* #undef HAVE__GETPTY */ + +/* Define if you have the `_res' variable. */ +/* #undef HAVE__RES */ + +/* Define to 1 if you have the `_scrsize' function. */ +/* #undef HAVE__SCRSIZE */ + +/* define if your compiler has __attribute__ */ +/* #define HAVE___ATTRIBUTE__ 1 */ + +/* Define if you have the `__progname' variable. */ +/* #define HAVE___PROGNAME 1 */ + +/* Define if you have the hesiod package. */ +/* #undef HESIOD */ + +/* Define if you are running IRIX 4. */ +/* #undef IRIX4 */ + +/* define if the system is missing a prototype for asnprintf() */ +/* #define NEED_ASNPRINTF_PROTO 1 */ + +/* define if the system is missing a prototype for asprintf() */ +/* #undef NEED_ASPRINTF_PROTO */ + +/* define if the system is missing a prototype for crypt() */ +/* #undef NEED_CRYPT_PROTO */ + +/* define if the system is missing a prototype for daemon() */ +/* #undef NEED_DAEMON_PROTO */ + +/* define if the system is missing a prototype for gethostname() */ +/* #undef NEED_GETHOSTNAME_PROTO */ + +/* define if the system is missing a prototype for getusershell() */ +/* #undef NEED_GETUSERSHELL_PROTO */ + +/* define if the system is missing a prototype for glob() */ +/* #undef NEED_GLOB_PROTO */ + +/* define if the system is missing a prototype for hstrerror() */ +/* #undef NEED_HSTRERROR_PROTO */ + +/* define if the system is missing a prototype for inet_aton() */ +/* #undef NEED_INET_ATON_PROTO */ + +/* define if the system is missing a prototype for iruserok() */ +/* #undef NEED_IRUSEROK_PROTO */ + +/* define if the system is missing a prototype for mkstemp() */ +/* #define NEED_MKSTEMP_PROTO 1 */ + +/* define if the system is missing a prototype for SecKeyGetCSPHandle() */ +/* #undef NEED_SECKEYGETCSPHANDLE_PROTO */ + +/* define if the system is missing a prototype for setenv() */ +/* #undef NEED_SETENV_PROTO */ + +/* define if the system is missing a prototype for snprintf() */ +/* #undef NEED_SNPRINTF_PROTO */ + +/* define if the system is missing a prototype for strndup() */ +/* #undef NEED_STRNDUP_PROTO */ + +/* define if the system is missing a prototype for strsep() */ +/* #undef NEED_STRSEP_PROTO */ + +/* define if the system is missing a prototype for strsvis() */ +/* #define NEED_STRSVIS_PROTO 1 */ + +/* define if the system is missing a prototype for strtok_r() */ +#define NEED_STRTOK_R_PROTO 1 + +/* define if the system is missing a prototype for strunvis() */ +/* #define NEED_STRUNVIS_PROTO 1 */ + +/* define if the system is missing a prototype for strvisx() */ +/* #define NEED_STRVISX_PROTO 1 */ + +/* define if the system is missing a prototype for strvis() */ +/* #define NEED_STRVIS_PROTO 1 */ + +/* define if the system is missing a prototype for svis() */ +/* #define NEED_SVIS_PROTO 1 */ + +/* define if the system is missing a prototype for unsetenv() */ +/* #undef NEED_UNSETENV_PROTO */ + +/* define if the system is missing a prototype for unvis() */ +/* #define NEED_UNVIS_PROTO 1 */ + +/* define if the system is missing a prototype for vasnprintf() */ +/* #define NEED_VASNPRINTF_PROTO 1 */ + +/* define if the system is missing a prototype for vasprintf() */ +/* #undef NEED_VASPRINTF_PROTO */ + +/* define if the system is missing a prototype for vis() */ +/* #define NEED_VIS_PROTO 1 */ + +/* define if the system is missing a prototype for vsnprintf() */ +/* #undef NEED_VSNPRINTF_PROTO */ + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Define if you don't want to use mmap. */ +#define NO_MMAP 1 + +#define NO_RAND_EGD_METHOD 1 + +/* Define if the Unix rand method is not defined */ +#define NO_RAND_UNIX_METHOD 1 + +/* Define if fd_sets aren't limited to FD_SETSIZE sockets */ +#define NO_LIMIT_FD_SETSIZE 1 + +/* Define if sleep() is not available */ +#define NO_SLEEP 1 + +/* Define this to enable old environment option in telnet. */ +/* #define OLD_ENVIRON 1 */ + +/* define if prototype of openlog is compatible with void openlog(const char + *, int, int) */ +#define OPENLOG_PROTO_COMPATIBLE 1 + +/* Define if getlogin has POSIX flavour (and not BSD). */ +/* #define POSIX_GETLOGIN 1 */ + +/* Define if getpwnam_r has POSIX flavour. */ +/* #define POSIX_GETPWNAM_R 1 */ + +/* Define if you have the readline package. */ +#define READLINE 1 + +/* Define if rename() does not unlink an existing file */ +#define RENAME_DOES_NOT_UNLINK 1 + +/* Define if you want to use samba socket wrappers. */ +/* #undef SOCKET_WRAPPER_REPLACE */ + +/* Define if a socket is not a file descriptor */ +#define SOCKET_IS_NOT_AN_FD 1 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define if you have streams ptys. */ +/* #undef STREAMSPTY */ + +/* Define to 1 if you can safely include both and . */ +/* #define TIME_WITH_SYS_TIME 1 */ + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* define if target is big endian */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to 1 if the X Window System is missing or not being used. */ +#define X_DISPLAY_MISSING 1 + +/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a + `char[]'. */ +/* #undef YYTEXT_POINTER */ + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define to enable extensions on glibc-based systems such as Linux. */ +/* #define _GNU_SOURCE 1 */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Set this to the default system lead string for telnetd + * can contain %-escapes: %s=sysname, %m=machine, %r=os-release + * %v=os-version, %t=tty, %h=hostname, %d=date and time + */ +/* #undef USE_IM */ + +/* Used with login -p */ +/* #undef LOGIN_ARGS */ + +#ifdef ROKEN_RENAME +#include "roken_rename.h" +#endif + +#define RETSIGTYPE void + +#define VOID_RETSIGTYPE 1 + +#ifdef VOID_RETSIGTYPE +#define SIGRETURN(x) return +#else +#define SIGRETURN(x) return (RETSIGTYPE)(x) +#endif + +typedef int pid_t; + +typedef unsigned int gid_t; + +typedef unsigned int uid_t; + +typedef unsigned short mode_t; + +#ifndef __cplusplus +#define inline __inline +#endif + +#if defined(ENCRYPTION) && !defined(AUTHENTICATION) +#define AUTHENTICATION 1 +#endif + + + +/* Paths */ + +#define SYSCONFDIR "%{COMMON_APPDATA}\\@PACKAGE@" + +#define LIBDIR "%{COMMON_APPDATA}\\@PACKAGE@\\lib" + +#define LIBEXECDIR "%{COMMON_APPDATA}\\@PACKAGE@\\libexec" + +#define LOCALSTATEDIR "%{COMMON_APPDATA}\\@PACKAGE@" + +#define SBINDIR "%{COMMON_APPDATA}\\@PACKAGE@\\sbin" + +#define BINDIR "%{COMMON_APPDATA}\\@PACKAGE@\\bin" + +#endif /* RC_INVOKED */ + + +/* Version info */ + +#define PACKAGE "@PACKAGE@" + +#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" + +#define PACKAGE_NAME "@PACKAGE_NAME@" + +#define PACKAGE_STRING "@PACKAGE_NAME@ @PACKAGE_VERSION@" + +#define PACKAGE_TARNAME "@PACKAGE@" + +#define PACKAGE_VERSION "@PACKAGE_VERSION@" + +#define PACKAGE_COMPANY "@PACKAGE_COMPANY@" + +#define PACKAGE_COPYRIGHT "@PACKAGE_COPYRIGHT@" + +#define VERSION "@PACKAGE_VERSION@" + +#define RC_PRODVER_MAJOR @MAJOR@ + +#define RC_PRODVER_MINOR @MINOR@ + +#define RC_PRODVER_AUX @AUX@ + +#define RC_PRODVER_PATCH @PATCH@ + +#define RC_PRODVER_C @MAJOR@,@MINOR@,@AUX@,@PATCH@ + +#define RC_PRODVER_CS "@MAJOR@,@MINOR@,@AUX@,@PATCH@" + +#define RC_PRODVER_DS "@MAJOR@.@MINOR@.@AUX@.@PATCH@" + +#define RC_PRODUCT_NAME_0409 PACKAGE_NAME + +#define RC_PRODUCT_VER_0409 PACKAGE_VERSION + +#define RC_COMPANY_0409 PACKAGE_COMPANY + +#define RC_COPYRIGHT_0409 PACKAGE_COPYRIGHT + +@VERSION_OPTDEFS@ + +#endif /* __CONFIG_H__ */ diff --git a/include/gssapi/NTMakefile b/include/gssapi/NTMakefile new file mode 100644 index 000000000..2f0e83b33 --- /dev/null +++ b/include/gssapi/NTMakefile @@ -0,0 +1,34 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=include\gssapi + +!include ../../windows/NTMakefile.w32 diff --git a/include/hcrypto/NTMakefile b/include/hcrypto/NTMakefile new file mode 100644 index 000000000..fd56cec73 --- /dev/null +++ b/include/hcrypto/NTMakefile @@ -0,0 +1,34 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=include\hcrypto + +!include ../../windows/NTMakefile.w32 diff --git a/include/kadm5/NTMakefile b/include/kadm5/NTMakefile new file mode 100644 index 000000000..26fc8d02b --- /dev/null +++ b/include/kadm5/NTMakefile @@ -0,0 +1,34 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=include\kadm5 + +!include ../../windows/NTMakefile.w32 diff --git a/include/krb5-types.h.w32 b/include/krb5-types.h.w32 new file mode 100644 index 000000000..a5630823e --- /dev/null +++ b/include/krb5-types.h.w32 @@ -0,0 +1,61 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifndef __krb5_types_h__ +#define __krb5_types_h__ + +#ifndef __BIT_TYPES_DEFINED__ +#define __BIT_TYPES_DEFINED__ + +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef __int64 int64_t; +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned __int64 uint64_t; +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +typedef uint64_t u_int64_t; + +#endif /* __BIT_TYPES_DEFINED__ */ + +typedef int krb5_socklen_t; + +#ifdef _WIN64 +typedef __int64 krb5_ssize_t; +#else +typedef int krb5_ssize_t; +#endif + +#endif /* __krb5_types_h__ */ diff --git a/kadmin/NTMakefile b/kadmin/NTMakefile new file mode 100644 index 000000000..d1524de9c --- /dev/null +++ b/kadmin/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=kadmin + +!include ../windows/NTMakefile.w32 + diff --git a/kcm/NTMakefile b/kcm/NTMakefile new file mode 100644 index 000000000..4f25946f6 --- /dev/null +++ b/kcm/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=kcm + +!include ../windows/NTMakefile.w32 + diff --git a/kdc/NTMakefile b/kdc/NTMakefile new file mode 100644 index 000000000..b17e24cea --- /dev/null +++ b/kdc/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=kdc + +!include ../windows/NTMakefile.w32 + diff --git a/kpasswd/NTMakefile b/kpasswd/NTMakefile new file mode 100644 index 000000000..9ed486a48 --- /dev/null +++ b/kpasswd/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=kpasswd + +!include ../windows/NTMakefile.w32 + diff --git a/kuser/NTMakefile b/kuser/NTMakefile new file mode 100644 index 000000000..eb0bb5498 --- /dev/null +++ b/kuser/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=kuser + +!include ../windows/NTMakefile.w32 + diff --git a/lib/45/NTMakefile b/lib/45/NTMakefile new file mode 100644 index 000000000..1844f93b5 --- /dev/null +++ b/lib/45/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=.\lib\45 + +!include ../../windows/NTMakefile.w32 + diff --git a/lib/NTMakefile b/lib/NTMakefile new file mode 100644 index 000000000..148d5801e --- /dev/null +++ b/lib/NTMakefile @@ -0,0 +1,54 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + + +!ifdef KRB4 +dir_45 = 45 +!endif +!ifdef OTP +dir_otp = otp +!endif +!ifdef DCE +dir_dce = kdfs +!endif +!ifndef HAVE_OPENSSL +dir_hcrypto = hcrypto +!endif + +SUBDIRS = roken vers editline com_err sl wind asn1 sqlite \ + $(dir_hcrypto) hx509 krb5 ntlm kafs gssapi hdb kadm5 \ + auth $(dir_45) $(dir_otp) $(dir_dce) + +!include ../windows/NTMakefile.w32 + +all:: subdirs + +clean:: clean-subdirs diff --git a/lib/asn1/NTMakefile b/lib/asn1/NTMakefile new file mode 100644 index 000000000..fe22f88cd --- /dev/null +++ b/lib/asn1/NTMakefile @@ -0,0 +1,690 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\asn1 + +!include ../../windows/NTMakefile.w32 + +gen_files_k5 = \ + $(OBJ)\asn1_AD_AND_OR.x \ + $(OBJ)\asn1_AD_IF_RELEVANT.x \ + $(OBJ)\asn1_AD_KDCIssued.x \ + $(OBJ)\asn1_AD_MANDATORY_FOR_KDC.x \ + $(OBJ)\asn1_AD_LoginAlias.x \ + $(OBJ)\asn1_APOptions.x \ + $(OBJ)\asn1_AP_REP.x \ + $(OBJ)\asn1_AP_REQ.x \ + $(OBJ)\asn1_AS_REP.x \ + $(OBJ)\asn1_AS_REQ.x \ + $(OBJ)\asn1_AUTHDATA_TYPE.x \ + $(OBJ)\asn1_Authenticator.x \ + $(OBJ)\asn1_AuthorizationData.x \ + $(OBJ)\asn1_AuthorizationDataElement.x \ + $(OBJ)\asn1_CKSUMTYPE.x \ + $(OBJ)\asn1_ChangePasswdDataMS.x \ + $(OBJ)\asn1_Checksum.x \ + $(OBJ)\asn1_ENCTYPE.x \ + $(OBJ)\asn1_ETYPE_INFO.x \ + $(OBJ)\asn1_ETYPE_INFO2.x \ + $(OBJ)\asn1_ETYPE_INFO2_ENTRY.x \ + $(OBJ)\asn1_ETYPE_INFO_ENTRY.x \ + $(OBJ)\asn1_EncAPRepPart.x \ + $(OBJ)\asn1_EncASRepPart.x \ + $(OBJ)\asn1_EncKDCRepPart.x \ + $(OBJ)\asn1_EncKrbCredPart.x \ + $(OBJ)\asn1_EncKrbPrivPart.x \ + $(OBJ)\asn1_EncTGSRepPart.x \ + $(OBJ)\asn1_EncTicketPart.x \ + $(OBJ)\asn1_EncryptedData.x \ + $(OBJ)\asn1_EncryptionKey.x \ + $(OBJ)\asn1_EtypeList.x \ + $(OBJ)\asn1_HostAddress.x \ + $(OBJ)\asn1_HostAddresses.x \ + $(OBJ)\asn1_KDCOptions.x \ + $(OBJ)\asn1_KDC_REP.x \ + $(OBJ)\asn1_KDC_REQ.x \ + $(OBJ)\asn1_KDC_REQ_BODY.x \ + $(OBJ)\asn1_KRB_CRED.x \ + $(OBJ)\asn1_KRB_ERROR.x \ + $(OBJ)\asn1_KRB_PRIV.x \ + $(OBJ)\asn1_KRB_SAFE.x \ + $(OBJ)\asn1_KRB_SAFE_BODY.x \ + $(OBJ)\asn1_KerberosString.x \ + $(OBJ)\asn1_KerberosTime.x \ + $(OBJ)\asn1_KrbCredInfo.x \ + $(OBJ)\asn1_LR_TYPE.x \ + $(OBJ)\asn1_LastReq.x \ + $(OBJ)\asn1_MESSAGE_TYPE.x \ + $(OBJ)\asn1_METHOD_DATA.x \ + $(OBJ)\asn1_NAME_TYPE.x \ + $(OBJ)\asn1_PADATA_TYPE.x \ + $(OBJ)\asn1_PA_DATA.x \ + $(OBJ)\asn1_PA_ENC_SAM_RESPONSE_ENC.x \ + $(OBJ)\asn1_PA_ENC_TS_ENC.x \ + $(OBJ)\asn1_PA_PAC_REQUEST.x \ + $(OBJ)\asn1_PA_S4U2Self.x \ + $(OBJ)\asn1_PA_SAM_CHALLENGE_2.x \ + $(OBJ)\asn1_PA_SAM_CHALLENGE_2_BODY.x \ + $(OBJ)\asn1_PA_SAM_REDIRECT.x \ + $(OBJ)\asn1_PA_SAM_RESPONSE_2.x \ + $(OBJ)\asn1_PA_SAM_TYPE.x \ + $(OBJ)\asn1_PA_ClientCanonicalized.x \ + $(OBJ)\asn1_PA_ClientCanonicalizedNames.x \ + $(OBJ)\asn1_PA_SvrReferralData.x \ + $(OBJ)\asn1_PA_ServerReferralData.x \ + $(OBJ)\asn1_PA_SERVER_REFERRAL_DATA.x \ + $(OBJ)\asn1_PROV_SRV_LOCATION.x \ + $(OBJ)\asn1_Principal.x \ + $(OBJ)\asn1_PrincipalName.x \ + $(OBJ)\asn1_Realm.x \ + $(OBJ)\asn1_SAMFlags.x \ + $(OBJ)\asn1_TGS_REP.x \ + $(OBJ)\asn1_TGS_REQ.x \ + $(OBJ)\asn1_TYPED_DATA.x \ + $(OBJ)\asn1_Ticket.x \ + $(OBJ)\asn1_TicketFlags.x \ + $(OBJ)\asn1_TransitedEncoding.x \ + $(OBJ)\asn1_TypedData.x \ + $(OBJ)\asn1_krb5int32.x \ + $(OBJ)\asn1_krb5uint32.x \ + $(OBJ)\asn1_KRB5SignedPathData.x \ + $(OBJ)\asn1_KRB5SignedPathPrincipals.x \ + $(OBJ)\asn1_KRB5SignedPath.x + +gen_files_cms = \ + $(OBJ)\asn1_CMSAttributes.x \ + $(OBJ)\asn1_CMSCBCParameter.x \ + $(OBJ)\asn1_CMSEncryptedData.x \ + $(OBJ)\asn1_CMSIdentifier.x \ + $(OBJ)\asn1_CMSRC2CBCParameter.x \ + $(OBJ)\asn1_CMSVersion.x \ + $(OBJ)\asn1_CertificateList.x \ + $(OBJ)\asn1_CertificateRevocationLists.x \ + $(OBJ)\asn1_CertificateSet.x \ + $(OBJ)\asn1_ContentEncryptionAlgorithmIdentifier.x \ + $(OBJ)\asn1_ContentInfo.x \ + $(OBJ)\asn1_ContentType.x \ + $(OBJ)\asn1_DigestAlgorithmIdentifier.x \ + $(OBJ)\asn1_DigestAlgorithmIdentifiers.x \ + $(OBJ)\asn1_EncapsulatedContentInfo.x \ + $(OBJ)\asn1_EncryptedContent.x \ + $(OBJ)\asn1_EncryptedContentInfo.x \ + $(OBJ)\asn1_EncryptedKey.x \ + $(OBJ)\asn1_EnvelopedData.x \ + $(OBJ)\asn1_IssuerAndSerialNumber.x \ + $(OBJ)\asn1_KeyEncryptionAlgorithmIdentifier.x \ + $(OBJ)\asn1_KeyTransRecipientInfo.x \ + $(OBJ)\asn1_MessageDigest.x \ + $(OBJ)\asn1_OriginatorInfo.x \ + $(OBJ)\asn1_RecipientIdentifier.x \ + $(OBJ)\asn1_RecipientInfo.x \ + $(OBJ)\asn1_RecipientInfos.x \ + $(OBJ)\asn1_SignatureAlgorithmIdentifier.x \ + $(OBJ)\asn1_SignatureValue.x \ + $(OBJ)\asn1_SignedData.x \ + $(OBJ)\asn1_SignerIdentifier.x \ + $(OBJ)\asn1_SignerInfo.x \ + $(OBJ)\asn1_SignerInfos.x \ + $(OBJ)\asn1_id_pkcs7.x \ + $(OBJ)\asn1_id_pkcs7_data.x \ + $(OBJ)\asn1_id_pkcs7_digestedData.x \ + $(OBJ)\asn1_id_pkcs7_encryptedData.x \ + $(OBJ)\asn1_id_pkcs7_envelopedData.x \ + $(OBJ)\asn1_id_pkcs7_signedAndEnvelopedData.x \ + $(OBJ)\asn1_id_pkcs7_signedData.x \ + $(OBJ)\asn1_UnprotectedAttributes.x + +gen_files_rfc2459 = \ + $(OBJ)\asn1_Version.x \ + $(OBJ)\asn1_id_pkcs_1.x \ + $(OBJ)\asn1_id_pkcs1_rsaEncryption.x \ + $(OBJ)\asn1_id_pkcs1_md2WithRSAEncryption.x \ + $(OBJ)\asn1_id_pkcs1_md5WithRSAEncryption.x \ + $(OBJ)\asn1_id_pkcs1_sha1WithRSAEncryption.x \ + $(OBJ)\asn1_id_pkcs1_sha256WithRSAEncryption.x \ + $(OBJ)\asn1_id_pkcs1_sha384WithRSAEncryption.x \ + $(OBJ)\asn1_id_pkcs1_sha512WithRSAEncryption.x \ + $(OBJ)\asn1_id_heim_rsa_pkcs1_x509.x \ + $(OBJ)\asn1_id_pkcs_2.x \ + $(OBJ)\asn1_id_pkcs2_md2.x \ + $(OBJ)\asn1_id_pkcs2_md4.x \ + $(OBJ)\asn1_id_pkcs2_md5.x \ + $(OBJ)\asn1_id_rsa_digestAlgorithm.x \ + $(OBJ)\asn1_id_rsa_digest_md2.x \ + $(OBJ)\asn1_id_rsa_digest_md4.x \ + $(OBJ)\asn1_id_rsa_digest_md5.x \ + $(OBJ)\asn1_id_pkcs_3.x \ + $(OBJ)\asn1_id_pkcs3_rc2_cbc.x \ + $(OBJ)\asn1_id_pkcs3_rc4.x \ + $(OBJ)\asn1_id_pkcs3_des_ede3_cbc.x \ + $(OBJ)\asn1_id_rsadsi_encalg.x \ + $(OBJ)\asn1_id_rsadsi_rc2_cbc.x \ + $(OBJ)\asn1_id_rsadsi_des_ede3_cbc.x \ + $(OBJ)\asn1_id_secsig_sha_1.x \ + $(OBJ)\asn1_id_nistAlgorithm.x \ + $(OBJ)\asn1_id_nist_aes_algs.x \ + $(OBJ)\asn1_id_aes_128_cbc.x \ + $(OBJ)\asn1_id_aes_192_cbc.x \ + $(OBJ)\asn1_id_aes_256_cbc.x \ + $(OBJ)\asn1_id_nist_sha_algs.x \ + $(OBJ)\asn1_id_sha256.x \ + $(OBJ)\asn1_id_sha224.x \ + $(OBJ)\asn1_id_sha384.x \ + $(OBJ)\asn1_id_sha512.x \ + $(OBJ)\asn1_id_dhpublicnumber.x \ + $(OBJ)\asn1_id_x9_57.x \ + $(OBJ)\asn1_id_dsa.x \ + $(OBJ)\asn1_id_dsa_with_sha1.x \ + $(OBJ)\asn1_id_x520_at.x \ + $(OBJ)\asn1_id_at_commonName.x \ + $(OBJ)\asn1_id_at_surname.x \ + $(OBJ)\asn1_id_at_serialNumber.x \ + $(OBJ)\asn1_id_at_countryName.x \ + $(OBJ)\asn1_id_at_localityName.x \ + $(OBJ)\asn1_id_at_streetAddress.x \ + $(OBJ)\asn1_id_at_stateOrProvinceName.x \ + $(OBJ)\asn1_id_at_organizationName.x \ + $(OBJ)\asn1_id_at_organizationalUnitName.x \ + $(OBJ)\asn1_id_at_name.x \ + $(OBJ)\asn1_id_at_givenName.x \ + $(OBJ)\asn1_id_at_initials.x \ + $(OBJ)\asn1_id_at_generationQualifier.x \ + $(OBJ)\asn1_id_at_pseudonym.x \ + $(OBJ)\asn1_id_Userid.x \ + $(OBJ)\asn1_id_domainComponent.x \ + $(OBJ)\asn1_id_x509_ce.x \ + $(OBJ)\asn1_id_uspkicommon_card_id.x \ + $(OBJ)\asn1_id_uspkicommon_piv_interim.x \ + $(OBJ)\asn1_id_netscape.x \ + $(OBJ)\asn1_id_netscape_cert_comment.x \ + $(OBJ)\asn1_id_ms_cert_enroll_domaincontroller.x \ + $(OBJ)\asn1_id_ms_client_authentication.x \ + $(OBJ)\asn1_AlgorithmIdentifier.x \ + $(OBJ)\asn1_AttributeType.x \ + $(OBJ)\asn1_AttributeValue.x \ + $(OBJ)\asn1_TeletexStringx.x \ + $(OBJ)\asn1_DirectoryString.x \ + $(OBJ)\asn1_Attribute.x \ + $(OBJ)\asn1_AttributeTypeAndValue.x \ + $(OBJ)\asn1_AuthorityInfoAccessSyntax.x \ + $(OBJ)\asn1_AccessDescription.x \ + $(OBJ)\asn1_RelativeDistinguishedName.x \ + $(OBJ)\asn1_RDNSequence.x \ + $(OBJ)\asn1_Name.x \ + $(OBJ)\asn1_CertificateSerialNumber.x \ + $(OBJ)\asn1_Time.x \ + $(OBJ)\asn1_Validity.x \ + $(OBJ)\asn1_UniqueIdentifier.x \ + $(OBJ)\asn1_SubjectPublicKeyInfo.x \ + $(OBJ)\asn1_Extension.x \ + $(OBJ)\asn1_Extensions.x \ + $(OBJ)\asn1_TBSCertificate.x \ + $(OBJ)\asn1_Certificate.x \ + $(OBJ)\asn1_Certificates.x \ + $(OBJ)\asn1_ValidationParms.x \ + $(OBJ)\asn1_DomainParameters.x \ + $(OBJ)\asn1_DHPublicKey.x \ + $(OBJ)\asn1_OtherName.x \ + $(OBJ)\asn1_GeneralName.x \ + $(OBJ)\asn1_GeneralNames.x \ + $(OBJ)\asn1_id_x509_ce_keyUsage.x \ + $(OBJ)\asn1_KeyUsage.x \ + $(OBJ)\asn1_id_x509_ce_authorityKeyIdentifier.x \ + $(OBJ)\asn1_KeyIdentifier.x \ + $(OBJ)\asn1_AuthorityKeyIdentifier.x \ + $(OBJ)\asn1_id_x509_ce_subjectKeyIdentifier.x \ + $(OBJ)\asn1_SubjectKeyIdentifier.x \ + $(OBJ)\asn1_id_x509_ce_basicConstraints.x \ + $(OBJ)\asn1_BasicConstraints.x \ + $(OBJ)\asn1_id_x509_ce_nameConstraints.x \ + $(OBJ)\asn1_BaseDistance.x \ + $(OBJ)\asn1_GeneralSubtree.x \ + $(OBJ)\asn1_GeneralSubtrees.x \ + $(OBJ)\asn1_NameConstraints.x \ + $(OBJ)\asn1_id_x509_ce_privateKeyUsagePeriod.x \ + $(OBJ)\asn1_id_x509_ce_certificatePolicies.x \ + $(OBJ)\asn1_id_x509_ce_policyMappings.x \ + $(OBJ)\asn1_id_x509_ce_subjectAltName.x \ + $(OBJ)\asn1_id_x509_ce_issuerAltName.x \ + $(OBJ)\asn1_id_x509_ce_subjectDirectoryAttributes.x \ + $(OBJ)\asn1_id_x509_ce_policyConstraints.x \ + $(OBJ)\asn1_id_x509_ce_extKeyUsage.x \ + $(OBJ)\asn1_ExtKeyUsage.x \ + $(OBJ)\asn1_id_x509_ce_cRLDistributionPoints.x \ + $(OBJ)\asn1_id_x509_ce_deltaCRLIndicator.x \ + $(OBJ)\asn1_id_x509_ce_issuingDistributionPoint.x \ + $(OBJ)\asn1_id_x509_ce_holdInstructionCode.x \ + $(OBJ)\asn1_id_x509_ce_invalidityDate.x \ + $(OBJ)\asn1_id_x509_ce_certificateIssuer.x \ + $(OBJ)\asn1_id_x509_ce_inhibitAnyPolicy.x \ + $(OBJ)\asn1_DistributionPointReasonFlags.x \ + $(OBJ)\asn1_DistributionPointName.x \ + $(OBJ)\asn1_DistributionPoint.x \ + $(OBJ)\asn1_CRLDistributionPoints.x \ + $(OBJ)\asn1_DSASigValue.x \ + $(OBJ)\asn1_DSAPublicKey.x \ + $(OBJ)\asn1_DSAParams.x \ + $(OBJ)\asn1_RSAPublicKey.x \ + $(OBJ)\asn1_RSAPrivateKey.x \ + $(OBJ)\asn1_DigestInfo.x \ + $(OBJ)\asn1_TBSCRLCertList.x \ + $(OBJ)\asn1_CRLCertificateList.x \ + $(OBJ)\asn1_id_x509_ce_cRLNumber.x \ + $(OBJ)\asn1_id_x509_ce_freshestCRL.x \ + $(OBJ)\asn1_id_x509_ce_cRLReason.x \ + $(OBJ)\asn1_CRLReason.x \ + $(OBJ)\asn1_PKIXXmppAddr.x \ + $(OBJ)\asn1_id_pkix.x \ + $(OBJ)\asn1_id_pkix_on.x \ + $(OBJ)\asn1_id_pkix_on_dnsSRV.x \ + $(OBJ)\asn1_id_pkix_on_xmppAddr.x \ + $(OBJ)\asn1_id_pkix_kp.x \ + $(OBJ)\asn1_id_pkix_kp_serverAuth.x \ + $(OBJ)\asn1_id_pkix_kp_clientAuth.x \ + $(OBJ)\asn1_id_pkix_kp_emailProtection.x \ + $(OBJ)\asn1_id_pkix_kp_timeStamping.x \ + $(OBJ)\asn1_id_pkix_kp_OCSPSigning.x \ + $(OBJ)\asn1_id_pkix_pe.x \ + $(OBJ)\asn1_id_pkix_pe_authorityInfoAccess.x \ + $(OBJ)\asn1_id_pkix_pe_proxyCertInfo.x \ + $(OBJ)\asn1_id_pkix_ppl.x \ + $(OBJ)\asn1_id_pkix_ppl_anyLanguage.x \ + $(OBJ)\asn1_id_pkix_ppl_inheritAll.x \ + $(OBJ)\asn1_id_pkix_ppl_independent.x \ + $(OBJ)\asn1_ProxyPolicy.x \ + $(OBJ)\asn1_ProxyCertInfo.x + +gen_files_pkinit = \ + $(OBJ)\asn1_id_pkinit.x \ + $(OBJ)\asn1_id_pkauthdata.x \ + $(OBJ)\asn1_id_pkdhkeydata.x \ + $(OBJ)\asn1_id_pkrkeydata.x \ + $(OBJ)\asn1_id_pkekuoid.x \ + $(OBJ)\asn1_id_pkkdcekuoid.x \ + $(OBJ)\asn1_id_pkinit_san.x \ + $(OBJ)\asn1_id_pkinit_ms_eku.x \ + $(OBJ)\asn1_id_pkinit_ms_san.x \ + $(OBJ)\asn1_id_pkinit_kdf.x \ + $(OBJ)\asn1_id_pkinit_kdf_ah_sha1.x \ + $(OBJ)\asn1_id_pkinit_kdf_ah_sha256.x \ + $(OBJ)\asn1_id_pkinit_kdf_ah_sha512.x \ + $(OBJ)\asn1_MS_UPN_SAN.x \ + $(OBJ)\asn1_DHNonce.x \ + $(OBJ)\asn1_KDFAlgorithmId.x \ + $(OBJ)\asn1_TrustedCA.x \ + $(OBJ)\asn1_ExternalPrincipalIdentifier.x \ + $(OBJ)\asn1_ExternalPrincipalIdentifiers.x \ + $(OBJ)\asn1_PA_PK_AS_REQ.x \ + $(OBJ)\asn1_PKAuthenticator.x \ + $(OBJ)\asn1_AuthPack.x \ + $(OBJ)\asn1_TD_TRUSTED_CERTIFIERS.x \ + $(OBJ)\asn1_TD_INVALID_CERTIFICATES.x \ + $(OBJ)\asn1_KRB5PrincipalName.x \ + $(OBJ)\asn1_AD_INITIAL_VERIFIED_CAS.x \ + $(OBJ)\asn1_DHRepInfo.x \ + $(OBJ)\asn1_PA_PK_AS_REP.x \ + $(OBJ)\asn1_KDCDHKeyInfo.x \ + $(OBJ)\asn1_ReplyKeyPack.x \ + $(OBJ)\asn1_TD_DH_PARAMETERS.x \ + $(OBJ)\asn1_PKAuthenticator_Win2k.x \ + $(OBJ)\asn1_AuthPack_Win2k.x \ + $(OBJ)\asn1_TrustedCA_Win2k.x \ + $(OBJ)\asn1_PA_PK_AS_REQ_Win2k.x \ + $(OBJ)\asn1_PA_PK_AS_REP_Win2k.x \ + $(OBJ)\asn1_KDCDHKeyInfo_Win2k.x \ + $(OBJ)\asn1_ReplyKeyPack_Win2k.x \ + $(OBJ)\asn1_PkinitSP80056AOtherInfo.x \ + $(OBJ)\asn1_PkinitSuppPubInfo.x + +gen_files_pkcs12 = \ + $(OBJ)\asn1_id_pkcs_12.x \ + $(OBJ)\asn1_id_pkcs_12PbeIds.x \ + $(OBJ)\asn1_id_pbeWithSHAAnd128BitRC4.x \ + $(OBJ)\asn1_id_pbeWithSHAAnd40BitRC4.x \ + $(OBJ)\asn1_id_pbeWithSHAAnd3_KeyTripleDES_CBC.x \ + $(OBJ)\asn1_id_pbeWithSHAAnd2_KeyTripleDES_CBC.x \ + $(OBJ)\asn1_id_pbeWithSHAAnd128BitRC2_CBC.x \ + $(OBJ)\asn1_id_pbewithSHAAnd40BitRC2_CBC.x \ + $(OBJ)\asn1_id_pkcs12_bagtypes.x \ + $(OBJ)\asn1_id_pkcs12_keyBag.x \ + $(OBJ)\asn1_id_pkcs12_pkcs8ShroudedKeyBag.x \ + $(OBJ)\asn1_id_pkcs12_certBag.x \ + $(OBJ)\asn1_id_pkcs12_crlBag.x \ + $(OBJ)\asn1_id_pkcs12_secretBag.x \ + $(OBJ)\asn1_id_pkcs12_safeContentsBag.x \ + $(OBJ)\asn1_PKCS12_MacData.x \ + $(OBJ)\asn1_PKCS12_PFX.x \ + $(OBJ)\asn1_PKCS12_AuthenticatedSafe.x \ + $(OBJ)\asn1_PKCS12_CertBag.x \ + $(OBJ)\asn1_PKCS12_Attribute.x \ + $(OBJ)\asn1_PKCS12_Attributes.x \ + $(OBJ)\asn1_PKCS12_SafeBag.x \ + $(OBJ)\asn1_PKCS12_SafeContents.x \ + $(OBJ)\asn1_PKCS12_OctetString.x \ + $(OBJ)\asn1_PKCS12_PBEParams.x + +gen_files_pkcs8 = \ + $(OBJ)\asn1_PKCS8PrivateKeyAlgorithmIdentifier.x \ + $(OBJ)\asn1_PKCS8PrivateKey.x \ + $(OBJ)\asn1_PKCS8PrivateKeyInfo.x \ + $(OBJ)\asn1_PKCS8Attributes.x \ + $(OBJ)\asn1_PKCS8EncryptedPrivateKeyInfo.x \ + $(OBJ)\asn1_PKCS8EncryptedData.x + +gen_files_pkcs9 = \ + $(OBJ)\asn1_id_pkcs_9.x \ + $(OBJ)\asn1_id_pkcs9_contentType.x \ + $(OBJ)\asn1_id_pkcs9_emailAddress.x \ + $(OBJ)\asn1_id_pkcs9_messageDigest.x \ + $(OBJ)\asn1_id_pkcs9_signingTime.x \ + $(OBJ)\asn1_id_pkcs9_countersignature.x \ + $(OBJ)\asn1_id_pkcs_9_at_friendlyName.x \ + $(OBJ)\asn1_id_pkcs_9_at_localKeyId.x \ + $(OBJ)\asn1_id_pkcs_9_at_certTypes.x \ + $(OBJ)\asn1_id_pkcs_9_at_certTypes_x509.x \ + $(OBJ)\asn1_PKCS9_BMPString.x \ + $(OBJ)\asn1_PKCS9_friendlyName.x + +gen_files_test = \ + $(OBJ)\asn1_TESTAlloc.x \ + $(OBJ)\asn1_TESTAllocInner.x \ + $(OBJ)\asn1_TESTCONTAINING.x \ + $(OBJ)\asn1_TESTCONTAININGENCODEDBY.x \ + $(OBJ)\asn1_TESTCONTAININGENCODEDBY2.x \ + $(OBJ)\asn1_TESTChoice1.x \ + $(OBJ)\asn1_TESTChoice2.x \ + $(OBJ)\asn1_TESTDer.x \ + $(OBJ)\asn1_TESTENCODEDBY.x \ + $(OBJ)\asn1_TESTImplicit.x \ + $(OBJ)\asn1_TESTImplicit2.x \ + $(OBJ)\asn1_TESTInteger.x \ + $(OBJ)\asn1_TESTInteger2.x \ + $(OBJ)\asn1_TESTInteger3.x \ + $(OBJ)\asn1_TESTLargeTag.x \ + $(OBJ)\asn1_TESTSeq.x \ + $(OBJ)\asn1_TESTUSERCONSTRAINED.x \ + $(OBJ)\asn1_TESTSeqOf.x \ + $(OBJ)\asn1_TESTOSSize1.x \ + $(OBJ)\asn1_TESTSeqSizeOf1.x \ + $(OBJ)\asn1_TESTSeqSizeOf2.x \ + $(OBJ)\asn1_TESTSeqSizeOf3.x \ + $(OBJ)\asn1_TESTSeqSizeOf4.x + +gen_files_digest = \ + $(OBJ)\asn1_DigestError.x \ + $(OBJ)\asn1_DigestInit.x \ + $(OBJ)\asn1_DigestInitReply.x \ + $(OBJ)\asn1_DigestREP.x \ + $(OBJ)\asn1_DigestREQ.x \ + $(OBJ)\asn1_DigestRepInner.x \ + $(OBJ)\asn1_DigestReqInner.x \ + $(OBJ)\asn1_DigestRequest.x \ + $(OBJ)\asn1_DigestResponse.x \ + $(OBJ)\asn1_DigestTypes.x \ + $(OBJ)\asn1_NTLMInit.x \ + $(OBJ)\asn1_NTLMInitReply.x \ + $(OBJ)\asn1_NTLMRequest.x \ + $(OBJ)\asn1_NTLMResponse.x + +gen_files_kx509 = \ + $(OBJ)\asn1_Kx509Response.x \ + $(OBJ)\asn1_Kx509Request.x + +asn1_binaries = \ + $(BINDIR)\asn1_compile.exe \ + $(BINDIR)\asn1_print.exe \ + $(BINDIR)\asn1_gen.exe + +$(BINDIR)\asn1_compile.exe: \ + $(OBJ)\gen.obj \ + $(OBJ)\gen_copy.obj \ + $(OBJ)\gen_decode.obj \ + $(OBJ)\gen_encode.obj \ + $(OBJ)\gen_free.obj \ + $(OBJ)\gen_glue.obj \ + $(OBJ)\gen_length.obj \ + $(OBJ)\gen_seq.obj \ + $(OBJ)\hash.obj \ + $(OBJ)\lex.obj \ + $(OBJ)\main.obj \ + $(OBJ)\parse.obj \ + $(OBJ)\symbol.obj + $(EXECONLINK) $(LIBROKEN) $(LIBVERS) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(OBJ)\lex.c: lex.l $(OBJ)\parse.h + $(LEX) -o$@ lex.l + +$(OBJ)\parse.c $(OBJ)\parse.h: parse.y + $(YACC) -o $(OBJ)\parse.c --defines=$(OBJ)\parse.h $** + +$(OBJ)\asn1_err.c $(OBJ)\asn1_err.h: asn1_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\asn1_err.et + cd $(SRCDIR) + +$(BINDIR)\asn1_print.exe: $(OBJ)\asn1_print.obj $(LIBASN1) + $(EXECONLINK) $(LIBVERS) $(LIBROKEN) $(LIBCOMERR) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(BINDIR)\asn1_gen.exe: $(OBJ)\asn1_gen.obj $(LIBASN1) + $(EXECONLINK) $(LIBVERS) $(LIBROKEN) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(LIBASN1): \ + $(OBJ)\der.obj \ + $(OBJ)\der_get.obj \ + $(OBJ)\der_put.obj \ + $(OBJ)\der_free.obj \ + $(OBJ)\der_length.obj \ + $(OBJ)\der_copy.obj \ + $(OBJ)\der_cmp.obj \ + $(OBJ)\der_format.obj \ + $(OBJ)\extra.obj \ + $(OBJ)\timegm.obj \ + $(gen_files_rfc2459:.x=.obj) \ + $(gen_files_cms:.x=.obj) \ + $(gen_files_k5:.x=.obj) \ + $(gen_files_pkinit:.x=.obj) \ + $(gen_files_pkcs8:.x=.obj) \ + $(gen_files_pkcs9:.x=.obj) \ + $(gen_files_pkcs12:.x=.obj) \ + $(gen_files_digest:.x=.obj) \ + $(gen_files_kx509:.x=.obj) \ + $(OBJ)\asn1_err.obj + $(LIBCON_C) /OUT:$@ @<< +$(**: = +) +<< + +clean:: + -$(RM) $(LIBASN1) + +$(gen_files_k5:.x=.c) : $$(@R).x + +$(gen_files_pkinit:.x=.c) : $$(@R).x + +$(gen_files_pkcs8:.x=.c) : $$(@R).x + +$(gen_files_pkcs9:.x=.c) : $$(@R).x + +$(gen_files_pkcs12:.x=.c) : $$(@R).x + +$(gen_files_digest:.x=.c) : $$(@R).x + +$(gen_files_kx509:.x=.c) : $$(@R).x + +$(gen_files_rfc2459:.x=.c) : $$(@R).x + +$(gen_files_cms:.x=.c) : $$(@R).x + +$(gen_files_test:.x=.c) : $$(@R).x + +$(gen_files_k5) $(OBJ)\krb5_asn1.h: $(BINDIR)\asn1_compile.exe k5.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe \ + --encode-rfc1510-bit-string \ + --sequence=KRB5SignedPathPrincipals \ + --sequence=AuthorizationData \ + --sequence=METHOD-DATA \ + --sequence=ETYPE-INFO \ + --sequence=ETYPE-INFO2 \ + $(SRCDIR)\k5.asn1 krb5_asn1 \ + || ($(RM) $(OBJ)\krb5_asn1.h ; exit /b 1) + cd $(SRCDIR) + +$(gen_files_pkinit) $(OBJ)\pkinit_asn1.h: $(BINDIR)\asn1_compile.exe pkinit.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe $(SRCDIR)\pkinit.asn1 pkinit_asn1 \ + || ($(RM) $(OBJ)\pkinit_asn1.h ; exit /b 1) + cd $(SRCDIR) + +$(gen_files_pkcs8) $(OBJ)\pkcs8_asn1.h: $(BINDIR)\asn1_compile.exe pkcs8.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe $(SRCDIR)\pkcs8.asn1 pkcs8_asn1 \ + || ($(RM) $(OBJ)\pkcs8_asn1.h ; exit /b 1) + cd $(SRCDIR) + +$(gen_files_pkcs9) $(OBJ)\pkcs9_asn1.h: $(BINDIR)\asn1_compile.exe pkcs9.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe $(SRCDIR)\pkcs9.asn1 pkcs9_asn1 \ + || ($(RM) $(OBJ)\pkcs9_asn1.h ; exit /b 1) + cd $(SRCDIR) + +$(gen_files_pkcs12) $(OBJ)\pkcs12_asn1.h: $(BINDIR)\asn1_compile.exe pkcs12.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe $(SRCDIR)\pkcs12.asn1 pkcs12_asn1 \ + || ($(RM) $(OBJ)\pkcs12_asn1.h ; exit /b 1) + cd $(SRCDIR) + +$(gen_files_digest) $(OBJ)\digest_asn1.h: $(BINDIR)\asn1_compile.exe digest.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe $(SRCDIR)\digest.asn1 digest_asn1 \ + || ($(RM) $(OBJ)\digest_asn1.h ; exit /b 1) + cd $(SRCDIR) + +$(gen_files_kx509) $(OBJ)\kx509_asn1.h: $(BINDIR)\asn1_compile.exe kx509.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe $(SRCDIR)\kx509.asn1 kx509_asn1 \ + || ($(RM) $(OBJ)\kx509_asn1.h ; exit /b 1) + cd $(SRCDIR) + +$(gen_files_rfc2459) $(OBJ)\rfc2459_asn1.h: $(BINDIR)\asn1_compile.exe rfc2459.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe \ + --preserve-binary=TBSCertificate \ + --preserve-binary=TBSCRLCertList \ + --preserve-binary=Name \ + --sequence=GeneralNames \ + --sequence=Extensions \ + --sequence=CRLDistributionPoints \ + $(SRCDIR)\rfc2459.asn1 rfc2459_asn1 \ + || ($(RM) $(OBJ)\krb5_asn1.h ; exit /b 1) + cd $(SRCDIR) + +$(gen_files_cms) $(OBJ)\cms_asn1.h: $(BINDIR)\asn1_compile.exe cms.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe $(SRCDIR)\CMS.asn1 cms_asn1 \ + || ($(RM) $(OBJ)\cms_asn1.h ; exit /b 1) + cd $(SRCDIR) + +$(gen_files_test) $(OBJ)\test_asn1.h: $(BINDIR)\asn1_compile.exe test.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe \ + --sequence=TESTSeqOf \ + $(SRCDIR)\test.asn1 test_asn1 \ + || ($(RM) $(OBJ)\test_asn1.h ; exit /b 1) + cd $(SRCDIR) + +INCFILES=$(INCDIR)\der.h $(INCDIR)\heim_asn1.h $(INCDIR)\der-protos.h \ + $(OBJ)\asn1_err.h + +$(INCDIR)\der-protos.h: $(OBJ)\der-protos.h + +GENINCFILES= \ + $(INCDIR)\asn1_err.h \ + $(INCDIR)\cms_asn1.h \ + $(INCDIR)\digest_asn1.h \ + $(INCDIR)\krb5_asn1.h \ + $(INCDIR)\kx509_asn1.h \ + $(INCDIR)\pkcs12_asn1.h \ + $(INCDIR)\pkcs8_asn1.h \ + $(INCDIR)\pkcs9_asn1.h \ + $(INCDIR)\pkinit_asn1.h \ + $(INCDIR)\rfc2459_asn1.h + +libasn1_SOURCES= \ + der-protos.h \ + der_locl.h \ + der.c \ + der.h \ + der_get.c \ + der_put.c \ + der_free.c \ + der_length.c \ + der_copy.c \ + der_cmp.c \ + der_format.c \ + heim_asn1.h \ + extra.c \ + timegm.c + +$(OBJ)\der-protos.h: $(libasn1_SOURCES:der-protos.h=) + $(PERL) ..\..\cf\make-proto.pl -q -P remove -o $(OBJ)\der-protos.h $(libasn1_SOURCES) || $(RM) $(OBJ)\der-protos.h + +clean:: + -$(RM) $(INCDIR)\der-protos.h + +all:: $(INCFILES) $(GENINCFILES) $(LIBASN1) $(asn1_binaries) + +TEST_BINARIES=\ + $(OBJ)\check-der.exe \ + $(OBJ)\check-gen.exe \ + $(OBJ)\check-timegm.exe + +test-binaries: $(TEST_BINARIES) + +test-run: + +test:: test-binaries test-run + +{$(OBJ)}.c{$(OBJ)}.obj: + $(C2OBJ) -I$(SRCDIR) -I$(OBJ) + +{}.c{$(OBJ)}.obj: + $(C2OBJ) -I$(SRCDIR) -I$(OBJ) + diff --git a/lib/asn1/asn1-common.h b/lib/asn1/asn1-common.h index 4c6af8b45..fd5762e19 100644 --- a/lib/asn1/asn1-common.h +++ b/lib/asn1/asn1-common.h @@ -2,6 +2,9 @@ #include #include +#ifndef HAVE_INT32_T +#include +#endif #ifndef __asn1_common_definitions__ #define __asn1_common_definitions__ diff --git a/lib/auth/NTMakefile b/lib/auth/NTMakefile new file mode 100644 index 000000000..1ad2c5334 --- /dev/null +++ b/lib/auth/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\auth + +!include ../../windows/NTMakefile.w32 + diff --git a/lib/auth/afskauthlib/NTMakefile b/lib/auth/afskauthlib/NTMakefile new file mode 100644 index 000000000..8e6bc8a76 --- /dev/null +++ b/lib/auth/afskauthlib/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\auth\afskauthlib + +!include ../../../windows/NTMakefile.w32 + diff --git a/lib/auth/pam/NTMakefile b/lib/auth/pam/NTMakefile new file mode 100644 index 000000000..9a9eb351c --- /dev/null +++ b/lib/auth/pam/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\auth\pam + +!include ../../../windows/NTMakefile.w32 + diff --git a/lib/auth/sia/NTMakefile b/lib/auth/sia/NTMakefile new file mode 100644 index 000000000..b6a8cee0b --- /dev/null +++ b/lib/auth/sia/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\auth\sia + +!include ../../../windows/NTMakefile.w32 + diff --git a/lib/com_err/NTMakefile b/lib/com_err/NTMakefile new file mode 100644 index 000000000..fe8adb151 --- /dev/null +++ b/lib/com_err/NTMakefile @@ -0,0 +1,88 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR = lib\com_err + +!include ../../windows/NTMakefile.w32 + +INCFILES=$(INCDIR)\com_err.h $(INCDIR)\com_right.h + +libcomerr_OBJs=$(OBJ)\error.obj $(OBJ)\com_err.obj + +COMERRDLL=$(BINDIR)\com_err.dll + +!ifdef STATICLIBS + +$(LIBCOMERR): $(libcomerr_OBJs) + $(LIBCON) + +!else + +$(LIBCOMERR): $(COMERRDLL) + +$(COMERRDLL): $(libcomerr_OBJs) $(OBJ)\libcom_err-version.res + $(DLLGUILINK_C) -OUT:$(COMERRDLL) -IMPLIB:$(LIBCOMERR) $** \ + $(LIBROKEN) \ + -DEF:libcom_err-exports.def + $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +!endif + +$(BINDIR)\compile_et.exe: $(OBJ)\parse.obj $(OBJ)\lex.obj $(OBJ)\compile_et.obj + $(EXECONLINK) $(LIBROKEN) $(LIBVERS) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(OBJ)\parse.obj: $(OBJ)\parse.c + $(C2OBJ) -I$(SRC)\$(RELDIR) + +$(OBJ)\lex.obj: $(OBJ)\lex.c + $(C2OBJ) -I$(SRC)\$(RELDIR) + +$(OBJ)\compile_et.obj: compile_et.c + $(C2OBJ) -I$(OBJ) + +$(OBJ)\parse.c: parse.y + $(YACC) -o $@ --defines=$(OBJ)\parse.h parse.y + +$(OBJ)\lex.c: lex.l + $(LEX) -o$@ lex.l + +all:: $(INCFILES) $(LIBCOMERR) $(BINDIR)\compile_et.exe + +clean:: + -$(RM) $(LIBCOMERR) + -$(RM) $(INCFILES) + -$(RM) $(COMERRDLL) + diff --git a/lib/com_err/compile_et.c b/lib/com_err/compile_et.c index a28e51f8d..500663af9 100644 --- a/lib/com_err/compile_et.c +++ b/lib/com_err/compile_et.c @@ -220,6 +220,10 @@ main(int argc, char **argv) p = strrchr(filename, '/'); +#ifdef BACKSLASH_PATH_DELIM + if (!p) + p = strrchr(filename, '\\'); +#endif if(p) p++; else diff --git a/lib/com_err/libcom_err-exports.def b/lib/com_err/libcom_err-exports.def new file mode 100644 index 000000000..974ec2ae3 --- /dev/null +++ b/lib/com_err/libcom_err-exports.def @@ -0,0 +1,12 @@ +EXPORTS + com_right + free_error_table + initialize_error_table_r + add_to_error_table + com_err + com_err_va + error_message + error_table_name + init_error_table + reset_com_err_hook + set_com_err_hook diff --git a/lib/com_err/libcom_err-version.rc b/lib/com_err/libcom_err-version.rc new file mode 100644 index 000000000..5f38c1f7c --- /dev/null +++ b/lib/com_err/libcom_err-version.rc @@ -0,0 +1,36 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#define RC_FILE_TYPE VFT_DLL +#define RC_FILE_COMMENT_0409 "Some comment" +#define RC_FILE_ORIG_0409 "com_err.dll" + +#include "../../windows/version.rc" diff --git a/lib/editline/NTMakefile b/lib/editline/NTMakefile new file mode 100644 index 000000000..6c4eb60bd --- /dev/null +++ b/lib/editline/NTMakefile @@ -0,0 +1,62 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR = lib\editline + +!include ../../windows/NTMakefile.w32 + +libeditline_la_OBJS = \ + $(OBJ)\complete.obj \ + $(OBJ)\editline.obj \ + $(OBJ)\syswin.obj + +$(LIBDIR)\libeditline.lib: $(libeditline_la_OBJS) + $(LIBCON) + +$(OBJ)\testit.exe: $(OBJ)\testit.obj $(LIBEDITLINE) $(LIBROKEN) $(LIBVERS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +all:: $(LIBEDITLINE) + +clean:: + -$(RM) $(LIBEDITLINE) + +test-binaries: $(OBJ)\testit.exe + +run-test: + cd $(OBJ) + testit.exe + cd $(SRC)\lib\editline + +test:: test-binaries run-test diff --git a/lib/editline/edit_locl.h b/lib/editline/edit_locl.h index f2419bbd6..178f57ac0 100644 --- a/lib/editline/edit_locl.h +++ b/lib/editline/edit_locl.h @@ -33,7 +33,9 @@ typedef struct direct DIRENTRY; #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif /* !defined(S_ISDIR) */ +#ifndef HAVE_CHAR typedef unsigned char CHAR; +#endif #define MEM_INC 64 #define SCREEN_INC 256 diff --git a/lib/editline/editline.c b/lib/editline/editline.c index f02bf51e5..29c7189ef 100644 --- a/lib/editline/editline.c +++ b/lib/editline/editline.c @@ -455,7 +455,7 @@ ceol(void) static void clear_line(void) { - Point = -strlen(Prompt); + Point = -(int)strlen(Prompt); TTYput('\r'); ceol(); Point = 0; diff --git a/lib/editline/syswin.c b/lib/editline/syswin.c new file mode 100644 index 000000000..1f05073d9 --- /dev/null +++ b/lib/editline/syswin.c @@ -0,0 +1,47 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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 +#include "edit_locl.h" + +void +rl_ttyset(int Reset) +{ +} + +void +rl_add_slash(char *path, char *p, size_t len) +{ + struct stat Sb; + + if (stat(path, &Sb) >= 0) + strlcat(p, S_ISDIR(Sb.st_mode) ? "\\" : " ", len); +} diff --git a/lib/gssapi/NTMakefile b/lib/gssapi/NTMakefile new file mode 100644 index 000000000..b00e14e24 --- /dev/null +++ b/lib/gssapi/NTMakefile @@ -0,0 +1,499 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\gssapi + +!include ../../windows/NTMakefile.w32 + +krb5src = \ + krb5/8003.c \ + krb5/accept_sec_context.c \ + krb5/acquire_cred.c \ + krb5/add_cred.c \ + krb5/address_to_krb5addr.c \ + krb5/arcfour.c \ + krb5/canonicalize_name.c \ + krb5/ccache_name.c \ + krb5/cfx.c \ + krb5/cfx.h \ + krb5/compare_name.c \ + krb5/compat.c \ + krb5/context_time.c \ + krb5/copy_ccache.c \ + krb5/decapsulate.c \ + krb5/delete_sec_context.c \ + krb5/display_name.c \ + krb5/display_status.c \ + krb5/duplicate_name.c \ + krb5/encapsulate.c \ + krb5/export_name.c \ + krb5/export_sec_context.c \ + krb5/external.c \ + krb5/get_mic.c \ + krb5/gsskrb5_locl.h \ + krb5/import_name.c \ + krb5/import_sec_context.c \ + krb5/indicate_mechs.c \ + krb5/init.c \ + krb5/init_sec_context.c \ + krb5/inquire_context.c \ + krb5/inquire_cred.c \ + krb5/inquire_cred_by_mech.c \ + krb5/inquire_cred_by_oid.c \ + krb5/inquire_mechs_for_name.c \ + krb5/inquire_names_for_mech.c \ + krb5/inquire_sec_context_by_oid.c \ + krb5/process_context_token.c \ + krb5/prf.c \ + krb5/release_buffer.c \ + krb5/release_cred.c \ + krb5/release_name.c \ + krb5/sequence.c \ + krb5/set_cred_option.c \ + krb5/set_sec_context_option.c \ + krb5/ticket_flags.c \ + krb5/unwrap.c \ + krb5/v1.c \ + krb5/verify_mic.c \ + krb5/wrap.c + +mechsrc = \ + mech/context.h \ + mech/context.c \ + mech/cred.h \ + mech/gss_accept_sec_context.c \ + mech/gss_acquire_cred.c \ + mech/gss_add_cred.c \ + mech/gss_add_oid_set_member.c \ + mech/gss_buffer_set.c \ + mech/gss_canonicalize_name.c \ + mech/gss_compare_name.c \ + mech/gss_context_time.c \ + mech/gss_create_empty_oid_set.c \ + mech/gss_decapsulate_token.c \ + mech/gss_delete_sec_context.c \ + mech/gss_display_name.c \ + mech/gss_display_status.c \ + mech/gss_duplicate_name.c \ + mech/gss_duplicate_oid.c \ + mech/gss_encapsulate_token.c \ + mech/gss_export_name.c \ + mech/gss_export_sec_context.c \ + mech/gss_get_mic.c \ + mech/gss_import_name.c \ + mech/gss_import_sec_context.c \ + mech/gss_indicate_mechs.c \ + mech/gss_init_sec_context.c \ + mech/gss_inquire_context.c \ + mech/gss_inquire_cred.c \ + mech/gss_inquire_cred_by_mech.c \ + mech/gss_inquire_cred_by_oid.c \ + mech/gss_inquire_mechs_for_name.c \ + mech/gss_inquire_names_for_mech.c \ + mech/gss_krb5.c \ + mech/gss_mech_switch.c \ + mech/gss_names.c \ + mech/gss_oid_equal.c \ + mech/gss_oid_to_str.c \ + mech/gss_process_context_token.c \ + mech/gss_pseudo_random.c \ + mech/gss_release_buffer.c \ + mech/gss_release_cred.c \ + mech/gss_release_name.c \ + mech/gss_release_oid.c \ + mech/gss_release_oid_set.c \ + mech/gss_seal.c \ + mech/gss_set_cred_option.c \ + mech/gss_set_sec_context_option.c \ + mech/gss_sign.c \ + mech/gss_test_oid_set_member.c \ + mech/gss_unseal.c \ + mech/gss_unwrap.c \ + mech/gss_utils.c \ + mech/gss_verify.c \ + mech/gss_verify_mic.c \ + mech/gss_wrap.c \ + mech/gss_wrap_size_limit.c \ + mech/gss_inquire_sec_context_by_oid.c \ + mech/mech_switch.h \ + mech/mechqueue.h \ + mech/mech_locl.h \ + mech/name.h \ + mech/utils.h + +spnegosrc = \ + spnego/accept_sec_context.c \ + spnego/compat.c \ + spnego/context_stubs.c \ + spnego/cred_stubs.c \ + spnego/external.c \ + spnego/init_sec_context.c \ + spnego/spnego_locl.h + +ntlmsrc = \ + ntlm/accept_sec_context.c \ + ntlm/acquire_cred.c \ + ntlm/add_cred.c \ + ntlm/canonicalize_name.c \ + ntlm/compare_name.c \ + ntlm/context_time.c \ + ntlm/crypto.c \ + ntlm/delete_sec_context.c \ + ntlm/display_name.c \ + ntlm/display_status.c \ + ntlm/duplicate_name.c \ + ntlm/export_name.c \ + ntlm/export_sec_context.c \ + ntlm/external.c \ + ntlm/ntlm.h \ + ntlm/import_name.c \ + ntlm/import_sec_context.c \ + ntlm/indicate_mechs.c \ + ntlm/init_sec_context.c \ + ntlm/inquire_context.c \ + ntlm/inquire_cred.c \ + ntlm/inquire_cred_by_mech.c \ + ntlm/inquire_mechs_for_name.c \ + ntlm/inquire_names_for_mech.c \ + ntlm/process_context_token.c \ + ntlm/release_cred.c \ + ntlm/release_name.c \ + ntlm/digest.c + +$(OBJ)\ntlm\ntlm-private.h: $(ntlmsrc) + $(PERL) ../../cf/make-proto.pl -q -P remove -p $@ $(ntlmsrc) + +$(OBJ)\krb5\gsskrb5-private.h: $(krb5src) + $(PERL) ../../cf/make-proto.pl -q -P remove -p $@ $(krb5src) + +$(OBJ)\spnego\spnego-private.h: $(spnegosrc) + $(PERL) ../../cf/make-proto.pl -q -P remove -p $@ $(spnegosrc) + +gssapi_files = \ + $(OBJ)\gssapi\asn1_GSSAPIContextToken.x + +spnego_files = \ + $(OBJ)\spnego\asn1_ContextFlags.x \ + $(OBJ)\spnego\asn1_MechType.x \ + $(OBJ)\spnego\asn1_MechTypeList.x \ + $(OBJ)\spnego\asn1_NegotiationToken.x \ + $(OBJ)\spnego\asn1_NegotiationTokenWin.x \ + $(OBJ)\spnego\asn1_NegHints.x \ + $(OBJ)\spnego\asn1_NegTokenInit.x \ + $(OBJ)\spnego\asn1_NegTokenInitWin.x \ + $(OBJ)\spnego\asn1_NegTokenResp.x + +$(gssapi_files:.x=.c): $$(@R).x + +$(spnego_files:.x=.c): $$(@R).x + +$(gssapi_files) $(OBJ)\gssapi\gssapi_asn1.h: $(BINDIR)\asn1_compile.exe mech\gssapi.asn1 + cd $(OBJ)\gssapi + $(BINDIR)\asn1_compile.exe $(SRCDIR)\mech\gssapi.asn1 gssapi_asn1 \ + || ( $(RM) $(OBJ)\gssapi\gssapi_asn1.h ; exit /b 1 ) + cd $(SRCDIR) + +$(spnego_files) $(OBJ)\spnego\spnego_asn1.h: $(BINDIR)\asn1_compile.exe spnego\spnego.asn1 + cd $(OBJ)\spnego + $(BINDIR)\asn1_compile --sequence=MechTypeList $(SRCDIR)\spnego\spnego.asn1 spnego_asn1 \ + || ( $(RM) $(OBJ)\spnego\spnego_asn1.h ; exit /b 1 ) + cd $(SRCDIR) + +$(OBJ)\gkrb5_err.c $(OBJ)\gkrb5_err.h: krb5\gkrb5_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\krb5\gkrb5_err.et + cd $(SRCDIR) + +INCFILES= \ + $(INCDIR)\gssapi.h \ + $(OBJ)\ntlm\ntlm-private.h \ + $(OBJ)\spnego\spnego-private.h \ + $(OBJ)\krb5\gsskrb5-private.h \ + $(OBJ)\gkrb5_err.h \ + $(OBJ)\gssapi\gssapi_asn1.h \ + $(OBJ)\spnego\spnego_asn1.h + +all:: $(INCFILES) + +libgssapi_OBJs= \ + $(OBJ)\krb5\8003.obj \ + $(OBJ)\krb5\accept_sec_context.obj \ + $(OBJ)\krb5\acquire_cred.obj \ + $(OBJ)\krb5\add_cred.obj \ + $(OBJ)\krb5\address_to_krb5addr.obj \ + $(OBJ)\krb5\arcfour.obj \ + $(OBJ)\krb5\canonicalize_name.obj \ + $(OBJ)\krb5\ccache_name.obj \ + $(OBJ)\krb5\cfx.obj \ + $(OBJ)\krb5\compare_name.obj \ + $(OBJ)\krb5\compat.obj \ + $(OBJ)\krb5\context_time.obj \ + $(OBJ)\krb5\copy_ccache.obj \ + $(OBJ)\krb5\decapsulate.obj \ + $(OBJ)\krb5\delete_sec_context.obj \ + $(OBJ)\krb5\display_name.obj \ + $(OBJ)\krb5\display_status.obj \ + $(OBJ)\krb5\duplicate_name.obj \ + $(OBJ)\krb5\encapsulate.obj \ + $(OBJ)\krb5\export_name.obj \ + $(OBJ)\krb5\export_sec_context.obj \ + $(OBJ)\krb5\external.obj \ + $(OBJ)\krb5\get_mic.obj \ + $(OBJ)\krb5\import_name.obj \ + $(OBJ)\krb5\import_sec_context.obj \ + $(OBJ)\krb5\indicate_mechs.obj \ + $(OBJ)\krb5\init.obj \ + $(OBJ)\krb5\init_sec_context.obj \ + $(OBJ)\krb5\inquire_context.obj \ + $(OBJ)\krb5\inquire_cred.obj \ + $(OBJ)\krb5\inquire_cred_by_mech.obj \ + $(OBJ)\krb5\inquire_cred_by_oid.obj \ + $(OBJ)\krb5\inquire_mechs_for_name.obj \ + $(OBJ)\krb5\inquire_names_for_mech.obj \ + $(OBJ)\krb5\inquire_sec_context_by_oid.obj \ + $(OBJ)\krb5\process_context_token.obj \ + $(OBJ)\krb5\prf.obj \ + $(OBJ)\krb5\release_buffer.obj \ + $(OBJ)\krb5\release_cred.obj \ + $(OBJ)\krb5\release_name.obj \ + $(OBJ)\krb5\sequence.obj \ + $(OBJ)\krb5\set_cred_option.obj \ + $(OBJ)\krb5\set_sec_context_option.obj \ + $(OBJ)\krb5\ticket_flags.obj \ + $(OBJ)\krb5\unwrap.obj \ + $(OBJ)\krb5\v1.obj \ + $(OBJ)\krb5\verify_mic.obj \ + $(OBJ)\krb5\wrap.obj \ + $(OBJ)\mech\context.obj \ + $(OBJ)\mech\gss_accept_sec_context.obj \ + $(OBJ)\mech\gss_acquire_cred.obj \ + $(OBJ)\mech\gss_add_cred.obj \ + $(OBJ)\mech\gss_add_oid_set_member.obj \ + $(OBJ)\mech\gss_buffer_set.obj \ + $(OBJ)\mech\gss_canonicalize_name.obj \ + $(OBJ)\mech\gss_compare_name.obj \ + $(OBJ)\mech\gss_context_time.obj \ + $(OBJ)\mech\gss_create_empty_oid_set.obj \ + $(OBJ)\mech\gss_decapsulate_token.obj \ + $(OBJ)\mech\gss_delete_sec_context.obj \ + $(OBJ)\mech\gss_display_name.obj \ + $(OBJ)\mech\gss_display_status.obj \ + $(OBJ)\mech\gss_duplicate_name.obj \ + $(OBJ)\mech\gss_duplicate_oid.obj \ + $(OBJ)\mech\gss_encapsulate_token.obj \ + $(OBJ)\mech\gss_export_name.obj \ + $(OBJ)\mech\gss_export_sec_context.obj \ + $(OBJ)\mech\gss_get_mic.obj \ + $(OBJ)\mech\gss_import_name.obj \ + $(OBJ)\mech\gss_import_sec_context.obj \ + $(OBJ)\mech\gss_indicate_mechs.obj \ + $(OBJ)\mech\gss_init_sec_context.obj \ + $(OBJ)\mech\gss_inquire_context.obj \ + $(OBJ)\mech\gss_inquire_cred.obj \ + $(OBJ)\mech\gss_inquire_cred_by_mech.obj \ + $(OBJ)\mech\gss_inquire_cred_by_oid.obj \ + $(OBJ)\mech\gss_inquire_mechs_for_name.obj \ + $(OBJ)\mech\gss_inquire_names_for_mech.obj \ + $(OBJ)\mech\gss_krb5.obj \ + $(OBJ)\mech\gss_mech_switch.obj \ + $(OBJ)\mech\gss_names.obj \ + $(OBJ)\mech\gss_oid_equal.obj \ + $(OBJ)\mech\gss_oid_to_str.obj \ + $(OBJ)\mech\gss_process_context_token.obj \ + $(OBJ)\mech\gss_pseudo_random.obj \ + $(OBJ)\mech\gss_release_buffer.obj \ + $(OBJ)\mech\gss_release_cred.obj \ + $(OBJ)\mech\gss_release_name.obj \ + $(OBJ)\mech\gss_release_oid.obj \ + $(OBJ)\mech\gss_release_oid_set.obj \ + $(OBJ)\mech\gss_seal.obj \ + $(OBJ)\mech\gss_set_cred_option.obj \ + $(OBJ)\mech\gss_set_sec_context_option.obj \ + $(OBJ)\mech\gss_sign.obj \ + $(OBJ)\mech\gss_test_oid_set_member.obj \ + $(OBJ)\mech\gss_unseal.obj \ + $(OBJ)\mech\gss_unwrap.obj \ + $(OBJ)\mech\gss_utils.obj \ + $(OBJ)\mech\gss_verify.obj \ + $(OBJ)\mech\gss_verify_mic.obj \ + $(OBJ)\mech\gss_wrap.obj \ + $(OBJ)\mech\gss_wrap_size_limit.obj \ + $(OBJ)\mech\gss_inquire_sec_context_by_oid.obj \ + $(OBJ)\ntlm\accept_sec_context.obj \ + $(OBJ)\ntlm\acquire_cred.obj \ + $(OBJ)\ntlm\add_cred.obj \ + $(OBJ)\ntlm\canonicalize_name.obj \ + $(OBJ)\ntlm\compare_name.obj \ + $(OBJ)\ntlm\context_time.obj \ + $(OBJ)\ntlm\crypto.obj \ + $(OBJ)\ntlm\delete_sec_context.obj \ + $(OBJ)\ntlm\display_name.obj \ + $(OBJ)\ntlm\display_status.obj \ + $(OBJ)\ntlm\duplicate_name.obj \ + $(OBJ)\ntlm\export_name.obj \ + $(OBJ)\ntlm\export_sec_context.obj \ + $(OBJ)\ntlm\external.obj \ + $(OBJ)\ntlm\import_name.obj \ + $(OBJ)\ntlm\import_sec_context.obj \ + $(OBJ)\ntlm\indicate_mechs.obj \ + $(OBJ)\ntlm\init_sec_context.obj \ + $(OBJ)\ntlm\inquire_context.obj \ + $(OBJ)\ntlm\inquire_cred.obj \ + $(OBJ)\ntlm\inquire_cred_by_mech.obj \ + $(OBJ)\ntlm\inquire_mechs_for_name.obj \ + $(OBJ)\ntlm\inquire_names_for_mech.obj \ + $(OBJ)\ntlm\process_context_token.obj \ + $(OBJ)\ntlm\release_cred.obj \ + $(OBJ)\ntlm\release_name.obj \ + $(OBJ)\ntlm\digest.obj \ + $(OBJ)\spnego\accept_sec_context.obj \ + $(OBJ)\spnego\compat.obj \ + $(OBJ)\spnego\context_stubs.obj \ + $(OBJ)\spnego\cred_stubs.obj \ + $(OBJ)\spnego\external.obj \ + $(OBJ)\spnego\init_sec_context.obj \ + $(OBJ)\gkrb5_err.obj \ + $(spnego_files:.x=.obj) \ + $(gssapi_files:.x=.obj) + +GCOPTS=-I$(SRCDIR) -I$(OBJ) -DBUILD_GSSAPI_LIB + +{$(OBJ)\krb5}.c{$(OBJ)\krb5}.obj: + $(C2OBJ) -I$(OBJ)\krb5 $(GCOPTS) + +{krb5}.c{$(OBJ)\krb5}.obj: + $(C2OBJ) -I$(OBJ)\krb5 $(GCOPTS) + +{$(OBJ)\mech}.c{$(OBJ)\mech}.obj: + $(C2OBJ) -I$(OBJ)\mech $(GCOPTS) + +{mech}.c{$(OBJ)\mech}.obj: + $(C2OBJ) -I$(OBJ)\mech -I$(OBJ)\gssapi $(GCOPTS) + +{$(OBJ)\ntlm}.c{$(OBJ)\ntlm}.obj: + $(C2OBJ) -I$(OBJ)\ntlm $(GCOPTS) + +{ntlm}.c{$(OBJ)\ntlm}.obj: + $(C2OBJ) -I$(OBJ)\ntlm $(GCOPTS) + +{$(OBJ)\spnego}.c{$(OBJ)\spnego}.obj: + $(C2OBJ) -I$(OBJ)\spnego $(GCOPTS) + +{spnego}.c{$(OBJ)\spnego}.obj: + $(C2OBJ) -I$(OBJ)\spnego $(GCOPTS) + +{$(OBJ)\gssapi}.c{$(OBJ)\gssapi}.obj: + $(C2OBJ) -I$(OBJ)\gssapi $(GCOPTS) + +{}.c{$(OBJ)}.obj: + $(C2OBJ) $(GCOPTS) + +{$(OBJ)}.c{$(OBJ)}.obj: + $(C2OBJ) $(GCOPTS) + +{$(OBJ)\spnego}.x{$(OBJ)\spnego}.c: + $(CP) $** $@ + +{$(OBJ)\gssapi}.x{$(OBJ)\gssapi}.c: + $(CP) $** $@ + +LIBGSSAPI_LIBS=\ + $(LIBROKEN) \ + $(LIBASN1) \ + $(LIBKRB5) \ + $(LIBHCRYPTO) \ + $(LIBHEIMNTLM) \ + $(LIBCOMERR) + +LIBGSSAPI_SDKLIBS=\ + $(PTHREAD_LIB) + +!ifndef STATICLIBS + +$(LIBGSSAPI): $(BINDIR)\libgssapi.dll + +$(BINDIR)\libgssapi.dll: $(libgssapi_OBJs) + $(DLLGUILINK_C) -IMPLIB:$(LIBGSSAPI) \ + -OUT:$(BINDIR)\libgssapi.dll \ + $(LIBGSSAPI_LIBS) $(LIBGSSAPI_SDKLIBS) @<< +$(libgssapi_OBJs: = +) +<< + $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +all:: $(BINDIR)\libgssapi.dll + +clean:: + -$(RM) $(BINDIR)\libgssapi.dll + -$(RM) $(LIBGSSAPI) + +!else + +$(LIBGSSAPI): $(libgssapi_OBJs) + $(LIBCON_C) -OUT:$@ $(LIBGSSAPI_LIBS) $(LIBGSSAPI_SDKLIBS) @<< +$(libgssapi_OBJs: = +) +<< + +all:: $(LIBGSSAPI) + +clean:: + -$(RM) $(LIBGSSAPI) + +!endif + +prep:: mkdirs-gss + +mkdirs-gss: +!if !exist($(OBJ)\ntlm) + $(MKDIR) $(OBJ)\ntlm +!endif +!if !exist($(OBJ)\krb5) + $(MKDIR) $(OBJ)\krb5 +!endif +!if !exist($(OBJ)\spnego) + $(MKDIR) $(OBJ)\spnego +!endif +!if !exist($(OBJ)\mech) + $(MKDIR) $(OBJ)\mech +!endif +!if !exist($(OBJ)\gssapi) + $(MKDIR) $(OBJ)\gssapi +!endif + +clean:: + -$(RM) $(OBJ)\ntlm\*.* + -$(RM) $(OBJ)\krb5\*.* + -$(RM) $(OBJ)\spnego\*.* + -$(RM) $(OBJ)\mech\*.* + -$(RM) $(OBJ)\gssapi\*.* diff --git a/lib/gssapi/gssapi/gssapi.h b/lib/gssapi/gssapi/gssapi.h index 376ac3203..730737a46 100644 --- a/lib/gssapi/gssapi/gssapi.h +++ b/lib/gssapi/gssapi/gssapi.h @@ -45,10 +45,12 @@ #ifndef BUILD_GSSAPI_LIB #if defined(_WIN32) -#define GSSAPI_LIB_FUNCTION _stdcall __declspec(dllimport) +#define GSSAPI_LIB_FUNCTION __declspec(dllimport) +#define GSSAPI_LIB_CALL __stdcall #define GSSAPI_LIB_VARIABLE __declspec(dllimport) #else #define GSSAPI_LIB_FUNCTION +#define GSSAPI_LIB_CALL #define GSSAPI_LIB_VARIABLE #endif #endif diff --git a/lib/gssapi/gssapi/gssapi_krb5.h b/lib/gssapi/gssapi/gssapi_krb5.h index 4d004d90b..1b91bbbb8 100644 --- a/lib/gssapi/gssapi/gssapi_krb5.h +++ b/lib/gssapi/gssapi/gssapi_krb5.h @@ -106,27 +106,27 @@ gss_krb5_ccache_name(OM_uint32 * /*minor_status*/, const char ** /*out_name */); OM_uint32 GSSAPI_LIB_FUNCTION gsskrb5_register_acceptor_identity - (const char */*identity*/); + (const char * /*identity*/); OM_uint32 GSSAPI_LIB_FUNCTION krb5_gss_register_acceptor_identity - (const char */*identity*/); + (const char * /*identity*/); OM_uint32 GSSAPI_LIB_FUNCTION gss_krb5_copy_ccache - (OM_uint32 */*minor*/, + (OM_uint32 * /*minor*/, gss_cred_id_t /*cred*/, - struct krb5_ccache_data */*out*/); + struct krb5_ccache_data * /*out*/); OM_uint32 GSSAPI_LIB_FUNCTION -gss_krb5_import_cred(OM_uint32 */*minor*/, +gss_krb5_import_cred(OM_uint32 * /*minor*/, struct krb5_ccache_data * /*in*/, struct Principal * /*keytab_principal*/, struct krb5_keytab_data * /*keytab*/, - gss_cred_id_t */*out*/); + gss_cred_id_t * /*out*/); OM_uint32 GSSAPI_LIB_FUNCTION gss_krb5_get_tkt_flags - (OM_uint32 */*minor*/, + (OM_uint32 * /*minor*/, gss_ctx_id_t /*context_handle*/, - OM_uint32 */*tkt_flags*/); + OM_uint32 * /*tkt_flags*/); OM_uint32 GSSAPI_LIB_FUNCTION gsskrb5_extract_authz_data_from_sec_context diff --git a/lib/gssapi/ntlm/ntlm.h b/lib/gssapi/ntlm/ntlm.h index 82eb76e0b..ae5fb2211 100644 --- a/lib/gssapi/ntlm/ntlm.h +++ b/lib/gssapi/ntlm/ntlm.h @@ -44,12 +44,13 @@ #include #include +#include + #include #include #include #include -#include #include #include diff --git a/lib/gssapi/spnego/spnego_locl.h b/lib/gssapi/spnego/spnego_locl.h index e8cad1488..dacaa3310 100644 --- a/lib/gssapi/spnego/spnego_locl.h +++ b/lib/gssapi/spnego/spnego_locl.h @@ -44,6 +44,8 @@ #include #endif +#include + #ifdef HAVE_PTHREAD_H #include #endif @@ -69,8 +71,6 @@ #include "utils.h" #include -#include - #define ALLOC(X, N) (X) = calloc((N), sizeof(*(X))) typedef struct { diff --git a/lib/hcrypto/NTMakefile b/lib/hcrypto/NTMakefile new file mode 100644 index 000000000..9fdd4ac1d --- /dev/null +++ b/lib/hcrypto/NTMakefile @@ -0,0 +1,242 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\hcrypto + +AUXCFLAGS=$(AUXCFLAGS) -DKRB5 -I$(INCDIR)\hcrypto + +!include ../../windows/NTMakefile.w32 + +# Include files + +HCRYPTOINCLUDEDIR=$(INCDIR)\hcrypto + +INCFILES= \ + $(HCRYPTOINCLUDEDIR)\aes.h \ + $(HCRYPTOINCLUDEDIR)\bn.h \ + $(HCRYPTOINCLUDEDIR)\des.h \ + $(HCRYPTOINCLUDEDIR)\dh.h \ + $(HCRYPTOINCLUDEDIR)\dsa.h \ + $(HCRYPTOINCLUDEDIR)\engine.h \ + $(HCRYPTOINCLUDEDIR)\evp.h \ + $(HCRYPTOINCLUDEDIR)\hmac.h \ + $(HCRYPTOINCLUDEDIR)\md2.h \ + $(HCRYPTOINCLUDEDIR)\md4.h \ + $(HCRYPTOINCLUDEDIR)\md5.h \ + $(HCRYPTOINCLUDEDIR)\pkcs12.h \ + $(HCRYPTOINCLUDEDIR)\rand.h \ + $(HCRYPTOINCLUDEDIR)\randi.h \ + $(HCRYPTOINCLUDEDIR)\rc2.h \ + $(HCRYPTOINCLUDEDIR)\rc4.h \ + $(HCRYPTOINCLUDEDIR)\rsa.h \ + $(HCRYPTOINCLUDEDIR)\sha.h \ + $(HCRYPTOINCLUDEDIR)\ui.h + +mkincdir: +!if !exist($(HCRYPTOINCLUDEDIR)) + $(MKDIR) $(HCRYPTOINCLUDEDIR) +!endif + +{}.h{$(HCRYPTOINCLUDEDIR)}.h: + $(CP) $** $@ + +all:: mkincdir + +all:: $(INCFILES) + +# libhcrypto + +libhcrypt_OBJs = \ + $(OBJ)\imath.obj \ + $(OBJ)\iprime.obj \ + $(OBJ)\aes.obj \ + $(OBJ)\bn.obj \ + $(OBJ)\camellia.obj \ + $(OBJ)\camellia-ntt.obj \ + $(OBJ)\des.obj \ + $(OBJ)\dh.obj \ + $(OBJ)\dh-imath.obj \ + $(OBJ)\dsa.obj \ + $(OBJ)\evp.obj \ + $(OBJ)\engine.obj \ + $(OBJ)\hmac.obj \ + $(OBJ)\md2.obj \ + $(OBJ)\md4.obj \ + $(OBJ)\md5.obj \ + $(OBJ)\pkcs5.obj \ + $(OBJ)\pkcs12.obj \ + $(OBJ)\rand-fortuna.obj \ + $(OBJ)\rand-timer.obj \ + $(OBJ)\rand.obj \ + $(OBJ)\rc2.obj \ + $(OBJ)\rc4.obj \ + $(OBJ)\rijndael-alg-fst.obj \ + $(OBJ)\rnd_keys.obj \ + $(OBJ)\rsa.obj \ + $(OBJ)\rsa-gmp.obj \ + $(OBJ)\rsa-imath.obj \ + $(OBJ)\sha.obj \ + $(OBJ)\sha256.obj \ + $(OBJ)\ui.obj + +$(LIBHCRYPTO): $(libhcrypt_OBJs) + $(LIBCON) + +{imath/}.c{$(OBJ)}.obj: + $(C2OBJ) + +all:: $(LIBHCRYPTO) + +clean:: + -$(RM) $(LIBHCRYPTO) + +# Tests + +TESTLIB=$(OBJ)\libhctest.lib + +$(TESTLIB): \ + $(OBJ)\imath.obj \ + $(OBJ)\des.obj \ + $(OBJ)\ui.obj + $(LIBCON) + +test-binaries: \ + $(OBJ)\destest.exe \ + $(OBJ)\mdtest.exe \ + $(OBJ)\rc2test.exe \ + $(OBJ)\rctest.exe \ + $(OBJ)\test_bn.exe \ + $(OBJ)\test_cipher.exe \ + $(OBJ)\test_engine_dso.exe \ + $(OBJ)\test_hmac.exe \ + $(OBJ)\test_imath.exe \ + $(OBJ)\test_pkcs5.exe \ + $(OBJ)\test_pkcs12.exe \ + $(OBJ)\test_rsa.exe \ + $(OBJ)\test_dh.exe \ + $(OBJ)\test_rand.exe \ + $(OBJ)\test_crypto.sh + +$(OBJ)\destest.exe: $(OBJ)\destest.obj $(TESTLIB) $(LIBROKEN) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + + +$(OBJ)\mdtest.exe: $(OBJ)\mdtest.obj $(LIBHCRYPTO) $(LIBROKEN) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\rc2test.exe: $(OBJ)\rc2test.obj $(LIBHCRYPTO) $(LIBROKEN) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\rctest.exe: $(OBJ)\rctest.obj $(LIBHCRYPTO) $(LIBROKEN) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_bn.exe: $(OBJ)\test_bn.obj $(LIBHCRYPTO) $(LIBROKEN) $(LIBASN1) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_cipher.exe: $(OBJ)\test_cipher.obj $(LIBHCRYPTO) $(LIBROKEN) $(LIBVERS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_engine_dso.exe: $(OBJ)\test_engine_dso.obj $(LIBHCRYPTO) $(LIBROKEN) $(LIBASN1) $(LIBVERS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_hmac.exe: $(OBJ)\test_hmac.obj $(LIBHCRYPTO) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_imath.exe: $(OBJ)\test_imath.obj $(TESTLIB) $(LIBROKEN) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_pkcs5.exe: $(OBJ)\test_pkcs5.obj $(LIBHCRYPTO) $(LIBROKEN) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_pkcs12.exe: $(OBJ)\test_pkcs12.obj $(LIBHCRYPTO) $(LIBASN1) $(LIBROKEN) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_rsa.exe: $(OBJ)\test_rsa.obj $(LIBHCRYPTO) $(LIBROKEN) $(LIBASN1) $(LIBVERS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_dh.exe: $(OBJ)\test_dh.obj $(LIBHCRYPTO) $(LIBROKEN) $(LIBASN1) $(LIBVERS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_rand.exe: $(OBJ)\test_rand.obj $(LIBHCRYPTO) $(LIBROKEN) $(LIBASN1) $(LIBVERS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test_crypto.sh: test_crypto.in NTMakefile + $(SED) -e "s,[@]srcdir[@],$(SRCDIR),g" -e "s,[@]exeext[@],.exe,g" < test_crypto.in > $@ + +test-run: + cd $(OBJ) + destest.exe + mdtest.exe + rc2test.exe + rctest.exe + test_bn.exe + test_cipher.exe + test_engine_dso.exe + test_hmac.exe + test_imath.exe + test_pkcs5.exe + test_pkcs12.exe +# test_rsa.exe +# test_dh.exe +!ifdef SH + $(SH) test_crypto.sh +!endif + cd $(SRCDIR) + +test:: $(TESTLIB) test-binaries test-run diff --git a/lib/hcrypto/aes.h b/lib/hcrypto/aes.h index 23f8f5d0a..273f1dd56 100644 --- a/lib/hcrypto/aes.h +++ b/lib/hcrypto/aes.h @@ -69,7 +69,7 @@ void AES_encrypt(const unsigned char *, unsigned char *, const AES_KEY *); void AES_decrypt(const unsigned char *, unsigned char *, const AES_KEY *); void AES_cbc_encrypt(const unsigned char *, unsigned char *, - const unsigned long, const AES_KEY *, + unsigned long, const AES_KEY *, unsigned char *, int); #ifdef __cplusplus diff --git a/lib/hcrypto/bn.c b/lib/hcrypto/bn.c index 545d9529d..17c1ec79b 100644 --- a/lib/hcrypto/bn.c +++ b/lib/hcrypto/bn.c @@ -40,6 +40,7 @@ #include #include +#include #include /* XXX */ #include diff --git a/lib/hcrypto/evp.c b/lib/hcrypto/evp.c index 006db3593..72787e185 100644 --- a/lib/hcrypto/evp.c +++ b/lib/hcrypto/evp.c @@ -49,6 +49,7 @@ #include #include +#include #ifndef HCRYPTO_DEF_PROVIDER #define HCRYPTO_DEF_PROVIDER hcrypto diff --git a/lib/hcrypto/hash.h b/lib/hcrypto/hash.h index b8d5d4560..78a795f2a 100644 --- a/lib/hcrypto/hash.h +++ b/lib/hcrypto/hash.h @@ -43,6 +43,7 @@ #ifdef KRB5 #include #endif +#include #ifndef min #define min(a,b) (((a)>(b))?(b):(a)) diff --git a/lib/hcrypto/rand-fortuna.c b/lib/hcrypto/rand-fortuna.c index c39c71390..c81eb9e2d 100644 --- a/lib/hcrypto/rand-fortuna.c +++ b/lib/hcrypto/rand-fortuna.c @@ -35,6 +35,9 @@ #include #include +#ifdef KRB5 +#include +#endif #include #include "randi.h" @@ -451,6 +454,7 @@ fortuna_reseed(void) if (!init_done) abort(); +#ifndef NO_RAND_UNIX_METHOD { unsigned char buf[INIT_BYTES]; if ((*hc_rand_unix_method.bytes)(buf, sizeof(buf)) == 1) { @@ -459,6 +463,7 @@ fortuna_reseed(void) memset(buf, 0, sizeof(buf)); } } +#endif #ifdef HAVE_ARC4RANDOM { uint32_t buf[INIT_BYTES / sizeof(uint32_t)]; @@ -470,6 +475,7 @@ fortuna_reseed(void) entropy_p = 1; } #endif +#ifndef NO_RAND_EGD_METHOD /* * Only to get egd entropy if /dev/random or arc4rand failed since * it can be horribly slow to generate new bits. @@ -482,6 +488,7 @@ fortuna_reseed(void) memset(buf, 0, sizeof(buf)); } } +#endif /* * Fall back to gattering data from timer and secret files, this * is really the last resort. @@ -521,10 +528,12 @@ fortuna_reseed(void) gettimeofday(&tv, NULL); add_entropy(&main_state, (void *)&tv, sizeof(tv)); } +#ifdef HAVE_GETUID { uid_t u = getuid(); add_entropy(&main_state, (void *)&u, sizeof(u)); } +#endif return entropy_p; } diff --git a/lib/hcrypto/rijndael-alg-fst.c b/lib/hcrypto/rijndael-alg-fst.c index 3dd255581..9a7f0fd3d 100644 --- a/lib/hcrypto/rijndael-alg-fst.c +++ b/lib/hcrypto/rijndael-alg-fst.c @@ -31,11 +31,12 @@ #include "config.h" +#include #ifdef KRB5 #include #endif -#include +#include "rijndael-alg-fst.h" /* the file should not be used from outside */ typedef uint8_t u8; diff --git a/lib/hcrypto/rnd_keys.c b/lib/hcrypto/rnd_keys.c index 9baf00212..49c7634c3 100644 --- a/lib/hcrypto/rnd_keys.c +++ b/lib/hcrypto/rnd_keys.c @@ -39,11 +39,11 @@ #ifdef KRB5 #include #endif +#include + #include #include -#include - #undef __attribute__ #define __attribute__(X) diff --git a/lib/hcrypto/test_crypto.in b/lib/hcrypto/test_crypto.in index 131308ce8..5dac31d56 100644 --- a/lib/hcrypto/test_crypto.in +++ b/lib/hcrypto/test_crypto.in @@ -36,9 +36,9 @@ srcdir="@srcdir@" -rsa="${TESTS_ENVIRONMENT} ./test_rsa" -engine="${TESTS_ENVIRONMENT} ./test_engine_dso" -rand="${TESTS_ENVIRONMENT} ./test_rand" +rsa="${TESTS_ENVIRONMENT} ./test_rsa@exeext@" +engine="${TESTS_ENVIRONMENT} ./test_engine_dso@exeext@" +rand="${TESTS_ENVIRONMENT} ./test_rand@exeext@" ${engine} --test-random > /dev/null || { echo "missing random"; exit 77; } diff --git a/lib/hcrypto/test_rand.c b/lib/hcrypto/test_rand.c index 5a73e6428..2b348c7f3 100644 --- a/lib/hcrypto/test_rand.c +++ b/lib/hcrypto/test_rand.c @@ -113,10 +113,14 @@ main(int argc, char **argv) if (rand_method) { if (strcasecmp(rand_method, "fortuna") == 0) RAND_set_rand_method(RAND_fortuna_method()); +#ifndef NO_RAND_UNIX_METHOD else if (strcasecmp(rand_method, "unix") == 0) RAND_set_rand_method(RAND_unix_method()); +#endif +#ifndef NO_RAND_EGD_METHOD else if (strcasecmp(rand_method, "egd") == 0) RAND_set_rand_method(RAND_egd_method()); +#endif else errx(1, "unknown method %s", rand_method); } diff --git a/lib/hcrypto/ui.c b/lib/hcrypto/ui.c index ca8c8442b..f5a197358 100644 --- a/lib/hcrypto/ui.c +++ b/lib/hcrypto/ui.c @@ -37,10 +37,15 @@ #include #include #include +#ifdef HAVE_TERMIOS_H #include +#endif #include #include +#ifdef HAVE_CONIO_H +#include +#endif static sig_atomic_t intr_flag; @@ -50,6 +55,8 @@ intr(int sig) intr_flag++; } +#ifndef HAVE_CONIO_H + #ifndef NSIG #define NSIG 47 #endif @@ -135,6 +142,51 @@ read_string(const char *preprompt, const char *prompt, return 0; } +#else /* CONIO_H */ + +static int +read_string_conio(const char *preprompt, const char *prompt, + char *buf, size_t len, int echo) +{ + int of = 0; + int c; + char *p; + void (*oldsigintr)(int); + + _cprintf("%s%s", preprompt, prompt); + + oldsigintr = signal(SIGINT, intr); + + p = buf; + while(intr_flag == 0){ + c = ((echo)? _getche(): _getch()); + if(c == '\n') + break; + if(of == 0) + *p++ = c; + of = (p == buf + len); + } + if(of) + p--; + *p = 0; + + if(echo == 0){ + printf("\n"); + } + + signal(SIGINT, oldsigintr); + + if(intr_flag) + return -2; + if(of) + return -1; + return 0; +} + +#define read_string read_string_conio + +#endif + int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, int verify) { diff --git a/lib/hdb/NTMakefile b/lib/hdb/NTMakefile new file mode 100644 index 000000000..a8d6193aa --- /dev/null +++ b/lib/hdb/NTMakefile @@ -0,0 +1,161 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\hdb + +!include ../../windows/NTMakefile.w32 + +gen_files_hdb = \ + $(OBJ)\asn1_Salt.x \ + $(OBJ)\asn1_Key.x \ + $(OBJ)\asn1_Event.x \ + $(OBJ)\asn1_HDBFlags.x \ + $(OBJ)\asn1_GENERATION.x \ + $(OBJ)\asn1_HDB_Ext_PKINIT_acl.x \ + $(OBJ)\asn1_HDB_Ext_PKINIT_hash.x \ + $(OBJ)\asn1_HDB_Ext_Constrained_delegation_acl.x \ + $(OBJ)\asn1_HDB_Ext_Lan_Manager_OWF.x \ + $(OBJ)\asn1_HDB_Ext_Password.x \ + $(OBJ)\asn1_HDB_Ext_Aliases.x \ + $(OBJ)\asn1_HDB_extension.x \ + $(OBJ)\asn1_HDB_extensions.x \ + $(OBJ)\asn1_hdb_entry.x \ + $(OBJ)\asn1_hdb_entry_alias.x + +$(gen_files_hdb) $(OBJ)\hdb_asn1.h: $(BINDIR)\asn1_compile.exe hdb.asn1 + cd $(OBJ) + $(BINDIR)\asn1_compile.exe $(SRCDIR)\hdb.asn1 hdb_asn1 + cd $(SRCDIR) + +$(gen_files_hdb:.x=.c): $$(@R).x + +!ifdef OPENLDAP_MODULE + +ldap_dll = $(BINDIR)\hdb_ldap.dll +ldap_lib = $(LIBDIR)\hdb_ldap.lib +ldap_objs = $(OBJ)\hdb-ldap.obj + +$(ldap_dll): $(ldap_objs) + $(DLLGUILINK) -IMPLIB:$(ldap_lib) + $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +clean:: + -$(RM) $(ldap_dll) + -$(RM) $(ldap_lib) + +!else + +ldap = $(OBJ)\hdb-ldap.obj +ldap_c = hdb-ldap.c + +!endif + +dist_libhdb_la_SOURCES = \ + common.c \ + db.c \ + db3.c \ + ext.c \ + $(ldap_c) \ + hdb.c \ + hdb_locl.h \ + hdb-private.h \ + keys.c \ + keytab.c \ + dbinfo.c \ + mkey.c \ + ndbm.c \ + print.c + +libhdb_OBJs= \ + $(OBJ)\common.obj \ + $(OBJ)\db.obj \ + $(OBJ)\db3.obj \ + $(OBJ)\ext.obj \ + $(ldap) \ + $(OBJ)\hdb.obj \ + $(OBJ)\keys.obj \ + $(OBJ)\keytab.obj \ + $(OBJ)\dbinfo.obj \ + $(OBJ)\mkey.obj \ + $(OBJ)\ndbm.obj \ + $(OBJ)\print.obj \ + $(gen_files_hdb:.x=.obj) \ + $(OBJ)\hdb_err.obj + +$(OBJ)\hdb_err.c $(OBJ)\hdb_err.h: hdb_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\hdb_err.et + cd $(SRCDIR) + +$(OBJ)\hdb-protos.h: + $(PERL) ../../cf/make-proto.pl -q -P remove -o $@ $(dist_libhdb_la_SOURCES) \ + || $(RM) $@ + +$(OBJ)\hdb-private.h: + $(PERL) ../../cf/make-proto.pl -q -P remote -p $@ $(dist_libhdb_la_SOURCES) \ + || $(RM) $@ + +INCFILES=\ + $(INCDIR)\hdb.h \ + $(INCDIR)\hdb-protos.h \ + $(OBJ)\hdb-private.h \ + $(INCDIR)\hdb_err.h \ + $(INCDIR)\hdb_asn1.h + +$(LIBHDB): $(libhdb_OBJs) $(ldap_lib) + $(LIBCON) + +all:: $(INCFILES) $(LIBHDB) + +clean:: + -$(RM) $(INCFILES) + -$(RM) $(LIBHDB) + +test:: test-binaries test-run + +test-binaries: $(OBJ)\test_dbinfo.exe + +!ifdef OPENLDAP_INC +openldap_inc_flag=-I$(OPENLDAP_INC) +!else +openldap_inc_flag= +!endif + +hdb_cflags=-D_HDB_DB_DIR=$(DIR_hdbdir) $(openldap_inc_flag) -I$(OBJ) + +{}.c{$(OBJ)}.obj: + $(C2OBJ) $(hdb_cflags) + +{$(OBJ)}.c{$(OBJ)}.obj: + $(C2OBJ) $(hdb_cflags) + diff --git a/lib/hx509/NTMakefile b/lib/hx509/NTMakefile new file mode 100644 index 000000000..d553e5197 --- /dev/null +++ b/lib/hx509/NTMakefile @@ -0,0 +1,231 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\hx509 + +!include ../../windows/NTMakefile.w32 + +gen_files_ocsp = \ + $(OBJ)\asn1_OCSPBasicOCSPResponse.x \ + $(OBJ)\asn1_OCSPCertID.x \ + $(OBJ)\asn1_OCSPCertStatus.x \ + $(OBJ)\asn1_OCSPInnerRequest.x \ + $(OBJ)\asn1_OCSPKeyHash.x \ + $(OBJ)\asn1_OCSPRequest.x \ + $(OBJ)\asn1_OCSPResponderID.x \ + $(OBJ)\asn1_OCSPResponse.x \ + $(OBJ)\asn1_OCSPResponseBytes.x \ + $(OBJ)\asn1_OCSPResponseData.x \ + $(OBJ)\asn1_OCSPResponseStatus.x \ + $(OBJ)\asn1_OCSPSignature.x \ + $(OBJ)\asn1_OCSPSingleResponse.x \ + $(OBJ)\asn1_OCSPTBSRequest.x \ + $(OBJ)\asn1_OCSPVersion.x \ + $(OBJ)\asn1_id_pkix_ocsp.x \ + $(OBJ)\asn1_id_pkix_ocsp_basic.x \ + $(OBJ)\asn1_id_pkix_ocsp_nonce.x + +gen_files_pkcs10 = \ + $(OBJ)\asn1_CertificationRequestInfo.x \ + $(OBJ)\asn1_CertificationRequest.x + +gen_files_crmf = \ + $(OBJ)\asn1_CRMFRDNSequence.x \ + $(OBJ)\asn1_CertReqMessages.x \ + $(OBJ)\asn1_CertReqMsg.x \ + $(OBJ)\asn1_CertRequest.x \ + $(OBJ)\asn1_CertTemplate.x \ + $(OBJ)\asn1_Controls.x \ + $(OBJ)\asn1_PBMParameter.x \ + $(OBJ)\asn1_PKMACValue.x \ + $(OBJ)\asn1_POPOPrivKey.x \ + $(OBJ)\asn1_POPOSigningKey.x \ + $(OBJ)\asn1_POPOSigningKeyInput.x \ + $(OBJ)\asn1_ProofOfPossession.x \ + $(OBJ)\asn1_SubsequentMessage.x + +libhx509_la_OBJS = \ + $(OBJ)\ca.obj \ + $(OBJ)\cert.obj \ + $(OBJ)\cms.obj \ + $(OBJ)\collector.obj \ + $(OBJ)\crypto.obj \ + $(OBJ)\error.obj \ + $(OBJ)\env.obj \ + $(OBJ)\file.obj \ + $(OBJ)\hx509_err.obj \ + $(OBJ)\sel.obj \ + $(OBJ)\sel-gram.obj \ + $(OBJ)\sel-lex.obj \ + $(OBJ)\keyset.obj \ + $(OBJ)\ks_dir.obj \ + $(OBJ)\ks_file.obj \ + $(OBJ)\ks_mem.obj \ + $(OBJ)\ks_null.obj \ + $(OBJ)\ks_p11.obj \ + $(OBJ)\ks_p12.obj \ + $(OBJ)\ks_keychain.obj \ + $(OBJ)\lock.obj \ + $(OBJ)\name.obj \ + $(OBJ)\peer.obj \ + $(OBJ)\print.obj \ + $(OBJ)\softp11.obj \ + $(OBJ)\req.obj \ + $(OBJ)\revoke.obj \ + $(gen_files_ocsp:.x=.obj) \ + $(gen_files_pkcs10:.x=.obj) + +$(LIBHX509): $(libhx509_la_OBJS) + $(LIBCON) + +dist_libhx509_la_SOURCES = \ + $(SRCDIR)\ca.c \ + $(SRCDIR)\cert.c \ + $(SRCDIR)\cms.c \ + $(SRCDIR)\collector.c \ + $(SRCDIR)\crypto.c \ + $(SRCDIR)\doxygen.c \ + $(SRCDIR)\error.c \ + $(SRCDIR)\env.c \ + $(SRCDIR)\file.c \ + $(SRCDIR)\hx509.h \ + $(SRCDIR)\hx_locl.h \ + $(SRCDIR)\sel.c \ + $(SRCDIR)\sel.h \ + $(SRCDIR)\sel-gram.y \ + $(SRCDIR)\sel-lex.l \ + $(SRCDIR)\keyset.c \ + $(SRCDIR)\ks_dir.c \ + $(SRCDIR)\ks_file.c \ + $(SRCDIR)\ks_mem.c \ + $(SRCDIR)\ks_null.c \ + $(SRCDIR)\ks_p11.c \ + $(SRCDIR)\ks_p12.c \ + $(SRCDIR)\ks_keychain.c \ + $(SRCDIR)\lock.c \ + $(SRCDIR)\name.c \ + $(SRCDIR)\peer.c \ + $(SRCDIR)\print.c \ + $(SRCDIR)\softp11.c \ + $(SRCDIR)\ref\pkcs11.h \ + $(SRCDIR)\req.c \ + $(SRCDIR)\revoke.c + +AUXCFLAGS=$(AUXCFLAGS) -I$(SRCDIR)\ref -I$(OBJ) + +asn1_compile=$(BINDIR)\asn1_compile.exe + +$(gen_files_ocsp:.x=.c): $$(@R).x + +$(gen_files_pkcs10:.x=.c): $$(@R).x + +$(gen_files_crmf:.x=.c): $$(@R).x + +$(gen_files_ocsp) $(OBJ)\ocsp_asn1.h: $(asn1_compile) ocsp.asn1 + cd $(OBJ) + $(asn1_compile) \ + --preserve-binary=OCSPTBSRequest \ + --preserve-binary=OCSPResponseData \ + $(SRCDIR)\ocsp.asn1 ocsp_asn1 \ + || ( $(RM) -f $(gen_files_ocsp) $(OBJ)\ocsp_asn1.h ; exit /b 1 ) + cd $(SRCDIR) + +$(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.h: $(asn1_compile) pkcs10.asn1 + cd $(OBJ) + $(asn1_compile) \ + --preserve-binary=CertificationRequestInfo \ + $(SRCDIR)\pkcs10.asn1 pkcs10_asn1 \ + || ( $(RM) -f $(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.h ; exit /b 1 ) + cd $(SRCDIR) + +$(gen_files_crmf) $(OBJ)\crmf_asn1.h: $(asn1_compile) crmf.asn1 + cd $(OBJ) + $(asn1_compile) $(SRCDIR)\crmf.asn1 crmf_asn1 \ + || ( $(RM) -f $(gen_files_crmf) $(OBJ)\crmf_asn1.h ; exit /b 1 ) + cd $(SRCDIR) + +INCFILES= \ + $(INCDIR)\hx509.h \ + $(INCDIR)\hx509-protos.h \ + $(INCDIR)\hx509-private.h \ + $(INCDIR)\hx509_err.h \ + $(INCDIR)\ocsp_asn1.h \ + $(INCDIR)\pkcs10_asn1.h \ + $(INCDIR)\crmf_asn1.h + +hxtool.c: $(OBJ)\hxtool-commands.h + +SLC=$(BINDIR)\slc.exe + +$(OBJ)\hxtool-commands.c $(OBJ)\hxtool-commands.h: hxtool-commands.in $(SLC) + cd $(OBJ) + $(CP) $(SRCDIR)\hxtool-commands.in $(OBJ)\hxtool-commands.in + $(SLC) hxtool-commands.in + cd $(SRCDIR) + +$(BINDIR)\hxtool.exe: $(OBJ)\hxtool.obj $(OBJ)\hxtool-commands.obj $(LIBHX509) + $(EXECONLINK) $(LIBASN1) $(LIBHCRYPTO) $(LIBROKEN) $(LIBSL) $(LIBVERS) $(LIBWIND) $(LIBCOMERR) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(OBJ)\hx509-protos.h: + cd $(OBJ) + $(PERL) $(SRCDIR)\..\..\cf\make-proto.pl -R "^(_|^C)" -E HX509_LIB -q -P remove -o hx509-protos.h $(dist_libhx509_la_SOURCES) || $(RM) -f hx509-protos.h + cd $(SRCDIR) + +$(OBJ)\hx509-private.h: + cd $(OBJ) + $(PERL) $(SRCDIR)\..\..\cf\make-proto.pl -q -P remove -p hx509-private.h $(dist_libhx509_la_SOURCES) || $(RM) -f hx509-private.h + cd $(SRCDIR) + +$(OBJ)\hx509_err.c $(OBJ)\hx509_err.h: hx509_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\hx509_err.et + cd $(SRCDIR) + +$(OBJ)\sel-gram.obj: $(OBJ)\sel-gram.c + $(C2OBJ) -I$(SRCDIR) + +$(OBJ)\sel-lex.obj: $(OBJ)\sel-lex.c + $(C2OBJ) -I$(SRCDIR) -I$(OBJ) + +$(OBJ)\sel-gram.c: sel-gram.y + $(YACC) -o $@ --defines=$(OBJ)\sel-gram.h sel-gram.y + +$(OBJ)\sel-lex.c: sel-lex.l + $(LEX) -o$@ sel-lex.l + +all:: $(INCFILES) $(LIBHX509) $(BINDIR)\hxtool.exe + +clean:: + -$(RM) $(BINDIR)\hxtool.exe + diff --git a/lib/hx509/hx_locl.h b/lib/hx509/hx_locl.h index 2d1c036d5..3e3ab23c6 100644 --- a/lib/hx509/hx_locl.h +++ b/lib/hx509/hx_locl.h @@ -39,16 +39,19 @@ #include #include #include +#ifdef HAVE_STRINGS_H #include +#endif #include #include #include #include +#include + #include #include #include -#include #include #include #include diff --git a/lib/hx509/softp11.c b/lib/hx509/softp11.c index 813209e85..241f32cc7 100644 --- a/lib/hx509/softp11.c +++ b/lib/hx509/softp11.c @@ -31,6 +31,8 @@ * SUCH DAMAGE. */ +#define CRYPTOKI_EXPORTS 1 + #include "hx_locl.h" #include "pkcs11.h" @@ -38,6 +40,14 @@ #define HANDLE_OBJECT_ID(h) ((h) & OBJECT_ID_MASK) #define OBJECT_ID(obj) HANDLE_OBJECT_ID((obj)->object_handle) +#ifndef HAVE_RANDOM +#define random() rand() +#define srandom(s) srand(s) +#endif + +#ifdef _WIN32 +#include +#endif struct st_attr { CK_ATTRIBUTE attribute; @@ -687,6 +697,11 @@ read_conf_file(const char *fn, CK_USER_TYPE userType, const char *pin) CK_RV ret = CKR_OK; CK_RV failed = CKR_OK; + if (fn == NULL) { + st_logf("Can't open configuration file. No file specified\n"); + return CKR_GENERAL_ERROR; + } + f = fopen(fn, "r"); if (f == NULL) { st_logf("can't open configuration file %s\n", fn); @@ -792,7 +807,52 @@ func_not_supported(void) return CKR_FUNCTION_NOT_SUPPORTED; } -CK_RV +static char * +get_config_file_for_user(void) +{ + char *fn = NULL, *home = NULL; + +#ifndef _WIN32 + if (getuid() == geteuid()) { + fn = getenv("SOFTPKCS11RC"); + if (fn) + fn = strdup(fn); + home = getenv("HOME"); + } + if (fn == NULL && home == NULL) { + struct passwd *pw = getpwuid(getuid()); + if(pw != NULL) + home = pw->pw_dir; + } + if (fn == NULL) { + if (home) + asprintf(&fn, "%s/.soft-token.rc", home); + else + fn = strdup("/etc/soft-token.rc"); + } +#else /* Windows */ + + char appdatafolder[MAX_PATH]; + + fn = getenv("SOFTPKCS11RC"); + + /* Retrieve the roaming AppData folder for the current user. The + current user is the user account represented by the current + thread token. */ + + if (fn == NULL && + SUCCEEDED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdatafolder))) { + + asprintf(&fn, "%s\\.soft-token.rc", appdatafolder); + } + +#endif /* _WIN32 */ + + return fn; +} + + +CK_RV CK_SPEC C_Initialize(CK_VOID_PTR a) { CK_C_INITIALIZE_ARGS_PTR args = a; @@ -805,7 +865,7 @@ C_Initialize(CK_VOID_PTR a) OpenSSL_add_all_algorithms(); - srandom(getpid() ^ time(NULL)); + srandom(getpid() ^ (int) time(NULL)); for (i = 0; i < MAX_NUM_SESSION; i++) { soft_token.state[i].session_handle = CK_INVALID_HANDLE; @@ -838,29 +898,7 @@ C_Initialize(CK_VOID_PTR a) st_logf("\tFlags\t%04x\n", (unsigned int)args->flags); } - { - char *fn = NULL, *home = NULL; - - if (getuid() == geteuid()) { - fn = getenv("SOFTPKCS11RC"); - if (fn) - fn = strdup(fn); - home = getenv("HOME"); - } - if (fn == NULL && home == NULL) { - struct passwd *pw = getpwuid(getuid()); - if(pw != NULL) - home = pw->pw_dir; - } - if (fn == NULL) { - if (home) - asprintf(&fn, "%s/.soft-token.rc", home); - else - fn = strdup("/etc/soft-token.rc"); - } - - soft_token.config_file = fn; - } + soft_token.config_file = get_config_file_for_user(); /* * This operations doesn't return CKR_OK if any of the @@ -1456,7 +1494,7 @@ C_Sign(CK_SESSION_HANDLE hSession, struct session_state *state; struct st_object *o; CK_RV ret; - uint hret; + int hret; const AlgorithmIdentifier *alg; heim_octet_string sig, data; diff --git a/lib/kadm5/NTMakefile b/lib/kadm5/NTMakefile new file mode 100644 index 000000000..b7c65b98a --- /dev/null +++ b/lib/kadm5/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\kadm5 + +!include ../../windows/NTMakefile.w32 + diff --git a/lib/kadm5/get_s.c b/lib/kadm5/get_s.c index b96315fca..cec9d265f 100644 --- a/lib/kadm5/get_s.c +++ b/lib/kadm5/get_s.c @@ -61,7 +61,7 @@ add_tl_data(kadm5_principal_ent_t ent, int16_t type, return 0; } -krb5_ssize_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL _krb5_put_int(void *buffer, unsigned long value, size_t size); /* XXX */ kadm5_ret_t diff --git a/lib/kafs/NTMakefile b/lib/kafs/NTMakefile new file mode 100644 index 000000000..4cff3426f --- /dev/null +++ b/lib/kafs/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\kafs + +!include ../../windows/NTMakefile.w32 + diff --git a/lib/kdfs/NTMakefile b/lib/kdfs/NTMakefile new file mode 100644 index 000000000..4ec8f31ad --- /dev/null +++ b/lib/kdfs/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\kdfs + +!include ../../windows/NTMakefile.w32 + diff --git a/lib/krb5/NTMakefile b/lib/krb5/NTMakefile new file mode 100644 index 000000000..777f59c29 --- /dev/null +++ b/lib/krb5/NTMakefile @@ -0,0 +1,442 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\krb5 + +!include ../../windows/NTMakefile.w32 + +libkrb5_OBJS = \ + $(OBJ)\acache.obj \ + $(OBJ)\acl.obj \ + $(OBJ)\add_et_list.obj \ + $(OBJ)\addr_families.obj \ + $(OBJ)\aname_to_localname.obj \ + $(OBJ)\appdefault.obj \ + $(OBJ)\asn1_glue.obj \ + $(OBJ)\auth_context.obj \ + $(OBJ)\build_ap_req.obj \ + $(OBJ)\build_auth.obj \ + $(OBJ)\cache.obj \ + $(OBJ)\changepw.obj \ + $(OBJ)\codec.obj \ + $(OBJ)\config_file.obj \ + $(OBJ)\config_file_netinfo.obj \ + $(OBJ)\convert_creds.obj \ + $(OBJ)\constants.obj \ + $(OBJ)\context.obj \ + $(OBJ)\copy_host_realm.obj \ + $(OBJ)\crc.obj \ + $(OBJ)\creds.obj \ + $(OBJ)\crypto.obj \ + $(OBJ)\data.obj \ + $(OBJ)\digest.obj \ + $(OBJ)\eai_to_heim_errno.obj \ + $(OBJ)\error_string.obj \ + $(OBJ)\expand_hostname.obj \ + $(OBJ)\expand_path_w32.obj \ + $(OBJ)\fcache.obj \ + $(OBJ)\free.obj \ + $(OBJ)\free_host_realm.obj \ + $(OBJ)\generate_seq_number.obj \ + $(OBJ)\generate_subkey.obj \ + $(OBJ)\get_addrs.obj \ + $(OBJ)\get_cred.obj \ + $(OBJ)\get_default_principal.obj \ + $(OBJ)\get_default_realm.obj \ + $(OBJ)\get_for_creds.obj \ + $(OBJ)\get_host_realm.obj \ + $(OBJ)\get_in_tkt.obj \ + $(OBJ)\get_in_tkt_pw.obj \ + $(OBJ)\get_in_tkt_with_keytab.obj \ + $(OBJ)\get_in_tkt_with_skey.obj \ + $(OBJ)\get_port.obj \ + $(OBJ)\init_creds.obj \ + $(OBJ)\init_creds_pw.obj \ + $(OBJ)\kcm.obj \ + $(OBJ)\keyblock.obj \ + $(OBJ)\keytab.obj \ + $(OBJ)\keytab_any.obj \ + $(OBJ)\keytab_file.obj \ + $(OBJ)\keytab_keyfile.obj \ + $(OBJ)\keytab_krb4.obj \ + $(OBJ)\keytab_memory.obj \ + $(OBJ)\krbhst.obj \ + $(OBJ)\kuserok.obj \ + $(OBJ)\log.obj \ + $(OBJ)\mcache.obj \ + $(OBJ)\misc.obj \ + $(OBJ)\mk_error.obj \ + $(OBJ)\mk_priv.obj \ + $(OBJ)\mk_rep.obj \ + $(OBJ)\mk_req.obj \ + $(OBJ)\mk_req_ext.obj \ + $(OBJ)\mk_safe.obj \ + $(OBJ)\mit_glue.obj \ + $(OBJ)\net_read.obj \ + $(OBJ)\net_write.obj \ + $(OBJ)\n-fold.obj \ + $(OBJ)\pac.obj \ + $(OBJ)\padata.obj \ + $(OBJ)\pkinit.obj \ + $(OBJ)\principal.obj \ + $(OBJ)\prog_setup.obj \ + $(OBJ)\prompter_posix.obj \ + $(OBJ)\rd_cred.obj \ + $(OBJ)\rd_error.obj \ + $(OBJ)\rd_priv.obj \ + $(OBJ)\rd_rep.obj \ + $(OBJ)\rd_req.obj \ + $(OBJ)\rd_safe.obj \ + $(OBJ)\read_message.obj \ + $(OBJ)\recvauth.obj \ + $(OBJ)\replay.obj \ + $(OBJ)\scache.obj \ + $(OBJ)\send_to_kdc.obj \ + $(OBJ)\sendauth.obj \ + $(OBJ)\set_default_realm.obj \ + $(OBJ)\sock_principal.obj \ + $(OBJ)\store.obj \ + $(OBJ)\store_emem.obj \ + $(OBJ)\store_fd.obj \ + $(OBJ)\store_mem.obj \ + $(OBJ)\plugin.obj \ + $(OBJ)\ticket.obj \ + $(OBJ)\time.obj \ + $(OBJ)\transited.obj \ + $(OBJ)\v4_glue.obj \ + $(OBJ)\verify_init.obj \ + $(OBJ)\verify_user.obj \ + $(OBJ)\version.obj \ + $(OBJ)\warn.obj \ + $(OBJ)\write_message.obj + +libkrb5_gen_OBJS= \ + $(OBJ)\krb5_err.obj \ + $(OBJ)\krb_err.obj \ + $(OBJ)\heim_err.obj \ + $(OBJ)\k524_err.obj + +INCFILES= \ + $(INCDIR)\heim_err.h \ + $(INCDIR)\heim_threads.h \ + $(INCDIR)\k524_err.h \ + $(INCDIR)\krb_err.h \ + $(INCDIR)\krb5.h \ + $(INCDIR)\krb5_ccapi.h \ + $(INCDIR)\krb5_err.h \ + $(INCDIR)\krb5_locl.h \ + $(INCDIR)\krb5-protos.h \ + $(INCDIR)\krb5-private.h + +all:: $(INCFILES) + +clean:: + -$(RM) $(INCFILES) + +dist_libkrb5_la_SOURCES = \ + acache.c \ + acl.c \ + add_et_list.c \ + addr_families.c \ + aname_to_localname.c \ + appdefault.c \ + asn1_glue.c \ + auth_context.c \ + build_ap_req.c \ + build_auth.c \ + cache.c \ + changepw.c \ + codec.c \ + config_file.c \ + config_file_netinfo.c \ + convert_creds.c \ + constants.c \ + context.c \ + copy_host_realm.c \ + crc.c \ + creds.c \ + crypto.c \ + doxygen.c \ + data.c \ + digest.c \ + eai_to_heim_errno.c \ + error_string.c \ + expand_hostname.c \ + expand_path_w32.c \ + fcache.c \ + free.c \ + free_host_realm.c \ + generate_seq_number.c \ + generate_subkey.c \ + get_addrs.c \ + get_cred.c \ + get_default_principal.c \ + get_default_realm.c \ + get_for_creds.c \ + get_host_realm.c \ + get_in_tkt.c \ + get_in_tkt_pw.c \ + get_in_tkt_with_keytab.c \ + get_in_tkt_with_skey.c \ + get_port.c \ + heim_threads.h \ + init_creds.c \ + init_creds_pw.c \ + kcm.c \ + kcm.h \ + keyblock.c \ + keytab.c \ + keytab_any.c \ + keytab_file.c \ + keytab_keyfile.c \ + keytab_krb4.c \ + keytab_memory.c \ + krb5_locl.h \ + krb5-v4compat.h \ + krbhst.c \ + kuserok.c \ + log.c \ + mcache.c \ + misc.c \ + mk_error.c \ + mk_priv.c \ + mk_rep.c \ + mk_req.c \ + mk_req_ext.c \ + mk_safe.c \ + mit_glue.c \ + net_read.c \ + net_write.c \ + n-fold.c \ + pac.c \ + padata.c \ + pkinit.c \ + principal.c \ + prog_setup.c \ + prompter_posix.c \ + rd_cred.c \ + rd_error.c \ + rd_priv.c \ + rd_rep.c \ + rd_req.c \ + rd_safe.c \ + read_message.c \ + recvauth.c \ + replay.c \ + scache.c \ + send_to_kdc.c \ + sendauth.c \ + set_default_realm.c \ + sock_principal.c \ + store.c \ + store-int.h \ + store_emem.c \ + store_fd.c \ + store_mem.c \ + plugin.c \ + ticket.c \ + time.c \ + transited.c \ + v4_glue.c \ + verify_init.c \ + verify_user.c \ + version.c \ + warn.c \ + write_message.c + +$(OBJ)\krb5-protos.h: $(dist_libkrb5_la_SOURCES) + $(PERL) ..\..\cf\make-proto.pl -E KRB5_LIB -q -P remove -o $(OBJ)\krb5-protos.h $(dist_libkrb5_la_SOURCES) || $(RM) -f krb5-protos.h + +$(OBJ)\krb5-private.h: $(dist_libkrb5_la_SOURCES) + $(PERL) ..\..\cf\make-proto.pl -q -P remove -p $(OBJ)\krb5-private.h $(dist_libkrb5_la_SOURCES) || $(RM) -f krb5-private.h + +$(OBJ)\krb5_err.c $(OBJ)\krb5_err.h: krb5_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\krb5_err.et + cd $(SRCDIR) + +$(OBJ)\krb_err.c $(OBJ)\krb_err.h: krb_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\krb_err.et + cd $(SRCDIR) + +$(OBJ)\heim_err.c $(OBJ)\heim_err.h: heim_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\heim_err.et + cd $(SRCDIR) + +$(OBJ)\k524_err.c $(OBJ)\k524_err.h: k524_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\k524_err.et + cd $(SRCDIR) + +#---------------------------------------------------------------------- +# libkrb5 + +!ifdef STATICLIBS + +$(LIBKRB5): $(libkrb5_OBJS) $(libkrb5_gen_OBJS) + $(LIBCON) + +all:: $(LIBKRB5) + +clean:: + -$(RM) $(LIBKRB5) + +!else + +DLLDEPS= \ + $(LIBROKEN) \ + $(LIBASN1) \ + $(LIBSQLITE) \ + $(LIBCOMERR) \ + $(LIBHCRYPTO) \ + $(LIBHX509) \ + $(LIBWIND) + +DLLSDKDEPS= \ + $(PTHREAD_LIB) \ + secur32.lib \ + shell32.lib + +$(LIBKRB5): $(BINDIR)\libkrb5.dll + +$(BINDIR)\libkrb5.dll: $(libkrb5_OBJS) $(libkrb5_gen_OBJS) $(DLLDEPS) + $(DLLGUILINK_C) -out:$(BINDIR)\libkrb5.dll -implib:$(LIBKRB5) \ + $(DLLDEPS) $(DLLSDKDEPS) -def:libkrb5-exports.def @<< +$(libkrb5_OBJS: = +) +$(libkrb5_gen_OBJS: = +) +<< + $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +all:: $(BINDIR)\libkrb5.dll + +clean:: + -$(RM) $(BINDIR)\libkrb5.dll + -$(RM) $(LIBKRB5) + +!endif + +all:: $(BINDIR)\verify_krb5_conf.exe + +clean:: + -$(RM) $(BINDIR)\verify_krb5_conf.exe + +$(BINDIR)\verify_krb5_conf.exe: $(OBJ)\verify_krb5_conf.obj $(LIBKRB5) $(LIBROKEN) $(LIBVERS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +{}.c{$(OBJ)}.obj: + $(C2OBJ) -DBUILD_KRB5_LIB + +{$(OBJ)}.c{$(OBJ)}.obj: + $(C2OBJ) -DBUILD_KRB5_LIB + +#---------------------------------------------------------------------- +# Tests + +test:: test-binaries test-run + +test_binaries = \ + $(OBJ)\krbhst-test.exe \ + $(OBJ)\test_alname.exe \ + $(OBJ)\test_crypto.exe \ + $(OBJ)\test_get_addrs.exe \ + $(OBJ)\test_kuserok.exe \ + $(OBJ)\test_renew.exe \ + $(OBJ)\test_forward.exe \ + $(OBJ)\aes-test.exe \ + $(OBJ)\derived-key-test.exe \ + $(OBJ)\n-fold-test.exe \ + $(OBJ)\name-45-test.exe \ + $(OBJ)\parse-name-test.exe \ + $(OBJ)\store-test.exe \ + $(OBJ)\string-to-key-test.exe \ + $(OBJ)\test_acl.exe \ + $(OBJ)\test_addr.exe \ + $(OBJ)\test_cc.exe \ + $(OBJ)\test_config.exe \ + $(OBJ)\test_hostname.exe \ + $(OBJ)\test_prf.exe \ + $(OBJ)\test_store.exe \ + $(OBJ)\test_crypto_wrapping.exe \ + $(OBJ)\test_keytab.exe \ + $(OBJ)\test_mem.exe \ + $(OBJ)\test_pac.exe \ + $(OBJ)\test_plugin.exe \ + $(OBJ)\test_princ.exe \ + $(OBJ)\test_pkinit_dh2key.exe \ + $(OBJ)\test_pknistkdf.exe \ + $(OBJ)\test_time.exe + +test-binaries: $(test_binaries) + +test-run: + cd $(OBJ) + aes-test.exe + derived-key-test.exe + n-fold-test.exe + name-45-test.exe + parse-name-test.exe + store-test.exe + string-to-key-test.exe + test_acl.exe + -test_addr.exe + test_cc.exe + test_config.exe + test_prf.exe + test_store.exe + test_crypto_wrapping.exe + test_keytab.exe + test_mem.exe + test_pac.exe + test_plugin.exe + test_princ.exe + test_pkinit_dh2key.exe + test_pknistkdf.exe + test_time.exe + cd $(SRCDIR) + +$(test_binaries): $$(@R).obj + $(EXECONLINK) $(LIBKRB5) $(LIBVERS) $(LIBROKEN) $(LIBHCRYPTO) $(LIBASN1) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(test_binaries:.exe=.obj): $$(@B).c + $(C2OBJ_C) -Fo$@ -Fd$(@D)\ $** -DBlah + + diff --git a/lib/krb5/acl.c b/lib/krb5/acl.c index d547dc50d..473ea5bbf 100644 --- a/lib/krb5/acl.c +++ b/lib/krb5/acl.c @@ -198,7 +198,7 @@ acl_match_acl(krb5_context context, * @ingroup krb5_support */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_acl_match_string(krb5_context context, const char *string, const char *format, @@ -241,7 +241,7 @@ krb5_acl_match_string(krb5_context context, * @ingroup krb5_support */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_acl_match_file(krb5_context context, const char *file, const char *format, diff --git a/lib/krb5/add_et_list.c b/lib/krb5/add_et_list.c index ccffd93b2..082014e10 100644 --- a/lib/krb5/add_et_list.c +++ b/lib/krb5/add_et_list.c @@ -47,7 +47,7 @@ * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_add_et_list (krb5_context context, void (*func)(struct et_list **)) { diff --git a/lib/krb5/addr_families.c b/lib/krb5/addr_families.c index f88fb2276..cccf1cbc9 100644 --- a/lib/krb5/addr_families.c +++ b/lib/krb5/addr_families.c @@ -175,16 +175,8 @@ ipv4_parse_addr (krb5_context context, const char *address, krb5_address *addr) return -1; } else p = address; -#ifdef HAVE_INET_ATON if(inet_aton(p, &a) == 0) return -1; -#elif defined(HAVE_INET_ADDR) - a.s_addr = inet_addr(p); - if(a.s_addr == INADDR_NONE) - return -1; -#else - return -1; -#endif addr->addr_type = KRB5_ADDRESS_INET; if(krb5_data_alloc(&addr->address, 4) != 0) return -1; @@ -339,9 +331,7 @@ static int ipv6_print_addr (const krb5_address *addr, char *str, size_t len) { char buf[128], buf2[3]; -#ifdef HAVE_INET_NTOP if(inet_ntop(AF_INET6, addr->address.data, buf, sizeof(buf)) == NULL) -#endif { /* XXX this is pretty ugly, but better than abort() */ int i; @@ -790,7 +780,7 @@ find_atype(int atype) * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sockaddr2address (krb5_context context, const struct sockaddr *sa, krb5_address *addr) { @@ -818,7 +808,7 @@ krb5_sockaddr2address (krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sockaddr2port (krb5_context context, const struct sockaddr *sa, int16_t *port) { @@ -853,7 +843,7 @@ krb5_sockaddr2port (krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_addr2sockaddr (krb5_context context, const krb5_address *addr, struct sockaddr *sa, @@ -889,7 +879,7 @@ krb5_addr2sockaddr (krb5_context context, * @ingroup krb5_address */ -size_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION size_t KRB5_LIB_CALL krb5_max_sockaddr_size (void) { if (max_sockaddr_size == 0) { @@ -913,7 +903,7 @@ krb5_max_sockaddr_size (void) * @ingroup krb5_address */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_sockaddr_uninteresting(const struct sockaddr *sa) { struct addr_operations *a = find_af(sa->sa_family); @@ -941,7 +931,7 @@ krb5_sockaddr_uninteresting(const struct sockaddr *sa) * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_h_addr2sockaddr (krb5_context context, int af, const char *addr, struct sockaddr *sa, @@ -972,7 +962,7 @@ krb5_h_addr2sockaddr (krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_h_addr2addr (krb5_context context, int af, const char *haddr, krb5_address *addr) @@ -1003,7 +993,7 @@ krb5_h_addr2addr (krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_anyaddr (krb5_context context, int af, struct sockaddr *sa, @@ -1038,7 +1028,7 @@ krb5_anyaddr (krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_print_address (const krb5_address *addr, char *str, size_t len, size_t *ret_len) { @@ -1088,7 +1078,7 @@ krb5_print_address (const krb5_address *addr, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_address(krb5_context context, const char *string, krb5_addresses *addresses) @@ -1169,7 +1159,7 @@ krb5_parse_address(krb5_context context, * @ingroup krb5_address */ -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_address_order(krb5_context context, const krb5_address *addr1, const krb5_address *addr2) @@ -1218,7 +1208,7 @@ krb5_address_order(krb5_context context, * @ingroup krb5_address */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_address_compare(krb5_context context, const krb5_address *addr1, const krb5_address *addr2) @@ -1239,7 +1229,7 @@ krb5_address_compare(krb5_context context, * @ingroup krb5_address */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_address_search(krb5_context context, const krb5_address *addr, const krb5_addresses *addrlist) @@ -1264,7 +1254,7 @@ krb5_address_search(krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_address(krb5_context context, krb5_address *address) { @@ -1288,7 +1278,7 @@ krb5_free_address(krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_addresses(krb5_context context, krb5_addresses *addresses) { @@ -1314,7 +1304,7 @@ krb5_free_addresses(krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_address(krb5_context context, const krb5_address *inaddr, krb5_address *outaddr) @@ -1338,7 +1328,7 @@ krb5_copy_address(krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_addresses(krb5_context context, const krb5_addresses *inaddr, krb5_addresses *outaddr) @@ -1365,7 +1355,7 @@ krb5_copy_addresses(krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_append_addresses(krb5_context context, krb5_addresses *dest, const krb5_addresses *source) @@ -1409,7 +1399,7 @@ krb5_append_addresses(krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_make_addrport (krb5_context context, krb5_address **res, const krb5_address *addr, int16_t port) { @@ -1476,7 +1466,7 @@ krb5_make_addrport (krb5_context context, * @ingroup krb5_address */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_address_prefixlen_boundary(krb5_context context, const krb5_address *inaddr, unsigned long prefixlen, diff --git a/lib/krb5/aname_to_localname.c b/lib/krb5/aname_to_localname.c index 2986aab92..78cf4c6f6 100644 --- a/lib/krb5/aname_to_localname.c +++ b/lib/krb5/aname_to_localname.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_aname_to_localname (krb5_context context, krb5_const_principal aname, size_t lnsize, diff --git a/lib/krb5/appdefault.c b/lib/krb5/appdefault.c index 383e82dad..a54e4214e 100644 --- a/lib/krb5/appdefault.c +++ b/lib/krb5/appdefault.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_appdefault_boolean(krb5_context context, const char *appname, krb5_const_realm realm, const char *option, krb5_boolean def_val, krb5_boolean *ret_val) @@ -119,7 +119,7 @@ krb5_appdefault_string(krb5_context context, const char *appname, *ret_val = NULL; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_appdefault_time(krb5_context context, const char *appname, krb5_const_realm realm, const char *option, time_t def_val, time_t *ret_val) diff --git a/lib/krb5/asn1_glue.c b/lib/krb5/asn1_glue.c index 59c0fbd64..a821faff9 100644 --- a/lib/krb5/asn1_glue.c +++ b/lib/krb5/asn1_glue.c @@ -37,14 +37,14 @@ #include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_principal2principalname (PrincipalName *p, const krb5_principal from) { return copy_PrincipalName(&from->name, p); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_principalname2krb5_principal (krb5_context context, krb5_principal *principal, const PrincipalName from, diff --git a/lib/krb5/auth_context.c b/lib/krb5/auth_context.c index 153260bb1..38f3e3224 100644 --- a/lib/krb5/auth_context.c +++ b/lib/krb5/auth_context.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_init(krb5_context context, krb5_auth_context *auth_context) { @@ -64,7 +64,7 @@ krb5_auth_con_init(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_free(krb5_context context, krb5_auth_context auth_context) { @@ -86,7 +86,7 @@ krb5_auth_con_free(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setflags(krb5_context context, krb5_auth_context auth_context, int32_t flags) @@ -96,7 +96,7 @@ krb5_auth_con_setflags(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getflags(krb5_context context, krb5_auth_context auth_context, int32_t *flags) @@ -105,7 +105,7 @@ krb5_auth_con_getflags(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_addflags(krb5_context context, krb5_auth_context auth_context, int32_t addflags, @@ -117,7 +117,7 @@ krb5_auth_con_addflags(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_removeflags(krb5_context context, krb5_auth_context auth_context, int32_t removeflags, @@ -129,7 +129,7 @@ krb5_auth_con_removeflags(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setaddrs(krb5_context context, krb5_auth_context auth_context, krb5_address *local_addr, @@ -154,7 +154,7 @@ krb5_auth_con_setaddrs(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_genaddrs(krb5_context context, krb5_auth_context auth_context, int fd, int flags) @@ -216,7 +216,7 @@ krb5_auth_con_genaddrs(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setaddrs_from_fd (krb5_context context, krb5_auth_context auth_context, void *p_fd) @@ -230,7 +230,7 @@ krb5_auth_con_setaddrs_from_fd (krb5_context context, return krb5_auth_con_genaddrs(context, auth_context, fd, flags); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getaddrs(krb5_context context, krb5_auth_context auth_context, krb5_address **local_addr, @@ -273,7 +273,7 @@ copy_key(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock **keyblock) @@ -281,7 +281,7 @@ krb5_auth_con_getkey(krb5_context context, return copy_key(context, auth_context->keyblock, keyblock); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getlocalsubkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock **keyblock) @@ -289,7 +289,7 @@ krb5_auth_con_getlocalsubkey(krb5_context context, return copy_key(context, auth_context->local_subkey, keyblock); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getremotesubkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock **keyblock) @@ -297,7 +297,7 @@ krb5_auth_con_getremotesubkey(krb5_context context, return copy_key(context, auth_context->remote_subkey, keyblock); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock) @@ -307,7 +307,7 @@ krb5_auth_con_setkey(krb5_context context, return copy_key(context, keyblock, &auth_context->keyblock); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setlocalsubkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock) @@ -317,7 +317,7 @@ krb5_auth_con_setlocalsubkey(krb5_context context, return copy_key(context, keyblock, &auth_context->local_subkey); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_generatelocalsubkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *key) @@ -337,7 +337,7 @@ krb5_auth_con_generatelocalsubkey(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setremotesubkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock) @@ -347,7 +347,7 @@ krb5_auth_con_setremotesubkey(krb5_context context, return copy_key(context, keyblock, &auth_context->remote_subkey); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setcksumtype(krb5_context context, krb5_auth_context auth_context, krb5_cksumtype cksumtype) @@ -356,7 +356,7 @@ krb5_auth_con_setcksumtype(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getcksumtype(krb5_context context, krb5_auth_context auth_context, krb5_cksumtype *cksumtype) @@ -365,7 +365,7 @@ krb5_auth_con_getcksumtype(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setkeytype (krb5_context context, krb5_auth_context auth_context, krb5_keytype keytype) @@ -374,7 +374,7 @@ krb5_auth_con_setkeytype (krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getkeytype (krb5_context context, krb5_auth_context auth_context, krb5_keytype *keytype) @@ -384,7 +384,7 @@ krb5_auth_con_getkeytype (krb5_context context, } #if 0 -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setenctype(krb5_context context, krb5_auth_context auth_context, krb5_enctype etype) @@ -398,7 +398,7 @@ krb5_auth_con_setenctype(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getenctype(krb5_context context, krb5_auth_context auth_context, krb5_enctype *etype) @@ -407,7 +407,7 @@ krb5_auth_con_getenctype(krb5_context context, } #endif -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getlocalseqnumber(krb5_context context, krb5_auth_context auth_context, int32_t *seqnumber) @@ -416,7 +416,7 @@ krb5_auth_con_getlocalseqnumber(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setlocalseqnumber (krb5_context context, krb5_auth_context auth_context, int32_t seqnumber) @@ -425,7 +425,7 @@ krb5_auth_con_setlocalseqnumber (krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_FUNCTION krb5_auth_con_getremoteseqnumber(krb5_context context, krb5_auth_context auth_context, int32_t *seqnumber) @@ -434,7 +434,7 @@ krb5_auth_con_getremoteseqnumber(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setremoteseqnumber (krb5_context context, krb5_auth_context auth_context, int32_t seqnumber) @@ -444,7 +444,7 @@ krb5_auth_con_setremoteseqnumber (krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getauthenticator(krb5_context context, krb5_auth_context auth_context, krb5_authenticator *authenticator) @@ -461,7 +461,7 @@ krb5_auth_con_getauthenticator(krb5_context context, } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_authenticator(krb5_context context, krb5_authenticator *authenticator) { @@ -471,7 +471,7 @@ krb5_free_authenticator(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setuserkey(krb5_context context, krb5_auth_context auth_context, krb5_keyblock *keyblock) @@ -481,7 +481,7 @@ krb5_auth_con_setuserkey(krb5_context context, return krb5_copy_keyblock(context, keyblock, &auth_context->keyblock); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getrcache(krb5_context context, krb5_auth_context auth_context, krb5_rcache *rcache) @@ -490,7 +490,7 @@ krb5_auth_con_getrcache(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setrcache(krb5_context context, krb5_auth_context auth_context, krb5_rcache rcache) @@ -501,7 +501,7 @@ krb5_auth_con_setrcache(krb5_context context, #if 0 /* not implemented */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_initivector(krb5_context context, krb5_auth_context auth_context) { @@ -509,7 +509,7 @@ krb5_auth_con_initivector(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_setivector(krb5_context context, krb5_auth_context auth_context, krb5_pointer ivector) diff --git a/lib/krb5/build_ap_req.c b/lib/krb5/build_ap_req.c index 1550239fa..d56a0a194 100644 --- a/lib/krb5/build_ap_req.c +++ b/lib/krb5/build_ap_req.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_build_ap_req (krb5_context context, krb5_enctype enctype, krb5_creds *cred, diff --git a/lib/krb5/build_auth.c b/lib/krb5/build_auth.c index a845e0ac3..85d64525d 100644 --- a/lib/krb5/build_auth.c +++ b/lib/krb5/build_auth.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" static krb5_error_code make_etypelist(krb5_context context, @@ -99,14 +99,14 @@ make_etypelist(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION -_krb5_build_authenticator(krb5_context context, - krb5_auth_context auth_context, - krb5_enctype enctype, - krb5_creds *cred, - Checksum *cksum, - krb5_data *result, - krb5_key_usage usage) +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL +_krb5_build_authenticator (krb5_context context, + krb5_auth_context auth_context, + krb5_enctype enctype, + krb5_creds *cred, + Checksum *cksum, + krb5_data *result, + krb5_key_usage usage) { Authenticator auth; u_char *buf = NULL; diff --git a/lib/krb5/cache.c b/lib/krb5/cache.c index 42e187751..3b5d2419f 100644 --- a/lib/krb5/cache.c +++ b/lib/krb5/cache.c @@ -114,7 +114,7 @@ main (int argc, char **argv) * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_register(krb5_context context, const krb5_cc_ops *ops, krb5_boolean override) @@ -186,13 +186,34 @@ allocate_ccache (krb5_context context, krb5_ccache *id) { krb5_error_code ret; + char * exp_residual = NULL; - ret = _krb5_cc_allocate(context, ops, id); +#ifdef KRB5_USE_PATH_TOKENS + ret = _krb5_expand_path_tokens(context, residual, &exp_residual); if (ret) return ret; + + residual = exp_residual; +#endif + + ret = _krb5_cc_allocate(context, ops, id); + if (ret) { +#ifdef KRB5_USE_PATH_TOKENS + if (exp_residual) + free(exp_residual); +#endif + return ret; + } + ret = (*id)->ops->resolve(context, id, residual); if(ret) free(*id); + +#ifdef KRB5_USE_PATH_TOKENS + if (exp_residual) + free(exp_residual); +#endif + return ret; } @@ -211,7 +232,7 @@ allocate_ccache (krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_resolve(krb5_context context, const char *name, krb5_ccache *id) @@ -251,7 +272,7 @@ krb5_cc_resolve(krb5_context context, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_new_unique(krb5_context context, const char *type, const char *hint, krb5_ccache *id) { @@ -283,7 +304,7 @@ krb5_cc_new_unique(krb5_context context, const char *type, */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_cc_get_name(krb5_context context, krb5_ccache id) { @@ -297,7 +318,7 @@ krb5_cc_get_name(krb5_context context, */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_cc_get_type(krb5_context context, krb5_ccache id) { @@ -317,7 +338,7 @@ krb5_cc_get_type(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_get_full_name(krb5_context context, krb5_ccache id, char **str) @@ -368,6 +389,7 @@ krb5_cc_get_ops(krb5_context context, krb5_ccache id) krb5_error_code _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res) { +#ifndef KRB5_USE_PATH_TOKENS size_t tlen, len = 0; char *tmp, *tmp2, *append; @@ -385,7 +407,8 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res) } else if (tmp) { tmp2 = strchr(tmp, '}'); if (tmp2 == NULL) { - free(*res); + if (*res) + free(*res); *res = NULL; krb5_set_error_message(context, KRB5_CONFIG_BADFORMAT, "variable missing }"); @@ -396,7 +419,8 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res) else if (strncasecmp(tmp, "%{null}", 7) == 0) append = strdup(""); else { - free(*res); + if (*res) + free(*res); *res = NULL; krb5_set_error_message(context, KRB5_CONFIG_BADFORMAT, @@ -411,7 +435,8 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res) str = NULL; } if (append == NULL) { - free(*res); + if (*res) + free(*res); *res = NULL; krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", "")); @@ -422,7 +447,8 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res) tmp = realloc(*res, len + tlen + 1); if (tmp == NULL) { free(append); - free(*res); + if (*res) + free(*res); *res = NULL; krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", "")); @@ -434,6 +460,13 @@ _krb5_expand_default_cc_name(krb5_context context, const char *str, char **res) free(append); } return 0; +#else /* _WIN32 */ + /* On Windows, we use the more generic _krb5_expand_path_tokens() + function which also handles path tokens in addition to %{uid} + and %{null} */ + + return _krb5_expand_path_tokens(context, str, res); +#endif } /* @@ -517,7 +550,7 @@ krb5_cc_support_switch(krb5_context context, const char *type) * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_set_default_name(krb5_context context, const char *name) { krb5_error_code ret = 0; @@ -573,6 +606,20 @@ krb5_cc_set_default_name(krb5_context context, const char *name) return ENOMEM; } +#ifdef KRB5_USE_PATH_TOKENS + { + char * exp_p = NULL; + + if (_krb5_expand_path_tokens(context, p, &exp_p) == 0) { + free (p); + p = exp_p; + } else { + free (p); + return EINVAL; + } + } +#endif + if (context->default_cc_name) free(context->default_cc_name); @@ -591,7 +638,7 @@ krb5_cc_set_default_name(krb5_context context, const char *name) */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_cc_default_name(krb5_context context) { if (context->default_cc_name == NULL || environment_changed(context)) @@ -609,7 +656,7 @@ krb5_cc_default_name(krb5_context context) */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_default(krb5_context context, krb5_ccache *id) { @@ -631,7 +678,7 @@ krb5_cc_default(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_initialize(krb5_context context, krb5_ccache id, krb5_principal primary_principal) @@ -649,7 +696,7 @@ krb5_cc_initialize(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_destroy(krb5_context context, krb5_ccache id) { @@ -669,7 +716,7 @@ krb5_cc_destroy(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_close(krb5_context context, krb5_ccache id) { @@ -688,7 +735,7 @@ krb5_cc_close(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_store_cred(krb5_context context, krb5_ccache id, krb5_creds *creds) @@ -714,7 +761,7 @@ krb5_cc_store_cred(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_retrieve_cred(krb5_context context, krb5_ccache id, krb5_flags whichfields, @@ -752,7 +799,7 @@ krb5_cc_retrieve_cred(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_get_principal(krb5_context context, krb5_ccache id, krb5_principal *principal) @@ -770,7 +817,7 @@ krb5_cc_get_principal(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_start_seq_get (krb5_context context, const krb5_ccache id, krb5_cc_cursor *cursor) @@ -788,7 +835,7 @@ krb5_cc_start_seq_get (krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_next_cred (krb5_context context, const krb5_ccache id, krb5_cc_cursor *cursor, @@ -804,7 +851,7 @@ krb5_cc_next_cred (krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_end_seq_get (krb5_context context, const krb5_ccache id, krb5_cc_cursor *cursor) @@ -819,7 +866,7 @@ krb5_cc_end_seq_get (krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_remove_cred(krb5_context context, krb5_ccache id, krb5_flags which, @@ -842,7 +889,7 @@ krb5_cc_remove_cred(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_set_flags(krb5_context context, krb5_ccache id, krb5_flags flags) @@ -856,7 +903,7 @@ krb5_cc_set_flags(krb5_context context, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_get_flags(krb5_context context, krb5_ccache id, krb5_flags *flags) @@ -881,7 +928,7 @@ krb5_cc_get_flags(krb5_context context, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_copy_match_f(krb5_context context, const krb5_ccache from, krb5_ccache to, @@ -934,7 +981,7 @@ krb5_cc_copy_match_f(krb5_context context, * @ingroup @krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_copy_cache(krb5_context context, const krb5_ccache from, krb5_ccache to) @@ -949,7 +996,7 @@ krb5_cc_copy_cache(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_get_version(krb5_context context, const krb5_ccache id) { @@ -966,7 +1013,7 @@ krb5_cc_get_version(krb5_context context, */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_cc_clear_mcred(krb5_creds *mcred) { memset(mcred, 0, sizeof(*mcred)); @@ -1034,7 +1081,7 @@ struct krb5_cc_cache_cursor_data { */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_cache_get_first (krb5_context context, const char *type, krb5_cc_cache_cursor *cursor) @@ -1092,7 +1139,7 @@ krb5_cc_cache_get_first (krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_cache_next (krb5_context context, krb5_cc_cache_cursor cursor, krb5_ccache *id) @@ -1109,7 +1156,7 @@ krb5_cc_cache_next (krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_cache_end_seq_get (krb5_context context, krb5_cc_cache_cursor cursor) { @@ -1135,7 +1182,7 @@ krb5_cc_cache_end_seq_get (krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_cache_match (krb5_context context, krb5_principal client, krb5_ccache *id) @@ -1269,7 +1316,7 @@ build_conf_principals(krb5_context context, krb5_ccache id, * @ingroup krb5_ccache */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_is_config_principal(krb5_context context, krb5_const_principal principal) { @@ -1297,7 +1344,7 @@ krb5_is_config_principal(krb5_context context, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_set_config(krb5_context context, krb5_ccache id, krb5_const_principal principal, const char *name, krb5_data *data) @@ -1345,7 +1392,7 @@ out: */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_get_config(krb5_context context, krb5_ccache id, krb5_const_principal principal, const char *name, krb5_data *data) @@ -1393,7 +1440,7 @@ struct krb5_cccol_cursor_data { * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor) { *cursor = calloc(1, sizeof(**cursor)); @@ -1425,7 +1472,7 @@ krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor) */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cccol_cursor_next(krb5_context context, krb5_cccol_cursor cursor, krb5_ccache *cache) { @@ -1476,7 +1523,7 @@ krb5_cccol_cursor_next(krb5_context context, krb5_cccol_cursor cursor, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor) { krb5_cccol_cursor c = *cursor; @@ -1503,7 +1550,7 @@ krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor) */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_last_change_time(krb5_context context, krb5_ccache id, krb5_timestamp *mtime) @@ -1526,7 +1573,7 @@ krb5_cc_last_change_time(krb5_context context, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cccol_last_change_time(krb5_context context, const char *type, krb5_timestamp *mtime) @@ -1567,7 +1614,7 @@ krb5_cccol_last_change_time(krb5_context context, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_get_friendly_name(krb5_context context, krb5_ccache id, char **name) @@ -1604,7 +1651,7 @@ krb5_cc_get_friendly_name(krb5_context context, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_set_friendly_name(krb5_context context, krb5_ccache id, const char *name) @@ -1632,7 +1679,7 @@ krb5_cc_set_friendly_name(krb5_context context, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_get_lifetime(krb5_context context, krb5_ccache id, time_t *t) { krb5_cc_cursor cursor; diff --git a/lib/krb5/changepw.c b/lib/krb5/changepw.c index 5369dc929..6772c1cce 100644 --- a/lib/krb5/changepw.c +++ b/lib/krb5/changepw.c @@ -33,7 +33,7 @@ #define KRB5_DEPRECATED -#include +#include "krb5_locl.h" #undef __attribute__ #define __attribute__(X) @@ -684,7 +684,7 @@ find_chpw_proto(const char *name) * @ingroup @krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_change_password (krb5_context context, krb5_creds *creds, const char *newpw, @@ -726,7 +726,7 @@ krb5_change_password (krb5_context context, * @ingroup @krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_password(krb5_context context, krb5_creds *creds, const char *newpw, @@ -769,7 +769,7 @@ krb5_set_password(krb5_context context, * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_password_using_ccache(krb5_context context, krb5_ccache ccache, const char *newpw, @@ -834,7 +834,7 @@ krb5_set_password_using_ccache(krb5_context context, * */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_passwd_result_to_string (krb5_context context, int result) { diff --git a/lib/krb5/codec.c b/lib/krb5/codec.c index ebda3e51f..e57403b90 100644 --- a/lib/krb5/codec.c +++ b/lib/krb5/codec.c @@ -37,7 +37,7 @@ #ifndef HEIMDAL_SMALLER -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncTicketPart (krb5_context context, const void *data, size_t length, @@ -48,7 +48,7 @@ krb5_decode_EncTicketPart (krb5_context context, return decode_EncTicketPart(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncTicketPart (krb5_context context, void *data, size_t length, @@ -59,7 +59,7 @@ krb5_encode_EncTicketPart (krb5_context context, return encode_EncTicketPart(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncASRepPart (krb5_context context, const void *data, size_t length, @@ -70,7 +70,7 @@ krb5_decode_EncASRepPart (krb5_context context, return decode_EncASRepPart(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncASRepPart (krb5_context context, void *data, size_t length, @@ -81,7 +81,7 @@ krb5_encode_EncASRepPart (krb5_context context, return encode_EncASRepPart(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncTGSRepPart (krb5_context context, const void *data, size_t length, @@ -92,7 +92,7 @@ krb5_decode_EncTGSRepPart (krb5_context context, return decode_EncTGSRepPart(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncTGSRepPart (krb5_context context, void *data, size_t length, @@ -103,7 +103,7 @@ krb5_encode_EncTGSRepPart (krb5_context context, return encode_EncTGSRepPart(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncAPRepPart (krb5_context context, const void *data, size_t length, @@ -114,7 +114,7 @@ krb5_decode_EncAPRepPart (krb5_context context, return decode_EncAPRepPart(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncAPRepPart (krb5_context context, void *data, size_t length, @@ -125,7 +125,7 @@ krb5_encode_EncAPRepPart (krb5_context context, return encode_EncAPRepPart(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_Authenticator (krb5_context context, const void *data, size_t length, @@ -136,7 +136,7 @@ krb5_decode_Authenticator (krb5_context context, return decode_Authenticator(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_Authenticator (krb5_context context, void *data, size_t length, @@ -147,7 +147,7 @@ krb5_encode_Authenticator (krb5_context context, return encode_Authenticator(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncKrbCredPart (krb5_context context, const void *data, size_t length, @@ -158,7 +158,7 @@ krb5_decode_EncKrbCredPart (krb5_context context, return decode_EncKrbCredPart(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncKrbCredPart (krb5_context context, void *data, size_t length, @@ -169,7 +169,7 @@ krb5_encode_EncKrbCredPart (krb5_context context, return encode_EncKrbCredPart (data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_ETYPE_INFO (krb5_context context, const void *data, size_t length, @@ -180,7 +180,7 @@ krb5_decode_ETYPE_INFO (krb5_context context, return decode_ETYPE_INFO(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_ETYPE_INFO (krb5_context context, void *data, size_t length, @@ -191,7 +191,7 @@ krb5_encode_ETYPE_INFO (krb5_context context, return encode_ETYPE_INFO (data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_ETYPE_INFO2 (krb5_context context, const void *data, size_t length, @@ -202,7 +202,7 @@ krb5_decode_ETYPE_INFO2 (krb5_context context, return decode_ETYPE_INFO2(data, length, t, len); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_ETYPE_INFO2 (krb5_context context, void *data, size_t length, diff --git a/lib/krb5/config_file.c b/lib/krb5/config_file.c index 821578dc9..df4de16a7 100644 --- a/lib/krb5/config_file.c +++ b/lib/krb5/config_file.c @@ -403,7 +403,7 @@ is_plist_file(const char *fname) * @ingroup krb5_support */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_config_parse_file_multi (krb5_context context, const char *fname, krb5_config_section **res) @@ -413,6 +413,9 @@ krb5_config_parse_file_multi (krb5_context context, unsigned lineno = 0; krb5_error_code ret; struct fileptr f; +#ifdef KRB5_USE_PATH_TOKENS + char * exp_fname = NULL; +#endif /** * If the fname starts with "~/" parse configuration file in the @@ -483,13 +486,52 @@ krb5_config_parse_file_multi (krb5_context context, free(newfname); return ret; } +======= +#ifdef KRB5_USE_PATH_TOKENS + ret = _krb5_expand_path_tokens(context, fname, &exp_fname); + if (ret) + return ret; + fname = exp_fname; +#endif + + f.f = fopen(fname, "r"); + f.s = NULL; + if(f.f == NULL) { + ret = errno; + krb5_set_error_message (context, ret, "open %s: %s", + fname, strerror(ret)); + if (newfname) + free(newfname); +#ifdef KRB5_USE_PATH_TOKENS + if (exp_fname) + free (exp_fname); +#endif + return ret; + } + + ret = krb5_config_parse_debug (&f, res, &lineno, &str); + fclose(f.f); + if (ret) { + krb5_set_error_message (context, ret, "%s:%u: %s", fname, lineno, str); + if (newfname) + free(newfname); +#ifdef KRB5_USE_PATH_TOKENS + if (exp_fname) + free (exp_fname); +#endif + return ret; +>>>>>>> Initial Windows port } if (newfname) free(newfname); +#ifdef KRB5_USE_PATH_TOKENS + if (exp_fname) + free (exp_fname); +#endif return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_config_parse_file (krb5_context context, const char *fname, krb5_config_section **res) @@ -531,7 +573,7 @@ free_binding (krb5_context context, krb5_config_binding *b) * @ingroup krb5_support */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_config_file_free (krb5_context context, krb5_config_section *s) { free_binding (context, s); @@ -540,7 +582,7 @@ krb5_config_file_free (krb5_context context, krb5_config_section *s) #ifndef HEIMDAL_SMALLER -krb5_error_code +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_config_copy(krb5_context context, krb5_config_section *c, krb5_config_section **head) @@ -576,7 +618,7 @@ _krb5_config_copy(krb5_context context, #endif /* HEIMDAL_SMALLER */ -const void * +KRB5_LIB_FUNCTION const void * KRB5_LIB_CALL _krb5_config_get_next (krb5_context context, const krb5_config_section *c, const krb5_config_binding **pointer, @@ -615,7 +657,7 @@ vget_next(krb5_context context, return NULL; } -const void * +KRB5_LIB_FUNCTION const void * KRB5_LIB_CALL _krb5_config_vget_next (krb5_context context, const krb5_config_section *c, const krb5_config_binding **pointer, @@ -651,7 +693,7 @@ _krb5_config_vget_next (krb5_context context, return NULL; } -const void * +KRB5_LIB_FUNCTION const void * KRB5_LIB_CALL _krb5_config_get (krb5_context context, const krb5_config_section *c, int type, @@ -666,6 +708,7 @@ _krb5_config_get (krb5_context context, return ret; } + const void * _krb5_config_vget (krb5_context context, const krb5_config_section *c, @@ -689,7 +732,7 @@ _krb5_config_vget (krb5_context context, * @ingroup krb5_support */ -const krb5_config_binding * +KRB5_LIB_FUNCTION const krb5_config_binding * KRB5_LIB_CALL krb5_config_get_list (krb5_context context, const krb5_config_section *c, ...) @@ -715,7 +758,7 @@ krb5_config_get_list (krb5_context context, * @ingroup krb5_support */ -const krb5_config_binding * +KRB5_LIB_FUNCTION const krb5_config_binding * KRB5_LIB_CALL krb5_config_vget_list (krb5_context context, const krb5_config_section *c, va_list args) @@ -738,7 +781,7 @@ krb5_config_vget_list (krb5_context context, * @ingroup krb5_support */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_config_get_string (krb5_context context, const krb5_config_section *c, ...) @@ -764,7 +807,7 @@ krb5_config_get_string (krb5_context context, * @ingroup krb5_support */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_config_vget_string (krb5_context context, const krb5_config_section *c, va_list args) @@ -787,7 +830,7 @@ krb5_config_vget_string (krb5_context context, * @ingroup krb5_support */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_config_vget_string_default (krb5_context context, const krb5_config_section *c, const char *def_value, @@ -816,7 +859,7 @@ krb5_config_vget_string_default (krb5_context context, * @ingroup krb5_support */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_config_get_string_default (krb5_context context, const krb5_config_section *c, const char *def_value, @@ -844,7 +887,7 @@ krb5_config_get_string_default (krb5_context context, * @ingroup krb5_support */ -char ** KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION char ** KRB5_LIB_CALL krb5_config_vget_strings(krb5_context context, const krb5_config_section *c, va_list args) @@ -904,7 +947,7 @@ cleanup: * @ingroup krb5_support */ -char** +KRB5_LIB_FUNCTION char** KRB5_LIB_CALL krb5_config_get_strings(krb5_context context, const krb5_config_section *c, ...) @@ -926,7 +969,7 @@ krb5_config_get_strings(krb5_context context, * @ingroup krb5_support */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_config_free_strings(char **strings) { char **s = strings; @@ -955,7 +998,7 @@ krb5_config_free_strings(char **strings) * @ingroup krb5_support */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_vget_bool_default (krb5_context context, const krb5_config_section *c, krb5_boolean def_value, @@ -985,7 +1028,7 @@ krb5_config_vget_bool_default (krb5_context context, * @ingroup krb5_support */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_vget_bool (krb5_context context, const krb5_config_section *c, va_list args) @@ -1009,7 +1052,7 @@ krb5_config_vget_bool (krb5_context context, * @ingroup krb5_support */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_get_bool_default (krb5_context context, const krb5_config_section *c, krb5_boolean def_value, @@ -1039,7 +1082,7 @@ krb5_config_get_bool_default (krb5_context context, * @ingroup krb5_support */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_config_get_bool (krb5_context context, const krb5_config_section *c, ...) @@ -1069,7 +1112,7 @@ krb5_config_get_bool (krb5_context context, * @ingroup krb5_support */ -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_vget_time_default (krb5_context context, const krb5_config_section *c, int def_value, @@ -1098,10 +1141,10 @@ krb5_config_vget_time_default (krb5_context context, * @ingroup krb5_support */ -int KRB5_LIB_FUNCTION -krb5_config_vget_time(krb5_context context, - const krb5_config_section *c, - va_list args) +KRB5_LIB_FUNCTION int KRB5_LIB_CALL +krb5_config_vget_time (krb5_context context, + const krb5_config_section *c, + va_list args) { return krb5_config_vget_time_default (context, c, -1, args); } @@ -1120,7 +1163,7 @@ krb5_config_vget_time(krb5_context context, * @ingroup krb5_support */ -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_get_time_default (krb5_context context, const krb5_config_section *c, int def_value, @@ -1146,7 +1189,7 @@ krb5_config_get_time_default (krb5_context context, * @ingroup krb5_support */ -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_get_time (krb5_context context, const krb5_config_section *c, ...) @@ -1160,7 +1203,7 @@ krb5_config_get_time (krb5_context context, } -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_vget_int_default (krb5_context context, const krb5_config_section *c, int def_value, @@ -1181,7 +1224,7 @@ krb5_config_vget_int_default (krb5_context context, } } -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_vget_int (krb5_context context, const krb5_config_section *c, va_list args) @@ -1189,7 +1232,7 @@ krb5_config_vget_int (krb5_context context, return krb5_config_vget_int_default (context, c, -1, args); } -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_get_int_default (krb5_context context, const krb5_config_section *c, int def_value, @@ -1203,7 +1246,7 @@ krb5_config_get_int_default (krb5_context context, return ret; } -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_config_get_int (krb5_context context, const krb5_config_section *c, ...) diff --git a/lib/krb5/constants.c b/lib/krb5/constants.c index 99ed686fd..b85f0cf60 100644 --- a/lib/krb5/constants.c +++ b/lib/krb5/constants.c @@ -41,8 +41,13 @@ KRB5_LIB_VARIABLE const char *krb5_config_file = "/Library/Preferences/com.apple.Kerberos.plist:" "~/Library/Preferences/edu.mit.Kerberos:" "/Library/Preferences/edu.mit.Kerberos:" +#endif /* __APPLE__ */ +SYSCONFDIR "/krb5.conf" +#ifndef _WIN32 +":/etc/krb5.conf" #endif -SYSCONFDIR "/krb5.conf:/etc/krb5.conf"; +; + KRB5_LIB_VARIABLE const char *krb5_defkeyname = KEYTAB_DEFAULT; KRB5_LIB_VARIABLE const char *krb5_cc_type_api = "API"; diff --git a/lib/krb5/context.c b/lib/krb5/context.c index 15e4c5022..a8aa1c682 100644 --- a/lib/krb5/context.c +++ b/lib/krb5/context.c @@ -275,7 +275,7 @@ kt_ops_register(krb5_context context) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_context(krb5_context *context) { krb5_context p; @@ -318,6 +318,11 @@ krb5_init_context(krb5_context *context) if (ret) goto out; #endif +#ifdef NEED_SOCK_INIT + if (SOCK_INIT) { + p->flags |= KRB5_CTX_F_SOCKETS_INITIALIZED; + } +#endif out: if(ret) { @@ -460,7 +465,7 @@ krb5_copy_context(krb5_context context, krb5_context *out) * @ingroup krb5 */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_context(krb5_context context) { if (context->default_cc_name) @@ -485,6 +490,11 @@ krb5_free_context(krb5_context context) HEIMDAL_MUTEX_destroy(context->mutex); free(context->mutex); +#ifdef NEED_SOCK_INIT + if (context->flags & KRB5_CTX_F_SOCKETS_INITIALIZED) { + SOCK_EXIT; + } +#endif memset(context, 0, sizeof(*context)); free(context); @@ -502,7 +512,7 @@ krb5_free_context(krb5_context context) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_config_files(krb5_context context, char **filenames) { krb5_error_code ret; @@ -557,7 +567,7 @@ add_file(char ***pfilenames, int *len, char *file) * `pq' isn't free, it's up the the caller */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_prepend_config_files(const char *filelist, char **pq, char ***ret_pp) { krb5_error_code ret; @@ -622,7 +632,7 @@ krb5_prepend_config_files(const char *filelist, char **pq, char ***ret_pp) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_prepend_config_files_default(const char *filelist, char ***pfilenames) { krb5_error_code ret; @@ -652,7 +662,7 @@ krb5_prepend_config_files_default(const char *filelist, char ***pfilenames) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_default_config_files(char ***pfilenames) { const char *files = NULL; @@ -679,7 +689,7 @@ krb5_get_default_config_files(char ***pfilenames) * @ingroup krb5 */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_config_files(char **filenames) { char **p; @@ -701,7 +711,7 @@ krb5_free_config_files(char **filenames) * @ingroup krb5 */ -const krb5_enctype * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const krb5_enctype * KRB5_LIB_CALL krb5_kerberos_enctypes(krb5_context context) { static const krb5_enctype p[] = { @@ -762,7 +772,7 @@ default_etypes(krb5_context context, krb5_enctype **etype) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_default_in_tkt_etypes(krb5_context context, const krb5_enctype *etypes) { @@ -804,7 +814,7 @@ krb5_set_default_in_tkt_etypes(krb5_context context, * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_default_in_tkt_etypes(krb5_context context, krb5_enctype **etypes) { @@ -838,7 +848,7 @@ krb5_get_default_in_tkt_etypes(krb5_context context, * @ingroup krb5 */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_init_ets(krb5_context context) { if(context->et_list == NULL){ @@ -873,7 +883,7 @@ krb5_init_ets(krb5_context context) * @ingroup krb5 */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_set_use_admin_kdc (krb5_context context, krb5_boolean flag) { context->use_admin_kdc = flag; @@ -889,7 +899,7 @@ krb5_set_use_admin_kdc (krb5_context context, krb5_boolean flag) * @ingroup krb5 */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_get_use_admin_kdc (krb5_context context) { return context->use_admin_kdc; @@ -908,7 +918,7 @@ krb5_get_use_admin_kdc (krb5_context context) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_add_extra_addresses(krb5_context context, krb5_addresses *addresses) { @@ -932,7 +942,7 @@ krb5_add_extra_addresses(krb5_context context, krb5_addresses *addresses) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_extra_addresses(krb5_context context, const krb5_addresses *addresses) { if(context->extra_addresses) @@ -968,7 +978,7 @@ krb5_set_extra_addresses(krb5_context context, const krb5_addresses *addresses) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_extra_addresses(krb5_context context, krb5_addresses *addresses) { if(context->extra_addresses == NULL) { @@ -991,7 +1001,7 @@ krb5_get_extra_addresses(krb5_context context, krb5_addresses *addresses) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_add_ignore_addresses(krb5_context context, krb5_addresses *addresses) { @@ -1015,7 +1025,7 @@ krb5_add_ignore_addresses(krb5_context context, krb5_addresses *addresses) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_ignore_addresses(krb5_context context, const krb5_addresses *addresses) { if(context->ignore_addresses) @@ -1050,7 +1060,7 @@ krb5_set_ignore_addresses(krb5_context context, const krb5_addresses *addresses) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_ignore_addresses(krb5_context context, krb5_addresses *addresses) { if(context->ignore_addresses == NULL) { @@ -1072,7 +1082,7 @@ krb5_get_ignore_addresses(krb5_context context, krb5_addresses *addresses) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_fcache_version(krb5_context context, int version) { context->fcache_vno = version; @@ -1091,7 +1101,7 @@ krb5_set_fcache_version(krb5_context context, int version) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_fcache_version(krb5_context context, int *version) { *version = context->fcache_vno; @@ -1107,7 +1117,7 @@ krb5_get_fcache_version(krb5_context context, int *version) */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_is_thread_safe(void) { #ifdef ENABLE_PTHREAD_SUPPORT @@ -1126,7 +1136,7 @@ krb5_is_thread_safe(void) * @ingroup krb5 */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_set_dns_canonicalize_hostname (krb5_context context, krb5_boolean flag) { if (flag) @@ -1145,7 +1155,7 @@ krb5_set_dns_canonicalize_hostname (krb5_context context, krb5_boolean flag) * @ingroup krb5 */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_get_dns_canonicalize_hostname (krb5_context context) { return (context->flags & KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME) ? 1 : 0; @@ -1163,7 +1173,7 @@ krb5_get_dns_canonicalize_hostname (krb5_context context) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_kdc_sec_offset (krb5_context context, int32_t *sec, int32_t *usec) { if (sec) @@ -1204,7 +1214,7 @@ krb5_set_kdc_sec_offset (krb5_context context, int32_t sec, int32_t usec) * @ingroup krb5 */ -time_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION time_t KRB5_LIB_CALL krb5_get_max_time_skew (krb5_context context) { return context->max_skew; @@ -1219,7 +1229,7 @@ krb5_get_max_time_skew (krb5_context context) * @ingroup krb5 */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_set_max_time_skew (krb5_context context, time_t t) { context->max_skew = t; @@ -1239,7 +1249,7 @@ krb5_set_max_time_skew (krb5_context context, time_t t) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_etype (krb5_context context, unsigned *len, krb5_enctype **val, diff --git a/lib/krb5/convert_creds.c b/lib/krb5/convert_creds.c index 479e78a91..aff843e78 100644 --- a/lib/krb5/convert_creds.c +++ b/lib/krb5/convert_creds.c @@ -58,7 +58,7 @@ check_ticket_flags(TicketFlags f) * @ingroup krb5_v4compat */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb524_convert_creds_kdc(krb5_context context, krb5_creds *in_cred, struct credentials *v4creds) @@ -160,7 +160,7 @@ out2: * @ingroup krb5_v4compat */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb524_convert_creds_kdc_ccache(krb5_context context, krb5_ccache ccache, krb5_creds *in_cred, diff --git a/lib/krb5/copy_host_realm.c b/lib/krb5/copy_host_realm.c index 7f19ddd3d..73bc117f1 100644 --- a/lib/krb5/copy_host_realm.c +++ b/lib/krb5/copy_host_realm.c @@ -46,7 +46,7 @@ * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_host_realm(krb5_context context, const krb5_realm *from, krb5_realm **to) diff --git a/lib/krb5/creds.c b/lib/krb5/creds.c index 6cc271417..fd277148d 100644 --- a/lib/krb5/creds.c +++ b/lib/krb5/creds.c @@ -45,7 +45,7 @@ * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_cred_contents (krb5_context context, krb5_creds *c) { krb5_free_principal (context, c->client); @@ -74,7 +74,7 @@ krb5_free_cred_contents (krb5_context context, krb5_creds *c) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_creds_contents (krb5_context context, const krb5_creds *incred, krb5_creds *c) @@ -131,7 +131,7 @@ fail: * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_creds (krb5_context context, const krb5_creds *incred, krb5_creds **outcred) @@ -161,7 +161,7 @@ krb5_copy_creds (krb5_context context, * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_creds (krb5_context context, krb5_creds *c) { krb5_free_cred_contents (context, c); @@ -205,7 +205,7 @@ krb5_times_equal(const krb5_times *a, const krb5_times *b) * @ingroup krb5 */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_compare_creds(krb5_context context, krb5_flags whichfields, const krb5_creds * mcreds, const krb5_creds * creds) { diff --git a/lib/krb5/crypto.c b/lib/krb5/crypto.c index 828ed2916..d9d9483a2 100644 --- a/lib/krb5/crypto.c +++ b/lib/krb5/crypto.c @@ -874,7 +874,7 @@ static struct key_type keytype_arcfour = { EVP_rc4 }; -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_salttype_to_string (krb5_context context, krb5_enctype etype, krb5_salttype stype, @@ -906,7 +906,7 @@ krb5_salttype_to_string (krb5_context context, return HEIM_ERR_SALTTYPE_NOSUPP; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_salttype (krb5_context context, krb5_enctype etype, const char *string, @@ -933,7 +933,7 @@ krb5_string_to_salttype (krb5_context context, return HEIM_ERR_SALTTYPE_NOSUPP; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_pw_salt(krb5_context context, krb5_const_principal principal, krb5_salt *salt) @@ -962,7 +962,7 @@ krb5_get_pw_salt(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_salt(krb5_context context, krb5_salt salt) { @@ -970,7 +970,7 @@ krb5_free_salt(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_key_data (krb5_context context, krb5_enctype enctype, krb5_data password, @@ -988,7 +988,7 @@ krb5_string_to_key_data (krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_key (krb5_context context, krb5_enctype enctype, const char *password, @@ -1001,7 +1001,7 @@ krb5_string_to_key (krb5_context context, return krb5_string_to_key_data(context, enctype, pw, principal, key); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_key_data_salt (krb5_context context, krb5_enctype enctype, krb5_data password, @@ -1020,7 +1020,7 @@ krb5_string_to_key_data_salt (krb5_context context, * `opaque'), returning the resulting key in `key' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_key_data_salt_opaque (krb5_context context, krb5_enctype enctype, krb5_data password, @@ -1052,7 +1052,7 @@ krb5_string_to_key_data_salt_opaque (krb5_context context, * in `key' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_key_salt (krb5_context context, krb5_enctype enctype, const char *password, @@ -1065,7 +1065,7 @@ krb5_string_to_key_salt (krb5_context context, return krb5_string_to_key_data_salt(context, enctype, pw, salt, key); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_key_salt_opaque (krb5_context context, krb5_enctype enctype, const char *password, @@ -1080,7 +1080,7 @@ krb5_string_to_key_salt_opaque (krb5_context context, pw, salt, opaque, key); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_enctype_keysize(krb5_context context, krb5_enctype type, size_t *keysize) @@ -1096,7 +1096,7 @@ krb5_enctype_keysize(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_enctype_keybits(krb5_context context, krb5_enctype type, size_t *keybits) @@ -1112,7 +1112,7 @@ krb5_enctype_keybits(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_generate_random_keyblock(krb5_context context, krb5_enctype type, krb5_keyblock *key) @@ -1439,7 +1439,7 @@ hmac(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_hmac(krb5_context context, krb5_cksumtype cktype, const void *data, @@ -1785,7 +1785,7 @@ arcfour_checksum_p(struct checksum_type *ct, krb5_crypto crypto) (crypto->key.key->keytype == KEYTYPE_ARCFOUR); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_create_checksum(krb5_context context, krb5_crypto crypto, krb5_key_usage usage, @@ -1897,7 +1897,7 @@ verify_checksum(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verify_checksum(krb5_context context, krb5_crypto crypto, krb5_key_usage usage, @@ -1926,7 +1926,7 @@ krb5_verify_checksum(krb5_context context, data, len, cksum); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_get_checksum_type(krb5_context context, krb5_crypto crypto, krb5_cksumtype *type) @@ -1951,7 +1951,7 @@ krb5_crypto_get_checksum_type(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_checksumsize(krb5_context context, krb5_cksumtype type, size_t *size) @@ -1967,7 +1967,7 @@ krb5_checksumsize(krb5_context context, return 0; } -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_checksum_is_keyed(krb5_context context, krb5_cksumtype type) { @@ -1982,7 +1982,7 @@ krb5_checksum_is_keyed(krb5_context context, return ct->flags & F_KEYED; } -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_checksum_is_collision_proof(krb5_context context, krb5_cksumtype type) { @@ -1997,7 +1997,7 @@ krb5_checksum_is_collision_proof(krb5_context context, return ct->flags & F_CPROOF; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_checksum_disable(krb5_context context, krb5_cksumtype type) { @@ -2724,7 +2724,7 @@ _find_enctype(krb5_enctype type) } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_enctype_to_string(krb5_context context, krb5_enctype etype, char **string) @@ -2746,7 +2746,7 @@ krb5_enctype_to_string(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_enctype(krb5_context context, const char *string, krb5_enctype *etype) @@ -2763,7 +2763,7 @@ krb5_string_to_enctype(krb5_context context, return KRB5_PROG_ETYPE_NOSUPP; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_enctype_to_keytype(krb5_context context, krb5_enctype etype, krb5_keytype *keytype) @@ -2779,7 +2779,7 @@ krb5_enctype_to_keytype(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_enctype_valid(krb5_context context, krb5_enctype etype) { @@ -2812,7 +2812,7 @@ krb5_enctype_valid(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cksumtype_to_enctype(krb5_context context, krb5_cksumtype ctype, krb5_enctype *etype) @@ -2837,7 +2837,7 @@ krb5_cksumtype_to_enctype(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cksumtype_valid(krb5_context context, krb5_cksumtype ctype) { @@ -3265,7 +3265,7 @@ find_iv(krb5_crypto_iov *data, int num_data, int type) * 4. KRB5_CRYPTO_TYPE_TRAILER */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encrypt_iov_ivec(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3458,7 +3458,7 @@ krb5_encrypt_iov_ivec(krb5_context context, * size as the input data or shorter. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decrypt_iov_ivec(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3606,7 +3606,7 @@ krb5_decrypt_iov_ivec(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_create_checksum_iov(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3689,7 +3689,7 @@ krb5_create_checksum_iov(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verify_checksum_iov(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3751,7 +3751,7 @@ krb5_verify_checksum_iov(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_length(krb5_context context, krb5_crypto crypto, int type, @@ -3795,7 +3795,7 @@ krb5_crypto_length(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_length_iov(krb5_context context, krb5_crypto crypto, krb5_crypto_iov *data, @@ -3815,7 +3815,7 @@ krb5_crypto_length_iov(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encrypt_ivec(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3834,7 +3834,7 @@ krb5_encrypt_ivec(krb5_context context, return encrypt_internal(context, crypto, data, len, result, ivec); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encrypt(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3845,7 +3845,7 @@ krb5_encrypt(krb5_context context, return krb5_encrypt_ivec(context, crypto, usage, data, len, result, NULL); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encrypt_EncryptedData(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3863,7 +3863,7 @@ krb5_encrypt_EncryptedData(krb5_context context, return krb5_encrypt(context, crypto, usage, data, len, &result->cipher); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decrypt_ivec(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3882,7 +3882,7 @@ krb5_decrypt_ivec(krb5_context context, return decrypt_internal(context, crypto, data, len, result, ivec); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decrypt(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3894,7 +3894,7 @@ krb5_decrypt(krb5_context context, NULL); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decrypt_EncryptedData(krb5_context context, krb5_crypto crypto, unsigned usage, @@ -3936,6 +3936,7 @@ seed_something(void) /* Calling RAND_status() will try to use /dev/urandom if it exists so we do not have to deal with it. */ if (RAND_status() != 1) { +#ifndef _WIN32 krb5_context context; const char *p; @@ -3947,6 +3948,10 @@ seed_something(void) RAND_egd_bytes(p, ENTROPY_NEEDED); krb5_free_context(context); } +#else + /* TODO: Once a Windows CryptoAPI RAND method is defined, we + can use that and failover to another method. */ +#endif } if (RAND_status() == 1) { @@ -3959,7 +3964,7 @@ seed_something(void) return -1; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_generate_random_block(void *buf, size_t len) { static int rng_initialized = 0; @@ -4083,7 +4088,7 @@ _new_derived_key(krb5_crypto crypto, unsigned usage) return &d->key; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_derive_key(krb5_context context, const krb5_keyblock *key, krb5_enctype etype, @@ -4162,7 +4167,7 @@ _get_derived_key(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_init(krb5_context context, const krb5_keyblock *key, krb5_enctype etype, @@ -4244,7 +4249,7 @@ free_key_usage(krb5_context context, struct key_usage *ku, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_destroy(krb5_context context, krb5_crypto crypto) { @@ -4270,7 +4275,7 @@ krb5_crypto_destroy(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_getblocksize(krb5_context context, krb5_crypto crypto, size_t *blocksize) @@ -4291,7 +4296,7 @@ krb5_crypto_getblocksize(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_getenctype(krb5_context context, krb5_crypto crypto, krb5_enctype *enctype) @@ -4312,7 +4317,7 @@ krb5_crypto_getenctype(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_getpadsize(krb5_context context, krb5_crypto crypto, size_t *padsize) @@ -4333,7 +4338,7 @@ krb5_crypto_getpadsize(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_getconfoundersize(krb5_context context, krb5_crypto crypto, size_t *confoundersize) @@ -4354,7 +4359,7 @@ krb5_crypto_getconfoundersize(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_enctype_disable(krb5_context context, krb5_enctype enctype) { @@ -4381,7 +4386,7 @@ krb5_enctype_disable(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_enctype_enable(krb5_context context, krb5_enctype enctype) { @@ -4398,7 +4403,7 @@ krb5_enctype_enable(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_key_derived(krb5_context context, const void *str, size_t len, @@ -4570,7 +4575,7 @@ krb5_crypto_overhead (krb5_context context, krb5_crypto crypto) * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_random_to_key(krb5_context context, krb5_enctype type, const void *data, @@ -4862,7 +4867,7 @@ _krb5_pk_kdf(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_prf_length(krb5_context context, krb5_enctype type, size_t *length) @@ -4880,7 +4885,7 @@ krb5_crypto_prf_length(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_prf(krb5_context context, const krb5_crypto crypto, const krb5_data *input, @@ -4971,7 +4976,7 @@ krb5_crypto_prfplus(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_crypto_fx_cf2(krb5_context context, const krb5_crypto crypto1, const krb5_crypto crypto2, @@ -5025,7 +5030,7 @@ krb5_crypto_fx_cf2(krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_keytype_to_enctypes (krb5_context context, krb5_keytype keytype, unsigned *len, @@ -5072,7 +5077,7 @@ krb5_keytype_to_enctypes (krb5_context context, */ /* if two enctypes have compatible keys */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_enctypes_compatible_keys(krb5_context context, krb5_enctype etype1, krb5_enctype etype2) diff --git a/lib/krb5/data.c b/lib/krb5/data.c index 993d6058b..838135ffa 100644 --- a/lib/krb5/data.c +++ b/lib/krb5/data.c @@ -41,7 +41,7 @@ * @ingroup krb5 */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_data_zero(krb5_data *p) { p->length = 0; @@ -59,7 +59,7 @@ krb5_data_zero(krb5_data *p) * @ingroup krb5 */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_data_free(krb5_data *p) { if(p->data != NULL) @@ -76,7 +76,7 @@ krb5_data_free(krb5_data *p) * @ingroup krb5 */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_data(krb5_context context, krb5_data *p) { @@ -96,7 +96,7 @@ krb5_free_data(krb5_context context, * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_data_alloc(krb5_data *p, int len) { p->data = malloc(len); @@ -118,7 +118,7 @@ krb5_data_alloc(krb5_data *p, int len) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_data_realloc(krb5_data *p, int len) { void *tmp; @@ -143,7 +143,7 @@ krb5_data_realloc(krb5_data *p, int len) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_data_copy(krb5_data *p, const void *data, size_t len) { if (len) { @@ -169,7 +169,7 @@ krb5_data_copy(krb5_data *p, const void *data, size_t len) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_data(krb5_context context, const krb5_data *indata, krb5_data **outdata) @@ -200,7 +200,7 @@ krb5_copy_data(krb5_context context, * @ingroup krb5 */ -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_data_cmp(const krb5_data *data1, const krb5_data *data2) { if (data1->length != data2->length) diff --git a/lib/krb5/deprecated.c b/lib/krb5/deprecated.c index 00ba92b9a..90e8f5e1a 100644 --- a/lib/krb5/deprecated.c +++ b/lib/krb5/deprecated.c @@ -51,7 +51,7 @@ * @ingroup krb5_deprecated */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_data_contents(krb5_context context, krb5_data *data) KRB5_DEPRECATED { @@ -64,7 +64,7 @@ krb5_free_data_contents(krb5_context context, krb5_data *data) * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_keytype_to_enctypes_default (krb5_context context, krb5_keytype keytype, unsigned *len, @@ -114,7 +114,7 @@ static int num_keys = sizeof(keys) / sizeof(keys[0]); * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_keytype_to_string(krb5_context context, krb5_keytype keytype, char **string) @@ -151,7 +151,7 @@ krb5_keytype_to_string(krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_keytype(krb5_context context, const char *string, krb5_keytype *keytype) @@ -184,7 +184,7 @@ krb5_string_to_keytype(krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_password_key_proc (krb5_context context, krb5_enctype type, krb5_salt salt, @@ -220,7 +220,7 @@ krb5_password_key_proc (krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_tkt_with_password (krb5_context context, krb5_flags options, krb5_addresses *addrs, @@ -262,7 +262,7 @@ krb5_skey_key_proc (krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_tkt_with_skey (krb5_context context, krb5_flags options, krb5_addresses *addrs, @@ -305,7 +305,7 @@ krb5_get_in_tkt_with_skey (krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_keytab_key_proc (krb5_context context, krb5_enctype enctype, krb5_salt salt, @@ -345,7 +345,7 @@ krb5_keytab_key_proc (krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_tkt_with_keytab (krb5_context context, krb5_flags options, krb5_addresses *addrs, @@ -389,7 +389,7 @@ convert_func(krb5_context conxtext, void *funcctx, krb5_principal principal) * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_425_conv_principal_ext(krb5_context context, const char *name, const char *instance, @@ -415,7 +415,7 @@ krb5_425_conv_principal_ext(krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_425_conv_principal(krb5_context context, const char *name, const char *instance, @@ -444,7 +444,7 @@ krb5_425_conv_principal(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_gen_new(krb5_context context, const krb5_cc_ops *ops, krb5_ccache *id) @@ -459,7 +459,7 @@ krb5_cc_gen_new(krb5_context context, * @ingroup krb5_deprecated */ -krb5_realm * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_realm * KRB5_LIB_CALL krb5_princ_realm(krb5_context context, krb5_principal principal) KRB5_DEPRECATED @@ -474,7 +474,7 @@ krb5_princ_realm(krb5_context context, * @ingroup krb5_deprecated */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_princ_set_realm(krb5_context context, krb5_principal principal, krb5_realm *realm) @@ -490,7 +490,7 @@ krb5_princ_set_realm(krb5_context context, */ /* keep this for compatibility with older code */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_creds_contents (krb5_context context, krb5_creds *c) KRB5_DEPRECATED { @@ -508,7 +508,7 @@ krb5_free_creds_contents (krb5_context context, krb5_creds *c) * @ingroup krb5_deprecated */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_error_string(krb5_context context, char *str) KRB5_DEPRECATED { @@ -528,7 +528,7 @@ krb5_free_error_string(krb5_context context, char *str) * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_error_string(krb5_context context, const char *fmt, ...) __attribute__((format (printf, 2, 3))) KRB5_DEPRECATED { @@ -554,7 +554,7 @@ krb5_set_error_string(krb5_context context, const char *fmt, ...) * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_vset_error_string(krb5_context context, const char *fmt, va_list args) __attribute__ ((format (printf, 2, 0))) KRB5_DEPRECATED { @@ -572,7 +572,7 @@ krb5_vset_error_string(krb5_context context, const char *fmt, va_list args) * @ingroup krb5_deprecated */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_clear_error_string(krb5_context context) KRB5_DEPRECATED { @@ -585,7 +585,7 @@ krb5_clear_error_string(krb5_context context) * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache, krb5_creds *in_creds, @@ -606,7 +606,7 @@ krb5_get_cred_from_kdc_opt(krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_cred_from_kdc(krb5_context context, krb5_ccache ccache, krb5_creds *in_creds, diff --git a/lib/krb5/derived-key-test.c b/lib/krb5/derived-key-test.c index fe85ff257..a67c95a54 100644 --- a/lib/krb5/derived-key-test.c +++ b/lib/krb5/derived-key-test.c @@ -75,7 +75,7 @@ static struct testcase { {0} }; -int KRB5_LIB_FUNCTION +int main(int argc, char **argv) { struct testcase *t; diff --git a/lib/krb5/eai_to_heim_errno.c b/lib/krb5/eai_to_heim_errno.c index 499150f46..ef11e370f 100644 --- a/lib/krb5/eai_to_heim_errno.c +++ b/lib/krb5/eai_to_heim_errno.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" /** * Convert the getaddrinfo() error code to a Kerberos et error code. @@ -44,7 +44,7 @@ * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_eai_to_heim_errno(int eai_errno, int system_error) { switch(eai_errno) { @@ -74,8 +74,10 @@ krb5_eai_to_heim_errno(int eai_errno, int system_error) return HEIM_EAI_SERVICE; case EAI_SOCKTYPE: return HEIM_EAI_SOCKTYPE; +#ifdef EAI_SYSTEM case EAI_SYSTEM: return system_error; +#endif default: return HEIM_EAI_UNKNOWN; /* XXX */ } @@ -92,7 +94,7 @@ krb5_eai_to_heim_errno(int eai_errno, int system_error) * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_h_errno_to_heim_errno(int eai_errno) { switch(eai_errno) { diff --git a/lib/krb5/error_string.c b/lib/krb5/error_string.c index c524c4b52..076b7781d 100644 --- a/lib/krb5/error_string.c +++ b/lib/krb5/error_string.c @@ -44,7 +44,7 @@ * @ingroup krb5_error */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_clear_error_message(krb5_context context) { HEIMDAL_MUTEX_lock(context->mutex); @@ -67,7 +67,7 @@ krb5_clear_error_message(krb5_context context) * @ingroup krb5_error */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_set_error_message(krb5_context context, krb5_error_code ret, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))) @@ -91,7 +91,7 @@ krb5_set_error_message(krb5_context context, krb5_error_code ret, */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_vset_error_message (krb5_context context, krb5_error_code ret, const char *fmt, va_list args) __attribute__ ((format (printf, 3, 0))) @@ -179,7 +179,7 @@ krb5_vprepend_error_message(krb5_context context, krb5_error_code ret, * @ingroup krb5_error */ -char * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION char * KRB5_LIB_CALL krb5_get_error_string(krb5_context context) { char *ret = NULL; @@ -191,7 +191,7 @@ krb5_get_error_string(krb5_context context) return ret; } -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_have_error_string(krb5_context context) { char *str; @@ -214,7 +214,7 @@ krb5_have_error_string(krb5_context context) * @ingroup krb5_error */ -const char * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL krb5_get_error_message(krb5_context context, krb5_error_code code) { char *str; @@ -258,7 +258,7 @@ krb5_get_error_message(krb5_context context, krb5_error_code code) * @ingroup krb5_error */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_error_message(krb5_context context, const char *msg) { free(rk_UNCONST(msg)); @@ -279,7 +279,7 @@ krb5_free_error_message(krb5_context context, const char *msg) * @ingroup krb5 */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_get_err_text(krb5_context context, krb5_error_code code) KRB5_DEPRECATED { const char *p = NULL; diff --git a/lib/krb5/expand_hostname.c b/lib/krb5/expand_hostname.c index 67988d0d7..7b638d5f0 100644 --- a/lib/krb5/expand_hostname.c +++ b/lib/krb5/expand_hostname.c @@ -63,7 +63,7 @@ copy_hostname(krb5_context context, * @ingroup krb5_support */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_expand_hostname (krb5_context context, const char *orig_hostname, char **new_hostname) @@ -140,7 +140,7 @@ vanilla_hostname (krb5_context context, * @ingroup krb5_support */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_expand_hostname_realms (krb5_context context, const char *orig_hostname, char **new_hostname, diff --git a/lib/krb5/expand_path_w32.c b/lib/krb5/expand_path_w32.c new file mode 100644 index 000000000..329ea3602 --- /dev/null +++ b/lib/krb5/expand_path_w32.c @@ -0,0 +1,377 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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 "krb5_locl.h" +#include +#include + +#define PTYPE int + +/** + * Expand a %{TEMP} token + * + * The %{TEMP} token expands to the temporary path for the current + * user as returned by GetTempPath(). + * + * @note: Since the GetTempPath() function relies on the TMP or TEMP + * environment variables, this function will failover to the system + * temporary directory until the user profile is loaded. In addition, + * the returned path may or may not exist. + */ +static int +_expand_temp_folder(krb5_context context, PTYPE param, char ** ret) +{ + TCHAR tpath[MAX_PATH]; + size_t len; + + if (!GetTempPath(sizeof(tpath)/sizeof(tpath[0]), tpath)) { + if (context) + krb5_set_error_string(context, "Failed to get temporary path (GLE=%d)", + GetLastError()); + return 1; + } + + len = strlen(tpath); + + if (len > 0 && tpath[len - 1] == '\\') + tpath[len - 1] = '\0'; + + *ret = strdup(tpath); + + if (*ret == NULL) { + if (context) + krb5_set_error_string(context, "strdup - Out of memory"); + return 1; + } + + return 0; +} + +/** + * Expand a %{USERID} token + * + * The %{USERID} token expands to the string representation of the + * user's SID. The user account that will be used is the account + * corresponding to the current thread's security token. This means + * that: + * + * - If the current thread token has the anonymous impersonation + * level, the call will fail. + * + * - If the current thread is impersonating a token at + * SecurityIdentification level the call will fail. + * + */ +static int +_expand_userid(krb5_context context, PTYPE param, char ** ret) +{ + int rv = 1; + HANDLE hThread = NULL; + HANDLE hToken = NULL; + PTOKEN_OWNER pOwner = NULL; + DWORD len = 0; + LPTSTR strSid = NULL; + + hThread = GetCurrentThread(); + + if (!OpenThreadToken(hThread, TOKEN_QUERY, + FALSE, /* Open the thread token as the + current thread user. */ + &hToken)) { + + DWORD le = GetLastError(); + + if (le == ERROR_NO_TOKEN) { + HANDLE hProcess = GetCurrentProcess(); + + le = 0; + if (!OpenProcessToken(hProcess, TOKEN_QUERY, &hToken)) + le = GetLastError(); + } + + if (le != 0) { + if (context) + krb5_set_error_string(context, "Can't open thread token (GLE=%d)", le); + goto _exit; + } + } + + if (!GetTokenInformation(hToken, TokenOwner, NULL, 0, &len)) { + if (GetLastError() != ERROR_INSUFFICIENT_BUFFER) { + if (context) + krb5_set_error_string(context, "Unexpected error reading token information (GLE=%d)", + GetLastError()); + goto _exit; + } + + if (len == 0) { + if (context) + krb5_set_error_string(context, "GetTokenInformation() returned truncated buffer"); + goto _exit; + } + + pOwner = malloc(len); + if (pOwner == NULL) { + if (context) + krb5_set_error_string(context, "Out of memory"); + goto _exit; + } + } else { + if (context) + krb5_set_error_string(context, "GetTokenInformation() returned truncated buffer"); + goto _exit; + } + + if (!GetTokenInformation(hToken, TokenOwner, pOwner, len, &len)) { + if (context) + krb5_set_error_string(context, "GetTokenInformation() failed. GLE=%d", GetLastError()); + goto _exit; + } + + if (!ConvertSidToStringSid(pOwner->Owner, &strSid)) { + if (context) + krb5_set_error_string(context, "Can't convert SID to string. GLE=%d", GetLastError()); + goto _exit; + } + + *ret = strdup(strSid); + if (*ret == NULL && context) + krb5_set_error_string(context, "Out of memory"); + + rv = 0; + + _exit: + if (hToken != NULL) + CloseHandle(hToken); + + if (pOwner != NULL) + free (pOwner); + + if (strSid != NULL) + LocalFree(strSid); + + return rv; +} + +static int +_expand_null(krb5_context context, PTYPE param, char ** ret) +{ + *ret = strdup(""); + if (*ret == NULL) { + if (context) + krb5_set_error_string(context, "Out of memory"); + return 1; + } + return 0; +} + + +static int +_expand_csidl(krb5_context context, PTYPE folder, char ** ret) +{ + TCHAR path[MAX_PATH]; + size_t len; + + if (SHGetFolderPath(NULL, folder, NULL, SHGFP_TYPE_CURRENT, path) != S_OK) { + if (context) + krb5_set_error_string(context, "Unable to determine folder path"); + return 1; + } + + len = strlen(path); + + if (len > 0 && path[len - 1] == '\\') + path[len - 1] = '\0'; + + *ret = strdup(path); + if (*ret == NULL) { + if (context) + krb5_set_error_string(context, "Out of memory"); + return 1; + } + return 0; +} + +static const struct token { + const char * tok; + int ftype; +#define FTYPE_CSIDL 0 +#define FTYPE_SPECIAL 1 + + PTYPE param; + + int (*exp_func)(krb5_context, PTYPE, char **); + +#define CSIDL(C) FTYPE_CSIDL, C, _expand_csidl + +#define SPECIAL(f) FTYPE_SPECIAL, 0, f + +} tokens[] = { + {"APPDATA", CSIDL(CSIDL_APPDATA)}, + /* Roaming application data (for current user) */ + + {"COMMON_APPDATA", CSIDL(CSIDL_COMMON_APPDATA)}, + /* Application data (all users) */ + + {"LOCAL_APPDATA", CSIDL(CSIDL_LOCAL_APPDATA)}, + /* Local application data (for current user) */ + + {"SYSTEM", CSIDL(CSIDL_SYSTEM)}, + /* Windows System folder (e.g. %WINDIR%\System32) */ + + {"WINDOWS", CSIDL(CSIDL_WINDOWS)}, + /* Windows folder */ + + {"TEMP", SPECIAL(_expand_temp_folder)}, + /* Temporary files folder */ + + {"USERID", SPECIAL(_expand_userid)}, + /* User ID (On Windows, this expands + to the user's string SID */ + + {"uid", SPECIAL(_expand_userid)}, + /* Alias for USERID */ + + {"null", SPECIAL(_expand_null)}, + /* Empty string. For compatibility. */ + +}; + +static int +_expand_token(krb5_context context, const char * token, const char * token_end, + char ** ret) +{ + int i; + + *ret = NULL; + + if (token[0] != '%' || token[1] != '{' || token_end[0] != '}') { + if (context) + krb5_set_error_string(context, "Invalid token."); + return 1; + } + + for (i=0; i < sizeof(tokens)/sizeof(tokens[0]); i++) { + if (!strncmp(token+2, tokens[i].tok, (token_end - token) - 2)) + return tokens[i].exp_func(context, tokens[i].param, ret); + } + + if (context) + krb5_set_error_string(context, "Invalid token."); + return 1; +} + +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL +_krb5_expand_path_tokens(krb5_context context, + const char * path_in, + char ** ppath_out) +{ + size_t len = 0; + char *tok_begin, *tok_end, *append; + const char *path_left; + + *ppath_out = NULL; + + for (path_left = path_in; path_left && *path_left; ) { + + tok_begin = strstr(path_left, "%{"); + + if (tok_begin && tok_begin != path_left) { + + append = malloc((tok_begin - path_left) + 1); + if (append) { + memcpy(append, path_left, tok_begin - path_left); + append[tok_begin - path_left] = '\0'; + } + path_left = tok_begin; + + } else if (tok_begin) { + + tok_end = strchr(tok_begin, '}'); + if (tok_end == NULL) { + if (*ppath_out) + free(*ppath_out); + *ppath_out = NULL; + if (context) + krb5_set_error_string(context, "variable missing }"); + return KRB5_CONFIG_BADFORMAT; + } + + if (_expand_token(context, tok_begin, tok_end, &append)) { + if (*ppath_out) + free(*ppath_out); + *ppath_out = NULL; + return KRB5_CONFIG_BADFORMAT; + } + + path_left = tok_end + 1; + } else { + + append = strdup(path_left); + path_left = NULL; + + } + + if (append == NULL) { + + if (*ppath_out) + free(*ppath_out); + *ppath_out = NULL; + if (context) + krb5_set_error_string(context, "malloc - out of memory"); + return ENOMEM; + + } + + { + size_t append_len = strlen(append); + char * new_str = realloc(*ppath_out, len + append_len + 1); + + if (new_str == NULL) { + free(append); + if (*ppath_out) + free(*ppath_out); + *ppath_out = NULL; + if (context) + krb5_set_error_string(context, "malloc - out of memory"); + return ENOMEM; + } + + *ppath_out = new_str; + memcpy(*ppath_out + len, append, append_len + 1); + len = len + append_len; + free(append); + } + } + + return 0; +} + diff --git a/lib/krb5/fcache.c b/lib/krb5/fcache.c index 037745efc..3ae43e3ff 100644 --- a/lib/krb5/fcache.c +++ b/lib/krb5/fcache.c @@ -226,7 +226,11 @@ scrub_file (int fd) return errno; pos -= tmp; } +#ifdef _MSC_VER + _commit (fd); +#else fsync (fd); +#endif return 0; } @@ -320,6 +324,22 @@ fcc_gen_new(krb5_context context, krb5_ccache *id) N_("malloc: out of memory", "")); return KRB5_CC_NOMEM; } +#ifdef KRB5_USE_PATH_TOKENS + { + char * exp_file = NULL; + krb5_error_code ec; + + ec = _krb5_expand_path_tokens(context, file, &exp_file); + + if (ec == 0) { + free(file); + file = exp_file; + } else { + free(file); + return ec; + } + } +#endif fd = mkstemp(file); if(fd < 0) { int ret = errno; @@ -898,6 +918,15 @@ fcc_move(krb5_context context, krb5_ccache from, krb5_ccache to) krb5_error_code ret = 0; ret = rename(FILENAME(from), FILENAME(to)); +#ifdef RENAME_DOES_NOT_UNLINK + if (ret && (errno == EEXIST || errno == EACCES)) { + ret = unlink(FILENAME(to)); + if (ret == 0) { + ret = rename(FILENAME(from), FILENAME(to)); + } + } +#endif + if (ret && errno != EXDEV) { char buf[128]; ret = errno; diff --git a/lib/krb5/free.c b/lib/krb5/free.c index 7f4374374..5bb33b443 100644 --- a/lib/krb5/free.c +++ b/lib/krb5/free.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_kdc_rep(krb5_context context, krb5_kdc_rep *rep) { free_KDC_REP(&rep->kdc_rep); @@ -43,7 +43,7 @@ krb5_free_kdc_rep(krb5_context context, krb5_kdc_rep *rep) return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_xfree (void *ptr) { free (ptr); diff --git a/lib/krb5/free_host_realm.c b/lib/krb5/free_host_realm.c index f6e9f6e24..0932674e9 100644 --- a/lib/krb5/free_host_realm.c +++ b/lib/krb5/free_host_realm.c @@ -44,7 +44,7 @@ * @ingroup krb5_support */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_host_realm(krb5_context context, krb5_realm *realmlist) { diff --git a/lib/krb5/generate_seq_number.c b/lib/krb5/generate_seq_number.c index b7bd8b99f..575f842d8 100644 --- a/lib/krb5/generate_seq_number.c +++ b/lib/krb5/generate_seq_number.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_generate_seq_number(krb5_context context, const krb5_keyblock *key, uint32_t *seqno) diff --git a/lib/krb5/generate_subkey.c b/lib/krb5/generate_subkey.c index 003a66ac0..e09dc2a91 100644 --- a/lib/krb5/generate_subkey.c +++ b/lib/krb5/generate_subkey.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" /** * Generate subkey, from keyblock @@ -46,7 +46,7 @@ * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_generate_subkey_extended(krb5_context context, const krb5_keyblock *key, krb5_enctype etype, diff --git a/lib/krb5/get_addrs.c b/lib/krb5/get_addrs.c index 8f366fa14..829b2acc1 100644 --- a/lib/krb5/get_addrs.c +++ b/lib/krb5/get_addrs.c @@ -266,7 +266,7 @@ get_addrs_int (krb5_context context, krb5_addresses *res, int flags) * Only include loopback address if there are no other. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_all_client_addrs (krb5_context context, krb5_addresses *res) { int flags = LOOP_IF_NONE | EXTRA_ADDRESSES; @@ -282,7 +282,7 @@ krb5_get_all_client_addrs (krb5_context context, krb5_addresses *res) * If that fails, we return the address corresponding to `hostname'. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_all_server_addrs (krb5_context context, krb5_addresses *res) { return get_addrs_int (context, res, LOOP | SCAN_INTERFACES); diff --git a/lib/krb5/get_cred.c b/lib/krb5/get_cred.c index 23bd06f80..3d76391fa 100644 --- a/lib/krb5/get_cred.c +++ b/lib/krb5/get_cred.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" #include /* @@ -608,7 +608,7 @@ get_cred_kdc_address(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_kdc_cred(krb5_context context, krb5_ccache id, krb5_kdc_flags flags, @@ -1068,7 +1068,7 @@ _krb5_get_cred_kdc_any(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_credentials_with_flags(krb5_context context, krb5_flags options, krb5_kdc_flags flags, @@ -1154,7 +1154,7 @@ krb5_get_credentials_with_flags(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_credentials(krb5_context context, krb5_flags options, krb5_ccache ccache, @@ -1175,7 +1175,7 @@ struct krb5_get_creds_opt_data { }; -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_creds_opt_alloc(krb5_context context, krb5_get_creds_opt *opt) { *opt = calloc(1, sizeof(**opt)); @@ -1187,7 +1187,7 @@ krb5_get_creds_opt_alloc(krb5_context context, krb5_get_creds_opt *opt) return 0; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_creds_opt_free(krb5_context context, krb5_get_creds_opt opt) { if (opt->self) @@ -1200,7 +1200,7 @@ krb5_get_creds_opt_free(krb5_context context, krb5_get_creds_opt opt) free(opt); } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_creds_opt_set_options(krb5_context context, krb5_get_creds_opt opt, krb5_flags options) @@ -1208,7 +1208,7 @@ krb5_get_creds_opt_set_options(krb5_context context, opt->options = options; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_creds_opt_add_options(krb5_context context, krb5_get_creds_opt opt, krb5_flags options) @@ -1216,7 +1216,7 @@ krb5_get_creds_opt_add_options(krb5_context context, opt->options |= options; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_creds_opt_set_enctype(krb5_context context, krb5_get_creds_opt opt, krb5_enctype enctype) @@ -1224,7 +1224,7 @@ krb5_get_creds_opt_set_enctype(krb5_context context, opt->enctype = enctype; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_creds_opt_set_impersonate(krb5_context context, krb5_get_creds_opt opt, krb5_const_principal self) @@ -1234,7 +1234,7 @@ krb5_get_creds_opt_set_impersonate(krb5_context context, return krb5_copy_principal(context, self, &opt->self); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_creds_opt_set_ticket(krb5_context context, krb5_get_creds_opt opt, const Ticket *ticket) @@ -1267,7 +1267,7 @@ krb5_get_creds_opt_set_ticket(krb5_context context, -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_creds(krb5_context context, krb5_get_creds_opt opt, krb5_ccache ccache, @@ -1395,7 +1395,7 @@ krb5_get_creds(krb5_context context, * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_renewed_creds(krb5_context context, krb5_creds *creds, krb5_const_principal client, diff --git a/lib/krb5/get_default_principal.c b/lib/krb5/get_default_principal.c index 82d064293..539dedfa4 100644 --- a/lib/krb5/get_default_principal.c +++ b/lib/krb5/get_default_principal.c @@ -48,6 +48,8 @@ get_env_user(void) return user; } +#ifndef _WIN32 + /* * Will only use operating-system dependant operation to get the * default principal, for use of functions that in ccache layer to @@ -93,7 +95,58 @@ _krb5_get_default_principal_local (krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +#else /* _WIN32 */ + +#define SECURITY_WIN32 +#include + +krb5_error_code +_krb5_get_default_principal_local(krb5_context context, + krb5_principal *princ) +{ + krb5_error_code ret = 0; + + /* See if we can get the principal first. We only expect this to + work if logged into a domain. */ + { + char username[1024]; + ULONG sz = sizeof(username); + + if (GetUserNameEx(NameUserPrincipal, username, &sz)) { + return krb5_parse_name_flags(context, username, + KRB5_PRINCIPAL_PARSE_ENTERPRISE, + princ); + } + } + + /* Just get the Windows username. This should pretty much always + work. */ + { + char username[1024]; + DWORD dsz = sizeof(username); + + if (GetUserName(username, &dsz)) { + return krb5_make_principal(context, princ, NULL, username, NULL); + } + } + + /* Failing that, we look at the environment */ + { + const char * username = get_env_user(); + + if (username == NULL) { + krb5_set_error_string(context, + "unable to figure out current principal"); + return ENOTTY; /* Really? */ + } + + return krb5_make_principal(context, princ, NULL, username, NULL); + } +} + +#endif + +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_default_principal (krb5_context context, krb5_principal *princ) { diff --git a/lib/krb5/get_default_realm.c b/lib/krb5/get_default_realm.c index f09df264c..2a4933a62 100644 --- a/lib/krb5/get_default_realm.c +++ b/lib/krb5/get_default_realm.c @@ -38,7 +38,7 @@ * Free this memory with krb5_free_host_realm. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_default_realms (krb5_context context, krb5_realm **realms) { @@ -57,7 +57,7 @@ krb5_get_default_realms (krb5_context context, * Return the first default realm. For compatibility. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_default_realm(krb5_context context, krb5_realm *realm) { diff --git a/lib/krb5/get_for_creds.c b/lib/krb5/get_for_creds.c index 8c58dae18..a109c7132 100644 --- a/lib/krb5/get_for_creds.c +++ b/lib/krb5/get_for_creds.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" static krb5_error_code add_addrs(krb5_context context, @@ -100,7 +100,7 @@ fail: * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_fwd_tgt_creds (krb5_context context, krb5_auth_context auth_context, const char *hostname, @@ -183,7 +183,7 @@ krb5_fwd_tgt_creds (krb5_context context, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_forwarded_creds (krb5_context context, krb5_auth_context auth_context, krb5_ccache ccache, diff --git a/lib/krb5/get_host_realm.c b/lib/krb5/get_host_realm.c index 7d7fef6e1..7aee02734 100644 --- a/lib/krb5/get_host_realm.c +++ b/lib/krb5/get_host_realm.c @@ -158,7 +158,7 @@ config_find_realm(krb5_context context, * fall back to guessing */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_get_host_realm_int (krb5_context context, const char *host, krb5_boolean use_dns, @@ -215,7 +215,7 @@ _krb5_get_host_realm_int (krb5_context context, * `realms'. Free `realms' with krb5_free_host_realm(). */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_host_realm(krb5_context context, const char *targethost, krb5_realm **realms) diff --git a/lib/krb5/get_in_tkt.c b/lib/krb5/get_in_tkt.c index 1ab3dc91b..7933d48c5 100644 --- a/lib/krb5/get_in_tkt.c +++ b/lib/krb5/get_in_tkt.c @@ -361,7 +361,7 @@ set_ptypes(krb5_context context, return(1); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_cred(krb5_context context, krb5_flags options, const krb5_addresses *addrs, @@ -526,7 +526,7 @@ out: return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_tkt(krb5_context context, krb5_flags options, const krb5_addresses *addrs, diff --git a/lib/krb5/get_port.c b/lib/krb5/get_port.c index 5d0361b81..93d9433cd 100644 --- a/lib/krb5/get_port.c +++ b/lib/krb5/get_port.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_getportbyname (krb5_context context, const char *service, const char *proto, diff --git a/lib/krb5/init_creds.c b/lib/krb5/init_creds.c index 743212d26..974a300ef 100644 --- a/lib/krb5/init_creds.c +++ b/lib/krb5/init_creds.c @@ -52,7 +52,7 @@ * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_alloc(krb5_context context, krb5_get_init_creds_opt **opt) { @@ -84,7 +84,7 @@ krb5_get_init_creds_opt_alloc(krb5_context context, * @ingroup krb5_credential */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_free(krb5_context context, krb5_get_init_creds_opt *opt) { @@ -150,7 +150,7 @@ get_config_bool (krb5_context context, * [realms] or [libdefaults] for some of the values. */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_default_flags(krb5_context context, const char *appname, krb5_const_realm realm, @@ -201,7 +201,7 @@ krb5_get_init_creds_opt_set_default_flags(krb5_context context, } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_tkt_life(krb5_get_init_creds_opt *opt, krb5_deltat tkt_life) { @@ -209,7 +209,7 @@ krb5_get_init_creds_opt_set_tkt_life(krb5_get_init_creds_opt *opt, opt->tkt_life = tkt_life; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_renew_life(krb5_get_init_creds_opt *opt, krb5_deltat renew_life) { @@ -217,7 +217,7 @@ krb5_get_init_creds_opt_set_renew_life(krb5_get_init_creds_opt *opt, opt->renew_life = renew_life; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_forwardable(krb5_get_init_creds_opt *opt, int forwardable) { @@ -225,7 +225,7 @@ krb5_get_init_creds_opt_set_forwardable(krb5_get_init_creds_opt *opt, opt->forwardable = forwardable; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_proxiable(krb5_get_init_creds_opt *opt, int proxiable) { @@ -233,7 +233,7 @@ krb5_get_init_creds_opt_set_proxiable(krb5_get_init_creds_opt *opt, opt->proxiable = proxiable; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_etype_list(krb5_get_init_creds_opt *opt, krb5_enctype *etype_list, int etype_list_length) @@ -243,7 +243,7 @@ krb5_get_init_creds_opt_set_etype_list(krb5_get_init_creds_opt *opt, opt->etype_list_length = etype_list_length; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_address_list(krb5_get_init_creds_opt *opt, krb5_addresses *addresses) { @@ -251,7 +251,7 @@ krb5_get_init_creds_opt_set_address_list(krb5_get_init_creds_opt *opt, opt->address_list = addresses; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_preauth_list(krb5_get_init_creds_opt *opt, krb5_preauthtype *preauth_list, int preauth_list_length) @@ -261,7 +261,7 @@ krb5_get_init_creds_opt_set_preauth_list(krb5_get_init_creds_opt *opt, opt->preauth_list = preauth_list; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_salt(krb5_get_init_creds_opt *opt, krb5_data *salt) { @@ -269,7 +269,7 @@ krb5_get_init_creds_opt_set_salt(krb5_get_init_creds_opt *opt, opt->salt = salt; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_set_anonymous(krb5_get_init_creds_opt *opt, int anonymous) { @@ -290,7 +290,7 @@ require_ext_opt(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_set_pa_password(krb5_context context, krb5_get_init_creds_opt *opt, const char *password, @@ -305,7 +305,7 @@ krb5_get_init_creds_opt_set_pa_password(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_set_pac_request(krb5_context context, krb5_get_init_creds_opt *opt, krb5_boolean req_pac) @@ -320,7 +320,7 @@ krb5_get_init_creds_opt_set_pac_request(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_set_addressless(krb5_context context, krb5_get_init_creds_opt *opt, krb5_boolean addressless) @@ -336,7 +336,7 @@ krb5_get_init_creds_opt_set_addressless(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_set_canonicalize(krb5_context context, krb5_get_init_creds_opt *opt, krb5_boolean req) @@ -352,7 +352,7 @@ krb5_get_init_creds_opt_set_canonicalize(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_set_win2k(krb5_context context, krb5_get_init_creds_opt *opt, krb5_boolean req) @@ -372,7 +372,7 @@ krb5_get_init_creds_opt_set_win2k(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_set_process_last_req(krb5_context context, krb5_get_init_creds_opt *opt, krb5_gic_process_last_req func, @@ -402,7 +402,7 @@ krb5_get_init_creds_opt_set_process_last_req(krb5_context context, * @ingroup krb5_deprecated */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt) KRB5_DEPRECATED { @@ -416,7 +416,7 @@ krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt) * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_get_error(krb5_context context, krb5_get_init_creds_opt *opt, KRB_ERROR **error) diff --git a/lib/krb5/init_creds_pw.c b/lib/krb5/init_creds_pw.c index c910fea13..e364c711d 100644 --- a/lib/krb5/init_creds_pw.c +++ b/lib/krb5/init_creds_pw.c @@ -586,7 +586,7 @@ out: } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_keyblock_key_proc (krb5_context context, krb5_keytype type, krb5_data *salt, @@ -1332,7 +1332,7 @@ process_pa_data_to_key(krb5_context context, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_creds_init(krb5_context context, krb5_principal client, krb5_prompter_fct prompter, @@ -1386,7 +1386,7 @@ krb5_init_creds_init(krb5_context context, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_creds_set_service(krb5_context context, krb5_init_creds_context ctx, const char *service) @@ -1426,7 +1426,7 @@ krb5_init_creds_set_service(krb5_context context, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_creds_set_password(krb5_context context, krb5_init_creds_context ctx, const char *password) @@ -1492,7 +1492,7 @@ keytab_key_proc(krb5_context context, krb5_enctype enctype, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_creds_set_keytab(krb5_context context, krb5_init_creds_context ctx, krb5_keytab keytab) @@ -1583,7 +1583,7 @@ keyblock_key_proc(krb5_context context, krb5_enctype enctype, return krb5_copy_keyblock (context, keyseed, key); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_creds_set_keyblock(krb5_context context, krb5_init_creds_context ctx, krb5_keyblock *keyblock) @@ -1614,7 +1614,7 @@ krb5_init_creds_set_keyblock(krb5_context context, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_creds_step(krb5_context context, krb5_init_creds_context ctx, krb5_data *in, @@ -1827,7 +1827,7 @@ krb5_init_creds_step(krb5_context context, * @return 0 for sucess or An Kerberos error code, see krb5_get_error_message(). */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_creds_get_creds(krb5_context context, krb5_init_creds_context ctx, krb5_creds *cred) @@ -1843,7 +1843,7 @@ krb5_init_creds_get_creds(krb5_context context, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_creds_get_error(krb5_context context, krb5_init_creds_context ctx, KRB_ERROR *error) @@ -1883,7 +1883,7 @@ krb5_init_creds_free(krb5_context context, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_init_creds_get(krb5_context context, krb5_init_creds_context ctx) { krb5_sendto_ctx stctx = NULL; @@ -1931,7 +1931,7 @@ krb5_init_creds_get(krb5_context context, krb5_init_creds_context ctx) */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_password(krb5_context context, krb5_creds *creds, krb5_principal client, @@ -2037,7 +2037,7 @@ krb5_get_init_creds_password(krb5_context context, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_keyblock(krb5_context context, krb5_creds *creds, krb5_principal client, @@ -2084,7 +2084,7 @@ krb5_get_init_creds_keyblock(krb5_context context, * @ingroup krb5_credential */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_keytab(krb5_context context, krb5_creds *creds, krb5_principal client, diff --git a/lib/krb5/keyblock.c b/lib/krb5/keyblock.c index 046caee6d..2d57e301d 100644 --- a/lib/krb5/keyblock.c +++ b/lib/krb5/keyblock.c @@ -41,7 +41,7 @@ * @ingroup krb5_crypto */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_keyblock_zero(krb5_keyblock *keyblock) { keyblock->keytype = 0; @@ -57,7 +57,7 @@ krb5_keyblock_zero(krb5_keyblock *keyblock) * @ingroup krb5_crypto */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_keyblock_contents(krb5_context context, krb5_keyblock *keyblock) { @@ -79,7 +79,7 @@ krb5_free_keyblock_contents(krb5_context context, * @ingroup krb5_crypto */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_keyblock(krb5_context context, krb5_keyblock *keyblock) { @@ -102,7 +102,7 @@ krb5_free_keyblock(krb5_context context, * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_keyblock_contents (krb5_context context, const krb5_keyblock *inblock, krb5_keyblock *to) @@ -124,7 +124,7 @@ krb5_copy_keyblock_contents (krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_keyblock (krb5_context context, const krb5_keyblock *inblock, krb5_keyblock **to) @@ -170,7 +170,7 @@ krb5_keyblock_get_enctype(const krb5_keyblock *block) * @ingroup krb5_crypto */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_keyblock_init(krb5_context context, krb5_enctype type, const void *data, diff --git a/lib/krb5/keytab.c b/lib/krb5/keytab.c index fcc74e847..79b079a05 100644 --- a/lib/krb5/keytab.c +++ b/lib/krb5/keytab.c @@ -143,7 +143,7 @@ main (int argc, char **argv) * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_register(krb5_context context, const krb5_kt_ops *ops) { @@ -183,7 +183,7 @@ krb5_kt_register(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_resolve(krb5_context context, const char *name, krb5_keytab *id) @@ -244,7 +244,7 @@ krb5_kt_resolve(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_default_name(krb5_context context, char *name, size_t namesize) { if (strlcpy (name, context->default_keytab, namesize) >= namesize) { @@ -266,7 +266,7 @@ krb5_kt_default_name(krb5_context context, char *name, size_t namesize) * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_default_modify_name(krb5_context context, char *name, size_t namesize) { const char *kt = NULL; @@ -303,7 +303,7 @@ krb5_kt_default_modify_name(krb5_context context, char *name, size_t namesize) * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_default(krb5_context context, krb5_keytab *id) { return krb5_kt_resolve (context, context->default_keytab, id); @@ -325,7 +325,7 @@ krb5_kt_default(krb5_context context, krb5_keytab *id) * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_read_service_key(krb5_context context, krb5_pointer keyprocarg, krb5_principal principal, @@ -368,7 +368,7 @@ krb5_kt_read_service_key(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_get_type(krb5_context context, krb5_keytab keytab, char *prefix, @@ -391,7 +391,7 @@ krb5_kt_get_type(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_get_name(krb5_context context, krb5_keytab keytab, char *name, @@ -414,7 +414,7 @@ krb5_kt_get_name(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_get_full_name(krb5_context context, krb5_keytab keytab, char **str) @@ -454,7 +454,7 @@ krb5_kt_get_full_name(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_close(krb5_context context, krb5_keytab id) { @@ -478,7 +478,7 @@ krb5_kt_close(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_destroy(krb5_context context, krb5_keytab id) { @@ -523,7 +523,7 @@ compare_aliseses(krb5_context context, * @ingroup krb5_keytab */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_kt_compare(krb5_context context, krb5_keytab_entry *entry, krb5_const_principal principal, @@ -590,7 +590,7 @@ _krb5_kt_principal_not_found(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_get_entry(krb5_context context, krb5_keytab id, krb5_const_principal principal, @@ -651,7 +651,7 @@ krb5_kt_get_entry(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_copy_entry_contents(krb5_context context, const krb5_keytab_entry *in, krb5_keytab_entry *out) @@ -687,7 +687,7 @@ fail: * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_free_entry(krb5_context context, krb5_keytab_entry *entry) { @@ -709,7 +709,7 @@ krb5_kt_free_entry(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_start_seq_get(krb5_context context, krb5_keytab id, krb5_kt_cursor *cursor) @@ -738,7 +738,7 @@ krb5_kt_start_seq_get(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_next_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry, @@ -766,7 +766,7 @@ krb5_kt_next_entry(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_end_seq_get(krb5_context context, krb5_keytab id, krb5_kt_cursor *cursor) @@ -792,7 +792,7 @@ krb5_kt_end_seq_get(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_add_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry) @@ -820,7 +820,7 @@ krb5_kt_add_entry(krb5_context context, * @ingroup krb5_keytab */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_kt_remove_entry(krb5_context context, krb5_keytab id, krb5_keytab_entry *entry) diff --git a/lib/krb5/krb5-v4compat.h b/lib/krb5/krb5-v4compat.h index dde5fa9ca..324c8c1d3 100644 --- a/lib/krb5/krb5-v4compat.h +++ b/lib/krb5/krb5-v4compat.h @@ -105,8 +105,12 @@ struct credentials { #define CLOCK_SKEW 5*60 #ifndef TKT_ROOT +#ifdef KRB5_USE_PATH_TOKENS +#define TKT_ROOT "%{TEMP}/tkt" +#else #define TKT_ROOT "/tmp/tkt" #endif +#endif struct _krb5_krb_auth_data { int8_t k_flags; /* Flags from ticket */ @@ -120,11 +124,18 @@ struct _krb5_krb_auth_data { uint32_t address; /* Address in ticket */ }; -time_t _krb5_krb_life_to_time (int, int); -int _krb5_krb_time_to_life (time_t, time_t); -krb5_error_code _krb5_krb_tf_setup (krb5_context, struct credentials *, - const char *, int); -krb5_error_code _krb5_krb_dest_tkt(krb5_context, const char *); +KRB5_LIB_FUNCTION time_t KRB5_LIB_CALL +_krb5_krb_life_to_time (int, int); + +KRB5_LIB_FUNCTION int KRB5_LIB_CALL +_krb5_krb_time_to_life (time_t, time_t); + +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL +_krb5_krb_tf_setup (krb5_context, struct credentials *, + const char *, int); + +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL +_krb5_krb_dest_tkt(krb5_context, const char *); #define krb_time_to_life _krb5_krb_time_to_life #define krb_life_to_time _krb5_krb_life_to_time diff --git a/lib/krb5/krb5.h b/lib/krb5/krb5.h index 8fda34051..c810b8bc7 100644 --- a/lib/krb5/krb5.h +++ b/lib/krb5/krb5.h @@ -303,7 +303,15 @@ typedef AP_REQ krb5_ap_req; struct krb5_cc_ops; +#ifdef _WIN32 +#define KRB5_USE_PATH_TOKENS 1 +#endif + +#ifdef KRB5_USE_PATH_TOKENS +#define KRB5_DEFAULT_CCFILE_ROOT "%{TEMP}/krb5cc_" +#else #define KRB5_DEFAULT_CCFILE_ROOT "/tmp/krb5cc_" +#endif #define KRB5_DEFAULT_CCROOT "FILE:" KRB5_DEFAULT_CCFILE_ROOT diff --git a/lib/krb5/krb5_locl.h b/lib/krb5/krb5_locl.h index 147d795ab..6acaa2c66 100644 --- a/lib/krb5/krb5_locl.h +++ b/lib/krb5/krb5_locl.h @@ -47,6 +47,8 @@ #include #include +#include + #ifdef HAVE_SYS_TYPES_H #include #endif @@ -185,6 +187,7 @@ struct _krb5_krb_auth_data; #define KEYTAB_DEFAULT "FILE:" SYSCONFDIR "/krb5.keytab" #define KEYTAB_DEFAULT_MODIFY "FILE:" SYSCONFDIR "/krb5.keytab" + #define MODULI_FILE SYSCONFDIR "/krb5.moduli" #ifndef O_BINARY @@ -270,13 +273,18 @@ typedef struct krb5_context_data { #define KRB5_CTX_F_DNS_CANONICALIZE_HOSTNAME 1 #define KRB5_CTX_F_CHECK_PAC 2 #define KRB5_CTX_F_HOMEDIR_ACCESS 4 +#define KRB5_CTX_F_SOCKETS_INITIALIZED 8 struct send_to_kdc *send_to_kdc; #ifdef PKINIT hx509_context hx509ctx; #endif } krb5_context_data; +#ifndef KRB5_USE_PATH_TOKENS #define KRB5_DEFAULT_CCNAME_FILE "FILE:/tmp/krb5cc_%{uid}" +#else +#define KRB5_DEFAULT_CCNAME_FILE "FILE:%{TEMP}/krb5cc_%{uid}" +#endif #define KRB5_DEFAULT_CCNAME_API "API:" #define KRB5_DEFAULT_CCNAME_KCM_KCM "KCM:%{uid}" #define KRB5_DEFAULT_CCNAME_KCM_API "API:%{uid}" diff --git a/lib/krb5/krbhst.c b/lib/krb5/krbhst.c index 4e4b4562e..3bb00d287 100644 --- a/lib/krb5/krbhst.c +++ b/lib/krb5/krbhst.c @@ -320,7 +320,7 @@ append_host_string(krb5_context context, struct krb5_krbhst_data *kd, * return a readable representation of `host' in `hostname, hostlen' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_krbhst_format_string(krb5_context context, const krb5_krbhst_info *host, char *hostname, size_t hostlen) { @@ -361,7 +361,7 @@ make_hints(struct addrinfo *hints, int proto) * in `host'. free:ing is handled by krb5_krbhst_free. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_krbhst_get_addrinfo(krb5_context context, krb5_krbhst_info *host, struct addrinfo **ai) { @@ -857,7 +857,7 @@ common_init(krb5_context context, * initialize `handle' to look for hosts of type `type' in realm `realm' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_krbhst_init(krb5_context context, const char *realm, unsigned int type, @@ -866,7 +866,7 @@ krb5_krbhst_init(krb5_context context, return krb5_krbhst_init_flags(context, realm, type, 0, handle); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_krbhst_init_flags(krb5_context context, const char *realm, unsigned int type, @@ -919,7 +919,7 @@ krb5_krbhst_init_flags(krb5_context context, * return the next host information from `handle' in `host' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_krbhst_next(krb5_context context, krb5_krbhst_handle handle, krb5_krbhst_info **host) @@ -935,7 +935,7 @@ krb5_krbhst_next(krb5_context context, * in `hostname' (or length `hostlen) */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_krbhst_next_as_string(krb5_context context, krb5_krbhst_handle handle, char *hostname, @@ -950,13 +950,13 @@ krb5_krbhst_next_as_string(krb5_context context, } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_krbhst_reset(krb5_context context, krb5_krbhst_handle handle) { handle->index = &handle->hosts; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_krbhst_free(krb5_context context, krb5_krbhst_handle handle) { krb5_krbhst_info *h, *next; @@ -1021,7 +1021,7 @@ gethostlist(krb5_context context, const char *realm, * return an malloced list of kadmin-hosts for `realm' in `hostlist' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_krb_admin_hst (krb5_context context, const krb5_realm *realm, char ***hostlist) @@ -1033,7 +1033,7 @@ krb5_get_krb_admin_hst (krb5_context context, * return an malloced list of changepw-hosts for `realm' in `hostlist' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_krb_changepw_hst (krb5_context context, const krb5_realm *realm, char ***hostlist) @@ -1045,7 +1045,7 @@ krb5_get_krb_changepw_hst (krb5_context context, * return an malloced list of 524-hosts for `realm' in `hostlist' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_krb524hst (krb5_context context, const krb5_realm *realm, char ***hostlist) @@ -1058,7 +1058,7 @@ krb5_get_krb524hst (krb5_context context, * return an malloced list of KDC's for `realm' in `hostlist' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_krbhst (krb5_context context, const krb5_realm *realm, char ***hostlist) @@ -1070,7 +1070,7 @@ krb5_get_krbhst (krb5_context context, * free all the memory allocated in `hostlist' */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_krbhst (krb5_context context, char **hostlist) { diff --git a/lib/krb5/kuserok.c b/lib/krb5/kuserok.c index 6a951844a..774e9ee35 100644 --- a/lib/krb5/kuserok.c +++ b/lib/krb5/kuserok.c @@ -65,6 +65,7 @@ check_one_file(krb5_context context, fclose (f); return EISDIR; } +#ifndef _WIN32 if (st.st_uid != pwd->pw_uid && st.st_uid != 0) { fclose (f); return EACCES; @@ -73,6 +74,7 @@ check_one_file(krb5_context context, fclose (f); return EACCES; } +#endif while (fgets (buf, sizeof(buf), f) != NULL) { krb5_principal tmp; @@ -124,10 +126,12 @@ check_directory(krb5_context context, if (!S_ISDIR(st.st_mode)) return ENOTDIR; +#ifndef _WIN32 if (st.st_uid != pwd->pw_uid && st.st_uid != 0) return EACCES; if ((st.st_mode & (S_IWGRP | S_IWOTH)) != 0) return EACCES; +#endif if((d = opendir(dirname)) == NULL) return errno; @@ -228,14 +232,17 @@ match_local_principals(krb5_context context, * @ingroup krb5_support */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_kuserok (krb5_context context, krb5_principal principal, const char *luser) { +#ifndef _WIN32 char *buf; size_t buflen; - struct passwd *pwd; + struct passwd *pwd = NULL; + char *profile_dir = NULL; + krb5_boolean free_profile_dir = FALSE; krb5_error_code ret; krb5_boolean result = FALSE; @@ -252,14 +259,15 @@ krb5_kuserok (krb5_context context, #endif if (pwd == NULL) return FALSE; + profile_dir = pwd->pw_dir; #define KLOGIN "/.k5login" - buflen = strlen(pwd->pw_dir) + sizeof(KLOGIN) + 2; /* 2 for .d */ + buflen = strlen(profile_dir) + sizeof(KLOGIN) + 2; /* 2 for .d */ buf = malloc(buflen); if(buf == NULL) return FALSE; /* check user's ~/.k5login */ - strlcpy(buf, pwd->pw_dir, buflen); + strlcpy(buf, profile_dir, buflen); strlcat(buf, KLOGIN, buflen); ret = check_one_file(context, buf, pwd, principal, &result); @@ -286,4 +294,11 @@ krb5_kuserok (krb5_context context, return match_local_principals(context, principal, luser); return FALSE; +#else + /* On Windows, for now we always return TRUE. The .k5login file + may be on a remote profile and we don't have access to the + profile until we have a token handle for the user's + credentials. */ + return TRUE; +#endif } diff --git a/lib/krb5/log.c b/lib/krb5/log.c index ac1cb2b2b..55c70fc96 100644 --- a/lib/krb5/log.c +++ b/lib/krb5/log.c @@ -115,7 +115,7 @@ find_value(const char *s, struct s2i *table) return table->val; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_initlog(krb5_context context, const char *program, krb5_log_facility **fac) @@ -137,7 +137,7 @@ krb5_initlog(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_addlog_func(krb5_context context, krb5_log_facility *fac, int min, @@ -270,7 +270,7 @@ open_file(krb5_context context, krb5_log_facility *fac, int min, int max, -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_addlog_dest(krb5_context context, krb5_log_facility *f, const char *orig) { krb5_error_code ret = 0; @@ -361,7 +361,7 @@ krb5_addlog_dest(krb5_context context, krb5_log_facility *f, const char *orig) } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_openlog(krb5_context context, const char *program, krb5_log_facility **fac) @@ -385,7 +385,7 @@ krb5_openlog(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_closelog(krb5_context context, krb5_log_facility *fac) { @@ -404,7 +404,7 @@ krb5_closelog(krb5_context context, #undef __attribute__ #define __attribute__(X) -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_vlog_msg(krb5_context context, krb5_log_facility *fac, char **reply, @@ -443,7 +443,7 @@ krb5_vlog_msg(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_vlog(krb5_context context, krb5_log_facility *fac, int level, @@ -454,7 +454,7 @@ krb5_vlog(krb5_context context, return krb5_vlog_msg(context, fac, NULL, level, fmt, ap); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_log_msg(krb5_context context, krb5_log_facility *fac, int level, @@ -473,7 +473,7 @@ krb5_log_msg(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_log(krb5_context context, krb5_log_facility *fac, int level, diff --git a/lib/krb5/misc.c b/lib/krb5/misc.c index e47383880..b76c1b584 100644 --- a/lib/krb5/misc.c +++ b/lib/krb5/misc.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_s4u2self_to_checksumdata(krb5_context context, const PA_S4U2Self *self, krb5_data *data) diff --git a/lib/krb5/mit_glue.c b/lib/krb5/mit_glue.c index ea14b2100..504cbc50f 100644 --- a/lib/krb5/mit_glue.c +++ b/lib/krb5/mit_glue.c @@ -41,7 +41,7 @@ * Glue for MIT API */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_make_checksum(krb5_context context, krb5_cksumtype cksumtype, const krb5_keyblock *key, @@ -63,7 +63,7 @@ krb5_c_make_checksum(krb5_context context, return ret ; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_verify_checksum(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, const krb5_data *data, const krb5_checksum *cksum, krb5_boolean *valid) @@ -88,7 +88,7 @@ krb5_c_verify_checksum(krb5_context context, const krb5_keyblock *key, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_get_checksum(krb5_context context, const krb5_checksum *cksum, krb5_cksumtype *type, krb5_data **data) { @@ -111,7 +111,7 @@ krb5_c_get_checksum(krb5_context context, const krb5_checksum *cksum, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_set_checksum(krb5_context context, krb5_checksum *cksum, krb5_cksumtype type, const krb5_data *data) { @@ -119,51 +119,51 @@ krb5_c_set_checksum(krb5_context context, krb5_checksum *cksum, return der_copy_octet_string(data, &cksum->checksum); } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_checksum (krb5_context context, krb5_checksum *cksum) { krb5_checksum_free(context, cksum); free(cksum); } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_checksum_contents(krb5_context context, krb5_checksum *cksum) { krb5_checksum_free(context, cksum); memset(cksum, 0, sizeof(*cksum)); } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_checksum_free(krb5_context context, krb5_checksum *cksum) { free_Checksum(cksum); } -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_c_valid_enctype (krb5_enctype etype) { return krb5_enctype_valid(NULL, etype); } -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_c_valid_cksumtype(krb5_cksumtype ctype) { return krb5_cksumtype_valid(NULL, ctype); } -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_c_is_coll_proof_cksum(krb5_cksumtype ctype) { return krb5_checksum_is_collision_proof(NULL, ctype); } -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_c_is_keyed_cksum(krb5_cksumtype ctype) { return krb5_checksum_is_keyed(NULL, ctype); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_checksum (krb5_context context, const krb5_checksum *old, krb5_checksum **new) @@ -174,14 +174,14 @@ krb5_copy_checksum (krb5_context context, return copy_Checksum(old, *new); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_checksum_length (krb5_context context, krb5_cksumtype cksumtype, size_t *length) { return krb5_checksumsize(context, cksumtype, length); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_block_size(krb5_context context, krb5_enctype enctype, size_t *blocksize) @@ -204,7 +204,7 @@ krb5_c_block_size(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_decrypt(krb5_context context, const krb5_keyblock key, krb5_keyusage usage, @@ -244,7 +244,7 @@ krb5_c_decrypt(krb5_context context, return ret ; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_encrypt(krb5_context context, const krb5_keyblock *key, krb5_keyusage usage, @@ -286,7 +286,7 @@ krb5_c_encrypt(krb5_context context, return ret ; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_encrypt_length(krb5_context context, krb5_enctype enctype, size_t inputlen, @@ -317,7 +317,7 @@ krb5_c_encrypt_length(krb5_context context, * @ingroup krb5_deprecated */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_enctype_compare(krb5_context context, krb5_enctype e1, krb5_enctype e2, @@ -328,7 +328,7 @@ krb5_c_enctype_compare(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_make_random_key(krb5_context context, krb5_enctype enctype, krb5_keyblock *random_key) @@ -336,7 +336,7 @@ krb5_c_make_random_key(krb5_context context, return krb5_generate_random_keyblock(context, enctype, random_key); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_keylengths(krb5_context context, krb5_enctype enctype, size_t *ilen, @@ -351,7 +351,7 @@ krb5_c_keylengths(krb5_context context, return krb5_enctype_keysize(context, enctype, keylen); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_prf_length(krb5_context context, krb5_enctype type, size_t *length) @@ -359,7 +359,7 @@ krb5_c_prf_length(krb5_context context, return krb5_crypto_prf_length(context, type, length); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_prf(krb5_context context, const krb5_keyblock *key, const krb5_data *input, @@ -384,7 +384,7 @@ krb5_c_prf(krb5_context context, * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_copy_creds(krb5_context context, const krb5_ccache from, krb5_ccache to) diff --git a/lib/krb5/mk_error.c b/lib/krb5/mk_error.c index 0de30e4dd..a837b5e29 100644 --- a/lib/krb5/mk_error.c +++ b/lib/krb5/mk_error.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_mk_error(krb5_context context, krb5_error_code error_code, const char *e_text, diff --git a/lib/krb5/mk_priv.c b/lib/krb5/mk_priv.c index 40f09ae33..833821341 100644 --- a/lib/krb5/mk_priv.c +++ b/lib/krb5/mk_priv.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_mk_priv(krb5_context context, krb5_auth_context auth_context, const krb5_data *userdata, diff --git a/lib/krb5/mk_rep.c b/lib/krb5/mk_rep.c index 8eef0ea65..2b9c3fbdb 100644 --- a/lib/krb5/mk_rep.c +++ b/lib/krb5/mk_rep.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_mk_rep(krb5_context context, krb5_auth_context auth_context, krb5_data *outbuf) diff --git a/lib/krb5/mk_req.c b/lib/krb5/mk_req.c index c87fa6129..44e6c8b68 100644 --- a/lib/krb5/mk_req.c +++ b/lib/krb5/mk_req.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_mk_req_exact(krb5_context context, krb5_auth_context *auth_context, const krb5_flags ap_req_options, @@ -77,7 +77,7 @@ krb5_mk_req_exact(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_mk_req(krb5_context context, krb5_auth_context *auth_context, const krb5_flags ap_req_options, diff --git a/lib/krb5/mk_req_ext.c b/lib/krb5/mk_req_ext.c index 03fc93b02..af68e4e19 100644 --- a/lib/krb5/mk_req_ext.c +++ b/lib/krb5/mk_req_ext.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" krb5_error_code _krb5_mk_req_internal(krb5_context context, @@ -143,7 +143,7 @@ out: return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_mk_req_extended(krb5_context context, krb5_auth_context *auth_context, const krb5_flags ap_req_options, diff --git a/lib/krb5/mk_safe.c b/lib/krb5/mk_safe.c index 5b7580d8a..b2858acf8 100644 --- a/lib/krb5/mk_safe.c +++ b/lib/krb5/mk_safe.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_mk_safe(krb5_context context, krb5_auth_context auth_context, const krb5_data *userdata, diff --git a/lib/krb5/n-fold.c b/lib/krb5/n-fold.c index 0623f6aae..f94a1ea12 100644 --- a/lib/krb5/n-fold.c +++ b/lib/krb5/n-fold.c @@ -96,7 +96,7 @@ add1(unsigned char *a, unsigned char *b, size_t len) } } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_n_fold(const void *str, size_t len, void *key, size_t size) { /* if len < size we need at most N * len bytes, ie < 2 * size; diff --git a/lib/krb5/net_read.c b/lib/krb5/net_read.c index eeb97a483..59bfe71b2 100644 --- a/lib/krb5/net_read.c +++ b/lib/krb5/net_read.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_ssize_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL krb5_net_read (krb5_context context, void *p_fd, void *buf, diff --git a/lib/krb5/net_write.c b/lib/krb5/net_write.c index d39a9b17f..9c0d4a5a4 100644 --- a/lib/krb5/net_write.c +++ b/lib/krb5/net_write.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_ssize_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL krb5_net_write (krb5_context context, void *p_fd, const void *buf, @@ -44,7 +44,7 @@ krb5_net_write (krb5_context context, return net_write (fd, buf, len); } -krb5_ssize_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL krb5_net_write_block(krb5_context context, void *p_fd, const void *buf, diff --git a/lib/krb5/padata.c b/lib/krb5/padata.c index aa08248ed..283a857df 100644 --- a/lib/krb5/padata.c +++ b/lib/krb5/padata.c @@ -42,7 +42,7 @@ krb5_find_padata(PA_DATA *val, unsigned len, int type, int *idx) return NULL; } -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_padata_add(krb5_context context, METHOD_DATA *md, int type, void *buf, size_t len) { diff --git a/lib/krb5/parse-name-test.c b/lib/krb5/parse-name-test.c index a03d9764b..bb2fc024e 100644 --- a/lib/krb5/parse-name-test.c +++ b/lib/krb5/parse-name-test.c @@ -61,7 +61,7 @@ static struct testcase { {"a/b/c", "a/b/c@", "", 3, {"a", "b", "c"}, FALSE}, {NULL, NULL, "", 0, { NULL }, FALSE}}; -int KRB5_LIB_FUNCTION +int main(int argc, char **argv) { struct testcase *t; diff --git a/lib/krb5/pkinit.c b/lib/krb5/pkinit.c index 28ba8183d..67dfb9498 100644 --- a/lib/krb5/pkinit.c +++ b/lib/krb5/pkinit.c @@ -91,7 +91,7 @@ pk_copy_error(krb5_context context, * */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL _krb5_pk_cert_free(struct krb5_pk_cert *cert) { if (cert->cert) { @@ -617,7 +617,7 @@ build_auth_pack(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_pk_mk_ContentInfo(krb5_context context, const krb5_data *buf, const heim_oid *oid, @@ -807,7 +807,7 @@ pk_mk_padata(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_pk_mk_padata(krb5_context context, void *c, int ic_flags, @@ -1534,7 +1534,7 @@ pk_rd_pa_reply_dh(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_pk_rd_pa_reply(krb5_context context, const char *realm, void *c, @@ -1826,7 +1826,7 @@ _krb5_pk_set_user_id(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_pk_load_id(krb5_context context, struct krb5_pk_identity **ret_id, const char *user_id, @@ -2291,7 +2291,7 @@ _krb5_dh_group_ok(krb5_context context, unsigned long bits, } #endif /* PKINIT */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL _krb5_get_init_creds_opt_free_pkinit(krb5_get_init_creds_opt *opt) { #ifdef PKINIT @@ -2335,7 +2335,7 @@ _krb5_get_init_creds_opt_free_pkinit(krb5_get_init_creds_opt *opt) #endif } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_set_pkinit(krb5_context context, krb5_get_init_creds_opt *opt, krb5_principal principal, diff --git a/lib/krb5/principal.c b/lib/krb5/principal.c index d854113a4..00c967a72 100644 --- a/lib/krb5/principal.c +++ b/lib/krb5/principal.c @@ -76,7 +76,7 @@ host/admin@H5L.ORG * @ingroup krb5_principal */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_principal(krb5_context context, krb5_principal p) { @@ -98,7 +98,7 @@ krb5_free_principal(krb5_context context, * @ingroup krb5_principal */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_principal_set_type(krb5_context context, krb5_principal principal, int type) @@ -117,7 +117,7 @@ krb5_principal_set_type(krb5_context context, * @ingroup krb5_principal */ -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_principal_get_type(krb5_context context, krb5_const_principal principal) { @@ -135,14 +135,14 @@ krb5_principal_get_type(krb5_context context, * @ingroup krb5_principal */ -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_principal_get_realm(krb5_context context, krb5_const_principal principal) { return princ_realm(principal); } -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_principal_get_comp_string(krb5_context context, krb5_const_principal principal, unsigned int component) @@ -163,7 +163,7 @@ krb5_principal_get_comp_string(krb5_context context, * @ingroup krb5_principal */ -unsigned int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION unsigned int KRB5_LIB_CALL krb5_principal_get_num_comp(krb5_context context, krb5_const_principal principal) { @@ -183,7 +183,7 @@ krb5_principal_get_num_comp(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_name_flags(krb5_context context, const char *name, int flags, @@ -384,7 +384,7 @@ exit: * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_parse_name(krb5_context context, const char *name, krb5_principal *principal) @@ -485,7 +485,7 @@ unparse_name_fixed(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed(krb5_context context, krb5_const_principal principal, char *name, @@ -508,7 +508,7 @@ krb5_unparse_name_fixed(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed_short(krb5_context context, krb5_const_principal principal, char *name, @@ -532,7 +532,7 @@ krb5_unparse_name_fixed_short(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_fixed_flags(krb5_context context, krb5_const_principal principal, int flags, @@ -596,7 +596,7 @@ unparse_name(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name(krb5_context context, krb5_const_principal principal, char **name) @@ -617,7 +617,7 @@ krb5_unparse_name(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_flags(krb5_context context, krb5_const_principal principal, int flags, @@ -639,7 +639,7 @@ krb5_unparse_name_flags(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_unparse_name_short(krb5_context context, krb5_const_principal principal, char **name) @@ -660,7 +660,7 @@ krb5_unparse_name_short(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_principal_set_realm(krb5_context context, krb5_principal principal, krb5_const_realm realm) @@ -692,7 +692,7 @@ krb5_principal_set_realm(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_build_principal(krb5_context context, krb5_principal *principal, int rlen, @@ -828,8 +828,7 @@ build_principal(krb5_context context, return 0; } - -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_build_principal_va(krb5_context context, krb5_principal *principal, int rlen, @@ -839,7 +838,7 @@ krb5_build_principal_va(krb5_context context, return build_principal(context, principal, rlen, realm, va_princ, ap); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_build_principal_va_ext(krb5_context context, krb5_principal *principal, int rlen, @@ -850,7 +849,7 @@ krb5_build_principal_va_ext(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_build_principal_ext(krb5_context context, krb5_principal *principal, int rlen, @@ -878,7 +877,7 @@ krb5_build_principal_ext(krb5_context context, */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_principal(krb5_context context, krb5_const_principal inprinc, krb5_principal *outprinc) @@ -913,7 +912,7 @@ krb5_copy_principal(krb5_context context, * @see krb5_realm_compare() */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_compare_any_realm(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2) @@ -928,7 +927,7 @@ krb5_principal_compare_any_realm(krb5_context context, return TRUE; } -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL _krb5_principal_compare_PrincipalName(krb5_context context, krb5_const_principal princ1, PrincipalName *princ2) @@ -961,7 +960,7 @@ _krb5_principal_compare_PrincipalName(krb5_context context, * return TRUE iff princ1 == princ2 */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_compare(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2) @@ -983,7 +982,7 @@ krb5_principal_compare(krb5_context context, * @see krb5_principal_compare() */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_realm_compare(krb5_context context, krb5_const_principal princ1, krb5_const_principal princ2) @@ -997,7 +996,7 @@ krb5_realm_compare(krb5_context context, * @ingroup krb5_principal */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_principal_match(krb5_context context, krb5_const_principal princ, krb5_const_principal pattern) @@ -1083,7 +1082,7 @@ get_name_conversion(krb5_context context, const char *realm, const char *name) * if `func', use that function for validating the conversion */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_425_conv_principal_ext2(krb5_context context, const char *name, const char *instance, @@ -1375,7 +1374,7 @@ name_convert(krb5_context context, const char *name, const char *realm, * three parameters. They have to be 40 bytes each (ANAME_SZ). */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_524_conv_principal(krb5_context context, const krb5_principal principal, char *name, @@ -1461,7 +1460,7 @@ krb5_524_conv_principal(krb5_context context, * @ingroup krb5_principal */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sname_to_principal (krb5_context context, const char *hostname, const char *sname, diff --git a/lib/krb5/prog_setup.c b/lib/krb5/prog_setup.c index 4c060973d..33e8b5301 100644 --- a/lib/krb5/prog_setup.c +++ b/lib/krb5/prog_setup.c @@ -35,14 +35,14 @@ #include #include -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void krb5_std_usage(int code, struct getargs *args, int num_args) { arg_printusage(args, num_args, NULL, ""); exit(code); } -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_program_setup(krb5_context *context, int argc, char **argv, struct getargs *args, int num_args, void (*usage)(int, struct getargs*, int)) diff --git a/lib/krb5/prompter_posix.c b/lib/krb5/prompter_posix.c index 05deaff52..875fd99c4 100644 --- a/lib/krb5/prompter_posix.c +++ b/lib/krb5/prompter_posix.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int krb5_prompter_posix (krb5_context context, void *data, const char *name, diff --git a/lib/krb5/rd_cred.c b/lib/krb5/rd_cred.c index f41edfa2b..094f748b9 100644 --- a/lib/krb5/rd_cred.c +++ b/lib/krb5/rd_cred.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" static krb5_error_code compare_addrs(krb5_context context, @@ -52,7 +52,7 @@ compare_addrs(krb5_context context, return KRB5KRB_AP_ERR_BADADDR; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_cred(krb5_context context, krb5_auth_context auth_context, krb5_data *in_data, @@ -322,7 +322,7 @@ krb5_rd_cred(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_cred2 (krb5_context context, krb5_auth_context auth_context, krb5_ccache ccache, diff --git a/lib/krb5/rd_error.c b/lib/krb5/rd_error.c index 1561188fa..d778c68cd 100644 --- a/lib/krb5/rd_error.c +++ b/lib/krb5/rd_error.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_error(krb5_context context, const krb5_data *msg, KRB_ERROR *result) @@ -51,7 +51,7 @@ krb5_rd_error(krb5_context context, return 0; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_error_contents (krb5_context context, krb5_error *error) { @@ -59,7 +59,7 @@ krb5_free_error_contents (krb5_context context, memset(error, 0, sizeof(*error)); } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_error (krb5_context context, krb5_error *error) { @@ -67,7 +67,7 @@ krb5_free_error (krb5_context context, free (error); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_error_from_rd_error(krb5_context context, const krb5_error *error, const krb5_creds *creds) diff --git a/lib/krb5/rd_priv.c b/lib/krb5/rd_priv.c index fb6cfcee4..8a46195b6 100644 --- a/lib/krb5/rd_priv.c +++ b/lib/krb5/rd_priv.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_priv(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, diff --git a/lib/krb5/rd_rep.c b/lib/krb5/rd_rep.c index 2d5792cd4..f8963a53b 100644 --- a/lib/krb5/rd_rep.c +++ b/lib/krb5/rd_rep.c @@ -31,9 +31,9 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_rep(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, @@ -108,7 +108,7 @@ krb5_rd_rep(krb5_context context, return ret; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_ap_rep_enc_part (krb5_context context, krb5_ap_rep_enc_part *val) { diff --git a/lib/krb5/rd_req.c b/lib/krb5/rd_req.c index 784427fe4..9f6a85b1a 100644 --- a/lib/krb5/rd_req.c +++ b/lib/krb5/rd_req.c @@ -1,3 +1,4 @@ + /* * Copyright (c) 1997 - 2007 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). @@ -31,7 +32,7 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" static krb5_error_code decrypt_tkt_enc_part (krb5_context context, @@ -102,7 +103,7 @@ decrypt_authenticator (krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_ap_req(krb5_context context, const krb5_data *inbuf, krb5_ap_req *ap_req) @@ -217,7 +218,7 @@ find_etypelist(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decrypt_ticket(krb5_context context, Ticket *ticket, krb5_keyblock *key, @@ -266,7 +267,7 @@ krb5_decrypt_ticket(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verify_authenticator_checksum(krb5_context context, krb5_auth_context ac, void *data, @@ -308,7 +309,7 @@ out: } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verify_ap_req(krb5_context context, krb5_auth_context *auth_context, krb5_ap_req *ap_req, @@ -329,7 +330,7 @@ krb5_verify_ap_req(krb5_context context, KRB5_KU_AP_REQ_AUTH); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verify_ap_req2(krb5_context context, krb5_auth_context *auth_context, krb5_ap_req *ap_req, @@ -538,7 +539,7 @@ struct krb5_rd_req_out_ctx_data { * @ingroup krb5_auth */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_in_ctx_alloc(krb5_context context, krb5_rd_req_in_ctx *ctx) { *ctx = calloc(1, sizeof(**ctx)); @@ -565,7 +566,7 @@ krb5_rd_req_in_ctx_alloc(krb5_context context, krb5_rd_req_in_ctx *ctx) * @ingroup krb5_auth */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_in_set_keytab(krb5_context context, krb5_rd_req_in_ctx in, krb5_keytab keytab) @@ -586,7 +587,7 @@ krb5_rd_req_in_set_keytab(krb5_context context, * @ingroup krb5_auth */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_in_set_pac_check(krb5_context context, krb5_rd_req_in_ctx in, krb5_boolean flag) @@ -596,7 +597,7 @@ krb5_rd_req_in_set_pac_check(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_in_set_keyblock(krb5_context context, krb5_rd_req_in_ctx in, krb5_keyblock *keyblock) @@ -605,7 +606,7 @@ krb5_rd_req_in_set_keyblock(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_out_get_ap_req_options(krb5_context context, krb5_rd_req_out_ctx out, krb5_flags *ap_req_options) @@ -614,7 +615,7 @@ krb5_rd_req_out_get_ap_req_options(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_out_get_ticket(krb5_context context, krb5_rd_req_out_ctx out, krb5_ticket **ticket) @@ -622,7 +623,7 @@ krb5_rd_req_out_get_ticket(krb5_context context, return krb5_copy_ticket(context, out->ticket, ticket); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_out_get_keyblock(krb5_context context, krb5_rd_req_out_ctx out, krb5_keyblock **keyblock) @@ -642,7 +643,7 @@ krb5_rd_req_out_get_keyblock(krb5_context context, * @ingroup krb5_auth */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_out_get_server(krb5_context context, krb5_rd_req_out_ctx out, krb5_principal *principal) @@ -650,7 +651,7 @@ krb5_rd_req_out_get_server(krb5_context context, return krb5_copy_principal(context, out->server, principal); } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_rd_req_in_ctx_free(krb5_context context, krb5_rd_req_in_ctx ctx) { free(ctx); @@ -665,7 +666,7 @@ krb5_rd_req_in_ctx_free(krb5_context context, krb5_rd_req_in_ctx ctx) * @ingroup krb5_auth */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_rd_req_out_ctx_free(krb5_context context, krb5_rd_req_out_ctx ctx) { if (ctx->ticket) @@ -681,7 +682,7 @@ krb5_rd_req_out_ctx_free(krb5_context context, krb5_rd_req_out_ctx ctx) * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req(krb5_context context, krb5_auth_context *auth_context, const krb5_data *inbuf, @@ -726,7 +727,7 @@ out: * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_with_keyblock(krb5_context context, krb5_auth_context *auth_context, const krb5_data *inbuf, @@ -834,7 +835,7 @@ out: * @ingroup krb5_auth */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_req_ctx(krb5_context context, krb5_auth_context *auth_context, const krb5_data *inbuf, diff --git a/lib/krb5/rd_safe.c b/lib/krb5/rd_safe.c index 16466e0c3..d37960ab4 100644 --- a/lib/krb5/rd_safe.c +++ b/lib/krb5/rd_safe.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. */ -#include +#include "krb5_locl.h" static krb5_error_code verify_checksum(krb5_context context, @@ -80,7 +80,7 @@ out: return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rd_safe(krb5_context context, krb5_auth_context auth_context, const krb5_data *inbuf, diff --git a/lib/krb5/read_message.c b/lib/krb5/read_message.c index be850b81c..4e9bd012d 100644 --- a/lib/krb5/read_message.c +++ b/lib/krb5/read_message.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_read_message (krb5_context context, krb5_pointer p_fd, krb5_data *data) @@ -69,7 +69,7 @@ krb5_read_message (krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_read_priv_message(krb5_context context, krb5_auth_context ac, krb5_pointer p_fd, @@ -86,7 +86,7 @@ krb5_read_priv_message(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_read_safe_message(krb5_context context, krb5_auth_context ac, krb5_pointer p_fd, diff --git a/lib/krb5/recvauth.c b/lib/krb5/recvauth.c index a5e48bf35..78e98a10f 100644 --- a/lib/krb5/recvauth.c +++ b/lib/krb5/recvauth.c @@ -43,7 +43,7 @@ match_exact(const void *data, const char *appl_version) return strcmp(data, appl_version) == 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_recvauth(krb5_context context, krb5_auth_context *auth_context, krb5_pointer p_fd, @@ -59,7 +59,7 @@ krb5_recvauth(krb5_context context, keytab, ticket); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_recvauth_match_version(krb5_context context, krb5_auth_context *auth_context, krb5_pointer p_fd, diff --git a/lib/krb5/replay.c b/lib/krb5/replay.c index 0cad91e43..f36e10174 100644 --- a/lib/krb5/replay.c +++ b/lib/krb5/replay.c @@ -38,7 +38,7 @@ struct krb5_rcache_data { char *name; }; -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_resolve(krb5_context context, krb5_rcache id, const char *name) @@ -52,7 +52,7 @@ krb5_rc_resolve(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_resolve_type(krb5_context context, krb5_rcache *id, const char *type) @@ -73,7 +73,7 @@ krb5_rc_resolve_type(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_resolve_full(krb5_context context, krb5_rcache *id, const char *string_name) @@ -99,19 +99,19 @@ krb5_rc_resolve_full(krb5_context context, return ret; } -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_rc_default_name(krb5_context context) { return "FILE:/var/run/default_rcache"; } -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_rc_default_type(krb5_context context) { return "FILE"; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_default(krb5_context context, krb5_rcache *id) { @@ -123,7 +123,7 @@ struct rc_entry{ unsigned char data[16]; }; -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_initialize(krb5_context context, krb5_rcache id, krb5_deltat auth_lifespan) @@ -145,14 +145,14 @@ krb5_rc_initialize(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_recover(krb5_context context, krb5_rcache id) { return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_destroy(krb5_context context, krb5_rcache id) { @@ -168,7 +168,7 @@ krb5_rc_destroy(krb5_context context, return krb5_rc_close(context, id); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_close(krb5_context context, krb5_rcache id) { @@ -196,7 +196,7 @@ checksum_authenticator(Authenticator *auth, void *data) EVP_MD_CTX_destroy(m); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_store(krb5_context context, krb5_rcache id, krb5_donot_replay *rep) @@ -251,14 +251,14 @@ krb5_rc_store(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_expunge(krb5_context context, krb5_rcache id) { return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_rc_get_lifespan(krb5_context context, krb5_rcache id, krb5_deltat *auth_lifespan) @@ -276,21 +276,21 @@ krb5_rc_get_lifespan(krb5_context context, return KRB5_RC_IO_UNKNOWN; } -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_rc_get_name(krb5_context context, krb5_rcache id) { return id->name; } -const char* KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL krb5_rc_get_type(krb5_context context, krb5_rcache id) { return "FILE"; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_server_rcache(krb5_context context, const krb5_data *piece, krb5_rcache *id) diff --git a/lib/krb5/scache.c b/lib/krb5/scache.c index a8eac41bf..7f4d51413 100644 --- a/lib/krb5/scache.c +++ b/lib/krb5/scache.c @@ -61,7 +61,11 @@ typedef struct krb5_scache { #define SCACHE(X) ((krb5_scache *)(X)->data.data) #define SCACHE_DEF_NAME "Default-cache" +#ifdef KRB5_USE_PATH_TOKENS +#define KRB5_SCACHE_DB "%{TEMP}/krb5scc_%{uid}" +#else #define KRB5_SCACHE_DB "/tmp/krb5scc_%{uid}" +#endif #define KRB5_SCACHE_NAME "SCC:" SCACHE_DEF_NAME ":" KRB5_SCACHE_DB #define SCACHE_INVALID_CID ((sqlite_uint64)-1) diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index 0efe14eb4..e8bcbcb43 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -47,7 +47,7 @@ struct send_to_kdc { */ static int -recv_loop (int fd, +recv_loop (SOCKET fd, time_t tmout, int udp, size_t limit, @@ -78,7 +78,7 @@ recv_loop (int fd, } else { void *tmp; - if (ioctl (fd, FIONREAD, &nbytes) < 0) { + if (SOCK_IOCTL (fd, FIONREAD, &nbytes) < 0) { krb5_data_free (rep); return -1; } @@ -111,7 +111,7 @@ recv_loop (int fd, */ static int -send_and_recv_udp(int fd, +send_and_recv_udp(SOCKET fd, time_t tmout, const krb5_data *req, krb5_data *rep) @@ -130,7 +130,7 @@ send_and_recv_udp(int fd, */ static int -send_and_recv_tcp(int fd, +send_and_recv_tcp(SOCKET fd, time_t tmout, const krb5_data *req, krb5_data *rep) @@ -140,9 +140,9 @@ send_and_recv_tcp(int fd, krb5_data len_data; _krb5_put_int(len, req->length, 4); - if(net_write(fd, len, sizeof(len)) < 0) + if(net_write_s(fd, len, sizeof(len)) < 0) return -1; - if(net_write(fd, req->data, req->length) < 0) + if(net_write_s(fd, req->data, req->length) < 0) return -1; if (recv_loop (fd, tmout, 0, 4, &len_data) < 0) return -1; @@ -162,7 +162,7 @@ send_and_recv_tcp(int fd, } int -_krb5_send_and_recv_tcp(int fd, +_krb5_send_and_recv_tcp(SOCKET fd, time_t tmout, const krb5_data *req, krb5_data *rep) @@ -175,7 +175,7 @@ _krb5_send_and_recv_tcp(int fd, */ static int -send_and_recv_http(int fd, +send_and_recv_http(SOCKET fd, time_t tmout, const char *prefix, const krb5_data *req, @@ -192,7 +192,7 @@ send_and_recv_http(int fd, free(str); if (request == NULL) return -1; - ret = net_write (fd, request, strlen(request)); + ret = net_write_s (fd, request, strlen(request)); free (request); if (ret < 0) return ret; @@ -264,7 +264,7 @@ send_via_proxy (krb5_context context, struct addrinfo hints; struct addrinfo *ai, *a; int ret; - int s = -1; + SOCKET s = INVALID_SOCKET; char portstr[NI_MAXSERV]; if (proxy == NULL) @@ -291,7 +291,7 @@ send_via_proxy (krb5_context context, continue; rk_cloexec(s); if (connect (s, a->ai_addr, a->ai_addrlen) < 0) { - close (s); + closesocket (s); continue; } break; @@ -309,7 +309,7 @@ send_via_proxy (krb5_context context, } ret = send_and_recv_http(s, context->kdc_timeout, prefix, send_data, receive); - close (s); + closesocket (s); free(prefix); if(ret == 0 && receive->length != 0) return 0; @@ -361,14 +361,14 @@ send_via_plugin(krb5_context context, * in `receive'. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sendto (krb5_context context, const krb5_data *send_data, krb5_krbhst_handle handle, krb5_data *receive) { krb5_error_code ret; - int fd; + SOCKET fd; int i; krb5_data_zero(receive); @@ -418,7 +418,7 @@ krb5_sendto (krb5_context context, continue; rk_cloexec(fd); if (connect (fd, a->ai_addr, a->ai_addrlen) < 0) { - close (fd); + closesocket (fd); continue; } switch (hi->proto) { @@ -435,7 +435,7 @@ krb5_sendto (krb5_context context, send_data, receive); break; } - close (fd); + closesocket (fd); if(ret == 0 && receive->length != 0) goto out; } @@ -451,7 +451,7 @@ out: return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sendto_kdc(krb5_context context, const krb5_data *send_data, const krb5_realm *realm, @@ -460,7 +460,7 @@ krb5_sendto_kdc(krb5_context context, return krb5_sendto_kdc_flags(context, send_data, realm, receive, 0); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sendto_kdc_flags(krb5_context context, const krb5_data *send_data, const krb5_realm *realm, @@ -481,7 +481,7 @@ krb5_sendto_kdc_flags(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_send_to_kdc_func(krb5_context context, krb5_send_to_kdc_func func, void *data) @@ -504,7 +504,7 @@ krb5_set_send_to_kdc_func(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_copy_send_to_kdc_func(krb5_context context, krb5_context to) { if (context->send_to_kdc) @@ -524,7 +524,7 @@ struct krb5_sendto_ctx_data { void *data; }; -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sendto_ctx_alloc(krb5_context context, krb5_sendto_ctx *ctx) { *ctx = calloc(1, sizeof(**ctx)); @@ -536,26 +536,26 @@ krb5_sendto_ctx_alloc(krb5_context context, krb5_sendto_ctx *ctx) return 0; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_sendto_ctx_add_flags(krb5_sendto_ctx ctx, int flags) { ctx->flags |= flags; } -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_sendto_ctx_get_flags(krb5_sendto_ctx ctx) { return ctx->flags; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_sendto_ctx_set_type(krb5_sendto_ctx ctx, int type) { ctx->type = type; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_sendto_ctx_set_func(krb5_sendto_ctx ctx, krb5_sendto_ctx_func func, void *data) @@ -564,14 +564,14 @@ krb5_sendto_ctx_set_func(krb5_sendto_ctx ctx, ctx->data = data; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_sendto_ctx_free(krb5_context context, krb5_sendto_ctx ctx) { memset(ctx, 0, sizeof(*ctx)); free(ctx); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sendto_context(krb5_context context, krb5_sendto_ctx ctx, const krb5_data *send_data, diff --git a/lib/krb5/sendauth.c b/lib/krb5/sendauth.c index dca759437..0965008ec 100644 --- a/lib/krb5/sendauth.c +++ b/lib/krb5/sendauth.c @@ -60,7 +60,7 @@ * } */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sendauth(krb5_context context, krb5_auth_context *auth_context, krb5_pointer p_fd, diff --git a/lib/krb5/set_default_realm.c b/lib/krb5/set_default_realm.c index 91201eeb5..ddce677c1 100644 --- a/lib/krb5/set_default_realm.c +++ b/lib/krb5/set_default_realm.c @@ -65,7 +65,7 @@ string_to_list (krb5_context context, const char *s, krb5_realm **list) * Otherwise, the realm(s) are figured out from configuration or DNS. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_default_realm(krb5_context context, const char *realm) { diff --git a/lib/krb5/sock_principal.c b/lib/krb5/sock_principal.c index d65035684..a43546de3 100644 --- a/lib/krb5/sock_principal.c +++ b/lib/krb5/sock_principal.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_sock_to_principal (krb5_context context, int sock, const char *sname, diff --git a/lib/krb5/store.c b/lib/krb5/store.c index 6e1374adf..49e68ef17 100644 --- a/lib/krb5/store.c +++ b/lib/krb5/store.c @@ -49,7 +49,7 @@ * @ingroup krb5_storage */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_storage_set_flags(krb5_storage *sp, krb5_flags flags) { sp->flags |= flags; @@ -64,7 +64,7 @@ krb5_storage_set_flags(krb5_storage *sp, krb5_flags flags) * @ingroup krb5_storage */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_storage_clear_flags(krb5_storage *sp, krb5_flags flags) { sp->flags &= ~flags; @@ -82,7 +82,7 @@ krb5_storage_clear_flags(krb5_storage *sp, krb5_flags flags) * @ingroup krb5_storage */ -krb5_boolean KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_storage_is_flags(krb5_storage *sp, krb5_flags flags) { return (sp->flags & flags) == flags; @@ -100,7 +100,7 @@ krb5_storage_is_flags(krb5_storage *sp, krb5_flags flags) * @ingroup krb5_storage */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_storage_set_byteorder(krb5_storage *sp, krb5_flags byteorder) { sp->flags &= ~KRB5_STORAGE_BYTEORDER_MASK; @@ -113,7 +113,7 @@ krb5_storage_set_byteorder(krb5_storage *sp, krb5_flags byteorder) * @ingroup krb5_storage */ -krb5_flags KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_flags KRB5_LIB_CALL krb5_storage_get_byteorder(krb5_storage *sp) { return sp->flags & KRB5_STORAGE_BYTEORDER_MASK; @@ -132,7 +132,7 @@ krb5_storage_get_byteorder(krb5_storage *sp) * @ingroup krb5_storage */ -off_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION off_t KRB5_LIB_CALL krb5_storage_seek(krb5_storage *sp, off_t offset, int whence) { return (*sp->seek)(sp, offset, whence); @@ -149,7 +149,7 @@ krb5_storage_seek(krb5_storage *sp, off_t offset, int whence) * @ingroup krb5_storage */ -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_storage_truncate(krb5_storage *sp, off_t offset) { return (*sp->trunc)(sp, offset); @@ -167,7 +167,7 @@ krb5_storage_truncate(krb5_storage *sp, off_t offset) * @ingroup krb5_storage */ -krb5_ssize_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL krb5_storage_read(krb5_storage *sp, void *buf, size_t len) { return sp->fetch(sp, buf, len); @@ -185,7 +185,7 @@ krb5_storage_read(krb5_storage *sp, void *buf, size_t len) * @ingroup krb5_storage */ -krb5_ssize_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL krb5_storage_write(krb5_storage *sp, const void *buf, size_t len) { return sp->store(sp, buf, len); @@ -200,7 +200,7 @@ krb5_storage_write(krb5_storage *sp, const void *buf, size_t len) * @ingroup krb5_storage */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_storage_set_eof_code(krb5_storage *sp, int code) { sp->eof_code = code; @@ -216,13 +216,13 @@ krb5_storage_set_eof_code(krb5_storage *sp, int code) * @ingroup krb5_storage */ -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_storage_get_eof_code(krb5_storage *sp) { return sp->eof_code; } -krb5_ssize_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL _krb5_put_int(void *buffer, unsigned long value, size_t size) { unsigned char *p = buffer; @@ -234,7 +234,7 @@ _krb5_put_int(void *buffer, unsigned long value, size_t size) return size; } -krb5_ssize_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL _krb5_get_int(void *buffer, unsigned long *value, size_t size) { unsigned char *p = buffer; @@ -256,7 +256,7 @@ _krb5_get_int(void *buffer, unsigned long *value, size_t size) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_storage_free(krb5_storage *sp) { if(sp->free) @@ -277,7 +277,7 @@ krb5_storage_free(krb5_storage *sp) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_storage_to_data(krb5_storage *sp, krb5_data *data) { off_t pos, size; @@ -331,7 +331,7 @@ krb5_store_int(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_int32(krb5_storage *sp, int32_t value) { @@ -354,7 +354,7 @@ krb5_store_int32(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_uint32(krb5_storage *sp, uint32_t value) { @@ -389,7 +389,7 @@ krb5_ret_int(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_int32(krb5_storage *sp, int32_t *value) { @@ -415,7 +415,7 @@ krb5_ret_int32(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_uint32(krb5_storage *sp, uint32_t *value) { @@ -441,7 +441,7 @@ krb5_ret_uint32(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_int16(krb5_storage *sp, int16_t value) { @@ -464,7 +464,7 @@ krb5_store_int16(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_uint16(krb5_storage *sp, uint16_t value) { @@ -482,7 +482,8 @@ krb5_store_uint16(krb5_storage *sp, * * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION + +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_int16(krb5_storage *sp, int16_t *value) { @@ -511,7 +512,7 @@ krb5_ret_int16(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_uint16(krb5_storage *sp, uint16_t *value) { @@ -536,7 +537,7 @@ krb5_ret_uint16(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_int8(krb5_storage *sp, int8_t value) { @@ -559,7 +560,7 @@ krb5_store_int8(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_uint8(krb5_storage *sp, uint8_t value) { @@ -577,7 +578,7 @@ krb5_store_uint8(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_int8(krb5_storage *sp, int8_t *value) { @@ -600,7 +601,7 @@ krb5_ret_int8(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_uint8(krb5_storage *sp, uint8_t *value) { @@ -626,7 +627,7 @@ krb5_ret_uint8(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_data(krb5_storage *sp, krb5_data data) { @@ -654,7 +655,7 @@ krb5_store_data(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_data(krb5_storage *sp, krb5_data *data) { @@ -687,7 +688,7 @@ krb5_ret_data(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_string(krb5_storage *sp, const char *s) { krb5_data data; @@ -708,7 +709,7 @@ krb5_store_string(krb5_storage *sp, const char *s) */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_string(krb5_storage *sp, char **string) { @@ -738,7 +739,7 @@ krb5_ret_string(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_stringz(krb5_storage *sp, const char *s) { size_t len = strlen(s) + 1; @@ -765,7 +766,7 @@ krb5_store_stringz(krb5_storage *sp, const char *s) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_stringz(krb5_storage *sp, char **string) { @@ -798,7 +799,7 @@ krb5_ret_stringz(krb5_storage *sp, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_stringnl(krb5_storage *sp, const char *s) { size_t len = strlen(s); @@ -823,7 +824,7 @@ krb5_store_stringnl(krb5_storage *sp, const char *s) } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_stringnl(krb5_storage *sp, char **string) { @@ -879,7 +880,7 @@ krb5_ret_stringnl(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_principal(krb5_storage *sp, krb5_const_principal p) { @@ -916,7 +917,7 @@ krb5_store_principal(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_principal(krb5_storage *sp, krb5_principal *princ) { @@ -984,7 +985,7 @@ krb5_ret_principal(krb5_storage *sp, * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_keyblock(krb5_storage *sp, krb5_keyblock p) { int ret; @@ -1013,7 +1014,7 @@ krb5_store_keyblock(krb5_storage *sp, krb5_keyblock p) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_keyblock(krb5_storage *sp, krb5_keyblock *p) { int ret; @@ -1043,7 +1044,7 @@ krb5_ret_keyblock(krb5_storage *sp, krb5_keyblock *p) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_times(krb5_storage *sp, krb5_times times) { int ret; @@ -1068,7 +1069,7 @@ krb5_store_times(krb5_storage *sp, krb5_times times) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_times(krb5_storage *sp, krb5_times *times) { int ret; @@ -1098,7 +1099,7 @@ krb5_ret_times(krb5_storage *sp, krb5_times *times) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_address(krb5_storage *sp, krb5_address p) { int ret; @@ -1119,7 +1120,7 @@ krb5_store_address(krb5_storage *sp, krb5_address p) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_address(krb5_storage *sp, krb5_address *adr) { int16_t t; @@ -1142,7 +1143,7 @@ krb5_ret_address(krb5_storage *sp, krb5_address *adr) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_addrs(krb5_storage *sp, krb5_addresses p) { int i; @@ -1167,7 +1168,7 @@ krb5_store_addrs(krb5_storage *sp, krb5_addresses p) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_addrs(krb5_storage *sp, krb5_addresses *adr) { int i; @@ -1198,7 +1199,7 @@ krb5_ret_addrs(krb5_storage *sp, krb5_addresses *adr) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_authdata(krb5_storage *sp, krb5_authdata auth) { krb5_error_code ret; @@ -1225,7 +1226,7 @@ krb5_store_authdata(krb5_storage *sp, krb5_authdata auth) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_authdata(krb5_storage *sp, krb5_authdata *auth) { krb5_error_code ret; @@ -1270,7 +1271,7 @@ bitswap32(int32_t b) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_creds(krb5_storage *sp, krb5_creds *creds) { int ret; @@ -1322,7 +1323,7 @@ krb5_store_creds(krb5_storage *sp, krb5_creds *creds) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_creds(krb5_storage *sp, krb5_creds *creds) { krb5_error_code ret; @@ -1394,7 +1395,7 @@ cleanup: * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_store_creds_tag(krb5_storage *sp, krb5_creds *creds) { int ret; @@ -1486,7 +1487,7 @@ krb5_store_creds_tag(krb5_storage *sp, krb5_creds *creds) * @ingroup krb5_storage */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ret_creds_tag(krb5_storage *sp, krb5_creds *creds) { diff --git a/lib/krb5/store_emem.c b/lib/krb5/store_emem.c index acf984280..ccda751af 100644 --- a/lib/krb5/store_emem.c +++ b/lib/krb5/store_emem.c @@ -158,7 +158,7 @@ emem_free(krb5_storage *sp) * @sa krb5_storage_from_data() */ -krb5_storage * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_storage * KRB5_LIB_CALL krb5_storage_emem(void) { krb5_storage *sp; diff --git a/lib/krb5/store_fd.c b/lib/krb5/store_fd.c index 415017592..2a3fdaf60 100644 --- a/lib/krb5/store_fd.c +++ b/lib/krb5/store_fd.c @@ -85,7 +85,7 @@ fd_free(krb5_storage * sp) * @sa krb5_storage_from_data() */ -krb5_storage * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_storage * KRB5_LIB_CALL krb5_storage_from_fd(int fd) { krb5_storage *sp; diff --git a/lib/krb5/store_mem.c b/lib/krb5/store_mem.c index a913e182d..b79bc1915 100644 --- a/lib/krb5/store_mem.c +++ b/lib/krb5/store_mem.c @@ -122,7 +122,7 @@ mem_no_trunc(krb5_storage *sp, off_t offset) * @sa krb5_storage_from_fd() */ -krb5_storage * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_storage * KRB5_LIB_CALL krb5_storage_from_mem(void *buf, size_t len) { krb5_storage *sp = malloc(sizeof(krb5_storage)); @@ -161,7 +161,7 @@ krb5_storage_from_mem(void *buf, size_t len) * @sa krb5_storage_from_fd() */ -krb5_storage * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_storage * KRB5_LIB_CALL krb5_storage_from_data(krb5_data *data) { return krb5_storage_from_mem(data->data, data->length); @@ -180,7 +180,7 @@ krb5_storage_from_data(krb5_data *data) * @sa krb5_storage_from_fd() */ -krb5_storage * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_storage * KRB5_LIB_CALL krb5_storage_from_readonly_mem(const void *buf, size_t len) { krb5_storage *sp = malloc(sizeof(krb5_storage)); diff --git a/lib/krb5/test_addr.c b/lib/krb5/test_addr.c index 622fa78f7..6e972c949 100644 --- a/lib/krb5/test_addr.c +++ b/lib/krb5/test_addr.c @@ -155,12 +155,41 @@ match_addr(krb5_context context, const char *range_addr, krb5_free_addresses(context, &one); } +#ifdef _MSC_VER + +/* For the truncation tests, calling strcpy_s() or strcat_s() with a + size of 0 results in the invalid parameter handler being invoked. + For the debug version, the runtime also throws an assert. */ + +static void +inv_param_handler(const wchar_t* expression, + const wchar_t* function, + const wchar_t* file, + unsigned int line, + uintptr_t pReserved) +{ + printf("Invalid parameter handler invoked for: %S in %S(%d) [%S]\n", + function, file, line, expression); +} + +static _invalid_parameter_handler _inv_old = NULL; + +#define SET_INVALID_PARAM_HANDLER _inv_old = _set_invalid_parameter_handler(inv_param_handler) + +#else + +#define SET_INVALID_PARAM_HANDLER ((void) 0) + +#endif + int main(int argc, char **argv) { krb5_context context; krb5_error_code ret; + SET_INVALID_PARAM_HANDLER; + setprogname(argv[0]); ret = krb5_init_context(&context); diff --git a/lib/krb5/test_cc.c b/lib/krb5/test_cc.c index bc420b431..87e0c89c5 100644 --- a/lib/krb5/test_cc.c +++ b/lib/krb5/test_cc.c @@ -38,11 +38,17 @@ static int debug_flag = 0; static int version_flag = 0; static int help_flag = 0; +#ifdef KRB5_USE_PATH_TOKENS +#define TEST_CC_NAME "%{TEMP}/krb5-cc-test-foo" +#else +#define TEST_CC_NAME "/tmp/krb5-cc-test-foo" +#endif + static void test_default_name(krb5_context context) { krb5_error_code ret; - const char *p, *test_cc_name = "/tmp/krb5-cc-test-foo"; + const char *p, *test_cc_name = TEST_CC_NAME; char *p1, *p2, *p3; p = krb5_cc_default_name(context); @@ -71,6 +77,14 @@ test_default_name(krb5_context context) krb5_errx (context, 1, "krb5_cc_default_name 2 failed"); p3 = estrdup(p); +#ifndef KRB5_USE_PATH_TOKENS + /* If we are using path tokens, we don't expect the p3 and + test_cc_name to match since p3 is going to have expanded + tokens. */ + if (strcmp(p3, test_cc_name) != 0) + krb5_errx (context, 1, "krb5_cc_set_default_name 1 failed"); +#endif + if (strcmp(p3, test_cc_name) != 0) krb5_errx (context, 1, "krb5_cc_set_default_name 1 failed"); @@ -284,6 +298,16 @@ struct { { "%{", 1 }, { "%{foo %{", 1 }, { "%{{", 1 }, +#ifdef KRB5_USE_PATH_TOKENS + { "%{APPDATA}", 0 }, + { "%{COMMON_APPDATA}", 0}, + { "%{LOCAL_APPDATA}", 0}, + { "%{SYSTEM}", 0}, + { "%{WINDOWS}", 0}, + { "%{TEMP}", 0}, + { "%{USERID}", 0}, + { "%{uid}", 0}, +#endif }; static void @@ -671,7 +695,9 @@ main(int argc, char **argv) test_move(context, krb5_cc_type_file); test_move(context, krb5_cc_type_memory); +#ifdef HAVE_KCM test_move(context, krb5_cc_type_kcm); +#endif test_move(context, krb5_cc_type_scc); test_prefix_ops(context, "FILE:/tmp/foo", &krb5_fcc_ops); diff --git a/lib/krb5/ticket.c b/lib/krb5/ticket.c index 19ca1bc3b..22963369a 100644 --- a/lib/krb5/ticket.c +++ b/lib/krb5/ticket.c @@ -47,7 +47,7 @@ * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_ticket(krb5_context context, krb5_ticket *ticket) { @@ -71,7 +71,7 @@ krb5_free_ticket(krb5_context context, * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_ticket(krb5_context context, const krb5_ticket *from, krb5_ticket **to) @@ -120,7 +120,7 @@ krb5_copy_ticket(krb5_context context, * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ticket_get_client(krb5_context context, const krb5_ticket *ticket, krb5_principal *client) @@ -141,7 +141,7 @@ krb5_ticket_get_client(krb5_context context, * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ticket_get_server(krb5_context context, const krb5_ticket *ticket, krb5_principal *server) @@ -160,7 +160,7 @@ krb5_ticket_get_server(krb5_context context, * @ingroup krb5 */ -time_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION time_t KRB5_LIB_CALL krb5_ticket_get_endtime(krb5_context context, const krb5_ticket *ticket) { @@ -338,7 +338,7 @@ out: * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_ticket_get_authorization_data_type(krb5_context context, krb5_ticket *ticket, int type, diff --git a/lib/krb5/time.c b/lib/krb5/time.c index ed235783a..247549ba2 100644 --- a/lib/krb5/time.c +++ b/lib/krb5/time.c @@ -47,7 +47,7 @@ * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_real_time (krb5_context context, krb5_timestamp sec, int32_t usec) @@ -79,7 +79,7 @@ krb5_set_real_time (krb5_context context, * return ``corrected'' time in `timeret'. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_timeofday (krb5_context context, krb5_timestamp *timeret) { @@ -91,7 +91,7 @@ krb5_timeofday (krb5_context context, * like gettimeofday but with time correction to the KDC */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_us_timeofday (krb5_context context, krb5_timestamp *sec, int32_t *usec) @@ -105,7 +105,7 @@ krb5_us_timeofday (krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_format_time(krb5_context context, time_t t, char *s, size_t len, krb5_boolean include_time) { @@ -120,7 +120,7 @@ krb5_format_time(krb5_context context, time_t t, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_deltat(const char *string, krb5_deltat *deltat) { if((*deltat = parse_time(string, "s")) == -1) diff --git a/lib/krb5/transited.c b/lib/krb5/transited.c index 1ff4ce165..a72adc035 100644 --- a/lib/krb5/transited.c +++ b/lib/krb5/transited.c @@ -328,7 +328,7 @@ decode_realms(krb5_context context, } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_domain_x500_decode(krb5_context context, krb5_data tr, char ***realms, unsigned int *num_realms, const char *client_realm, const char *server_realm) @@ -389,7 +389,7 @@ krb5_domain_x500_decode(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_domain_x500_encode(char **realms, unsigned int num_realms, krb5_data *encoding) { @@ -421,7 +421,7 @@ krb5_domain_x500_encode(char **realms, unsigned int num_realms, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_check_transited(krb5_context context, krb5_const_realm client_realm, krb5_const_realm server_realm, @@ -461,7 +461,7 @@ krb5_check_transited(krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_check_transited_realms(krb5_context context, const char *const *realms, unsigned int num_realms, diff --git a/lib/krb5/v4_glue.c b/lib/krb5/v4_glue.c index 168268cea..01cf323d3 100644 --- a/lib/krb5/v4_glue.c +++ b/lib/krb5/v4_glue.c @@ -58,7 +58,7 @@ static const int _tkt_lifetimes[TKTLIFENUMFIXED] = { 1623226, 1735464, 1855462, 1983758, 2120925, 2267576, 2424367, 2592000 }; -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL _krb5_krb_time_to_life(time_t start, time_t end) { int i; @@ -82,7 +82,7 @@ _krb5_krb_time_to_life(time_t start, time_t end) } -time_t KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION time_t KRB5_LIB_CALL _krb5_krb_life_to_time(int start, int life_) { unsigned char life = (unsigned char) life_; @@ -118,9 +118,15 @@ get_krb4_cc_name(const char *tkfile, char **cc) if (path) *cc = strdup(path); } +#ifdef HAVE_GETUID if(*cc == NULL) if (asprintf(cc, "%s%u", TKT_ROOT, (unsigned)getuid()) < 0) return errno; +#elif defined(KRB5_USE_PATH_TOKENS) + if(*cc == NULL) + if (_krb5_expand_path_tokens(NULL, TKT_ROOT "%{uid}", cc)) + return ENOMEM; +#endif } else { *cc = strdup(tkfile); if (*cc == NULL) @@ -232,7 +238,7 @@ write_v4_cc(krb5_context context, const char *tkfile, * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_krb_tf_setup(krb5_context context, struct credentials *v4creds, const char *tkfile, @@ -288,7 +294,7 @@ _krb5_krb_tf_setup(krb5_context context, * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_krb_dest_tkt(krb5_context context, const char *tkfile) { krb5_error_code ret; @@ -405,7 +411,7 @@ put_nir(krb5_storage *sp, const char *name, * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_krb_create_ticket(krb5_context context, unsigned char flags, const char *pname, @@ -464,7 +470,7 @@ _krb5_krb_create_ticket(krb5_context context, * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_krb_create_ciph(krb5_context context, const krb5_keyblock *session, const char *service, @@ -524,7 +530,7 @@ _krb5_krb_create_ciph(krb5_context context, * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_krb_create_auth_reply(krb5_context context, const char *pname, const char *pinst, @@ -577,7 +583,7 @@ _krb5_krb_create_auth_reply(krb5_context context, * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_krb_cr_err_reply(krb5_context context, const char *name, const char *inst, @@ -644,7 +650,7 @@ get_v4_stringz(krb5_storage *sp, char **str, size_t max_len) * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_krb_decomp_ticket(krb5_context context, const krb5_data *enc_ticket, const krb5_keyblock *key, @@ -738,7 +744,7 @@ _krb5_krb_decomp_ticket(krb5_context context, * */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_krb_rd_req(krb5_context context, krb5_data *authent, const char *service, @@ -938,7 +944,7 @@ _krb5_krb_rd_req(krb5_context context, * */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL _krb5_krb_free_auth_data(krb5_context context, struct _krb5_krb_auth_data *ad) { if (ad->pname) diff --git a/lib/krb5/verify_init.c b/lib/krb5/verify_init.c index 363bb4677..f73942eb4 100644 --- a/lib/krb5/verify_init.c +++ b/lib/krb5/verify_init.c @@ -33,13 +33,13 @@ #include "krb5_locl.h" -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_verify_init_creds_opt_init(krb5_verify_init_creds_opt *options) { memset (options, 0, sizeof(*options)); } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_verify_init_creds_opt_set_ap_req_nofail(krb5_verify_init_creds_opt *options, int ap_req_nofail) { @@ -67,7 +67,7 @@ fail_verify_is_ok (krb5_context context, return TRUE; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verify_init_creds(krb5_context context, krb5_creds *creds, krb5_principal ap_req_server, diff --git a/lib/krb5/verify_user.c b/lib/krb5/verify_user.c index 8cc109f0a..14f010137 100644 --- a/lib/krb5/verify_user.c +++ b/lib/krb5/verify_user.c @@ -88,7 +88,7 @@ verify_common (krb5_context context, * As a side effect, fresh tickets are obtained and stored in `ccache'. */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_verify_opt_init(krb5_verify_opt *opt) { memset(opt, 0, sizeof(*opt)); @@ -96,7 +96,7 @@ krb5_verify_opt_init(krb5_verify_opt *opt) opt->service = "host"; } -int KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_verify_opt_alloc(krb5_context context, krb5_verify_opt **opt) { *opt = calloc(1, sizeof(**opt)); @@ -109,37 +109,37 @@ krb5_verify_opt_alloc(krb5_context context, krb5_verify_opt **opt) return 0; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_verify_opt_free(krb5_verify_opt *opt) { free(opt); } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_verify_opt_set_ccache(krb5_verify_opt *opt, krb5_ccache ccache) { opt->ccache = ccache; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_verify_opt_set_keytab(krb5_verify_opt *opt, krb5_keytab keytab) { opt->keytab = keytab; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_verify_opt_set_secure(krb5_verify_opt *opt, krb5_boolean secure) { opt->secure = secure; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_verify_opt_set_service(krb5_verify_opt *opt, const char *service) { opt->service = service; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_verify_opt_set_flags(krb5_verify_opt *opt, unsigned int flags) { opt->flags |= flags; @@ -181,7 +181,7 @@ verify_user_opt_int(krb5_context context, #undef OPT } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verify_user_opt(krb5_context context, krb5_principal principal, const char *password, @@ -215,7 +215,7 @@ krb5_verify_user_opt(krb5_context context, /* compat function that calls above */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verify_user(krb5_context context, krb5_principal principal, krb5_ccache ccache, @@ -239,7 +239,7 @@ krb5_verify_user(krb5_context context, * ignored and all the local realms are tried. */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verify_user_lrealm(krb5_context context, krb5_principal principal, krb5_ccache ccache, diff --git a/lib/krb5/warn.c b/lib/krb5/warn.c index 886a1fe98..a4c633936 100644 --- a/lib/krb5/warn.c +++ b/lib/krb5/warn.c @@ -100,7 +100,7 @@ _warnerr(krb5_context context, int do_errtext, * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_vwarn(krb5_context context, krb5_error_code code, const char *fmt, va_list ap) __attribute__ ((format (printf, 3, 0))) @@ -119,7 +119,7 @@ krb5_vwarn(krb5_context context, krb5_error_code code, * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_warn(krb5_context context, krb5_error_code code, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))) { @@ -137,7 +137,7 @@ krb5_warn(krb5_context context, krb5_error_code code, const char *fmt, ...) * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_vwarnx(krb5_context context, const char *fmt, va_list ap) __attribute__ ((format (printf, 2, 0))) { @@ -153,7 +153,7 @@ krb5_vwarnx(krb5_context context, const char *fmt, va_list ap) * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_warnx(krb5_context context, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))) { @@ -174,7 +174,7 @@ krb5_warnx(krb5_context context, const char *fmt, ...) * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verr(krb5_context context, int eval, krb5_error_code code, const char *fmt, va_list ap) __attribute__ ((noreturn, format (printf, 4, 0))) @@ -195,7 +195,7 @@ krb5_verr(krb5_context context, int eval, krb5_error_code code, * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_err(krb5_context context, int eval, krb5_error_code code, const char *fmt, ...) __attribute__ ((noreturn, format (printf, 4, 5))) @@ -215,7 +215,7 @@ krb5_err(krb5_context context, int eval, krb5_error_code code, * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_verrx(krb5_context context, int eval, const char *fmt, va_list ap) __attribute__ ((noreturn, format (printf, 3, 0))) { @@ -233,7 +233,7 @@ krb5_verrx(krb5_context context, int eval, const char *fmt, va_list ap) * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_errx(krb5_context context, int eval, const char *fmt, ...) __attribute__ ((noreturn, format (printf, 3, 4))) { @@ -253,7 +253,7 @@ krb5_errx(krb5_context context, int eval, const char *fmt, ...) * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_vabort(krb5_context context, krb5_error_code code, const char *fmt, va_list ap) __attribute__ ((noreturn, format (printf, 3, 0))) @@ -273,7 +273,7 @@ krb5_vabort(krb5_context context, krb5_error_code code, * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_abort(krb5_context context, krb5_error_code code, const char *fmt, ...) __attribute__ ((noreturn, format (printf, 3, 4))) { @@ -281,7 +281,7 @@ krb5_abort(krb5_context context, krb5_error_code code, const char *fmt, ...) abort(); } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_vabortx(krb5_context context, const char *fmt, va_list ap) __attribute__ ((noreturn, format (printf, 2, 0))) { @@ -299,7 +299,7 @@ krb5_vabortx(krb5_context context, const char *fmt, va_list ap) * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_abortx(krb5_context context, const char *fmt, ...) __attribute__ ((noreturn, format (printf, 2, 3))) { @@ -316,7 +316,7 @@ krb5_abortx(krb5_context context, const char *fmt, ...) * @ingroup krb5_error */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_warn_dest(krb5_context context, krb5_log_facility *fac) { context->warn_dest = fac; @@ -331,7 +331,7 @@ krb5_set_warn_dest(krb5_context context, krb5_log_facility *fac) * @ingroup krb5_error */ -krb5_log_facility * KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_log_facility * KRB5_LIB_CALL krb5_get_warn_dest(krb5_context context) { return context->warn_dest; diff --git a/lib/krb5/write_message.c b/lib/krb5/write_message.c index a824e08fd..841004614 100644 --- a/lib/krb5/write_message.c +++ b/lib/krb5/write_message.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_write_message (krb5_context context, krb5_pointer p_fd, krb5_data *data) @@ -53,7 +53,7 @@ krb5_write_message (krb5_context context, return 0; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_write_priv_message(krb5_context context, krb5_auth_context ac, krb5_pointer p_fd, @@ -70,7 +70,7 @@ krb5_write_priv_message(krb5_context context, return ret; } -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_write_safe_message(krb5_context context, krb5_auth_context ac, krb5_pointer p_fd, diff --git a/lib/ntlm/NTMakefile b/lib/ntlm/NTMakefile new file mode 100644 index 000000000..826b3e1cc --- /dev/null +++ b/lib/ntlm/NTMakefile @@ -0,0 +1,63 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\ntlm + +!include ../../windows/NTMakefile.w32 + +INCFILES= \ + $(INCDIR)\heimntlm.h \ + $(INCDIR)\heimntlm-protos.h + +libheimntlm_la_SOURCES = ntlm.c heimntlm.h + +$(OBJ)\heimntlm-protos.h: $(libheimntlm_la_SOURCES) + $(PERL) ../../cf/make-proto.pl -q -P remove -o $(OBJ)\heimntlm-protos.h $(libheimntlm_la_SOURCES) + +$(LIBHEIMNTLM): $(OBJ)\ntlm.obj + $(LIBCON) + +all:: $(INCFILES) $(LIBHEIMNTLM) + + +test-binaries: $(OBJ)\test_ntlm.exe + +test-run: + cd $(OBJ) + test_ntlm.exe + cd $(SRCDIR) + +$(OBJ)\test_ntlm.exe: $(OBJ)\test_ntlm.obj $(LIBHEIMNTLM) $(LIBKRB5) $(LIBVERS) $(LIBROKEN) $(LIBHCRYPTO) $(LIBASN1) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +test:: test-binaries test-run diff --git a/lib/ntlm/ntlm.c b/lib/ntlm/ntlm.c index 36a04f1ff..58eebee1e 100644 --- a/lib/ntlm/ntlm.c +++ b/lib/ntlm/ntlm.c @@ -41,8 +41,8 @@ #include #include -#include #include +#include #define HC_DEPRECATED_CRYPTO diff --git a/lib/otp/NTMakefile b/lib/otp/NTMakefile new file mode 100644 index 000000000..a531c8b3f --- /dev/null +++ b/lib/otp/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\otp + +!include ../../windows/NTMakefile.w32 + diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile new file mode 100644 index 000000000..107ac0277 --- /dev/null +++ b/lib/roken/NTMakefile @@ -0,0 +1,243 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\roken + +!include ../../windows/NTMakefile.w32 + +libroken_la_OBJS = \ + $(OBJ)\base64.obj \ + $(OBJ)\bswap.obj \ + $(OBJ)\concat.obj \ + $(OBJ)\dirent.obj \ + $(OBJ)\dlfcn_w32.obj \ + $(OBJ)\dumpdata.obj \ + $(OBJ)\ecalloc.obj \ + $(OBJ)\emalloc.obj \ + $(OBJ)\environment.obj \ + $(OBJ)\eread.obj \ + $(OBJ)\erealloc.obj \ + $(OBJ)\err.obj \ + $(OBJ)\errx.obj \ + $(OBJ)\esetenv.obj \ + $(OBJ)\estrdup.obj \ + $(OBJ)\ewrite.obj \ + $(OBJ)\flock.obj \ + $(OBJ)\fnmatch.obj \ + $(OBJ)\getaddrinfo_hostspec.obj \ + $(OBJ)\get_default_username.obj \ + $(OBJ)\get_window_size.obj \ + $(OBJ)\getarg.obj \ + $(OBJ)\getifaddrs_w32.obj \ + $(OBJ)\getnameinfo_verified.obj \ + $(OBJ)\getprogname.obj \ + $(OBJ)\gettimeofday.obj \ + $(OBJ)\hex.obj \ + $(OBJ)\hostent_find_fqdn.obj \ + $(OBJ)\inet_aton.obj \ + $(OBJ)\inet_ntop.obj \ + $(OBJ)\inet_pton.obj \ + $(OBJ)\issuid.obj \ + $(OBJ)\lstat.obj \ + $(OBJ)\mini_inetd.obj \ + $(OBJ)\mkstemp.obj \ + $(OBJ)\net_read.obj \ + $(OBJ)\net_write.obj \ + $(OBJ)\parse_bytes.obj \ + $(OBJ)\parse_time.obj \ + $(OBJ)\parse_units.obj \ + $(OBJ)\realloc.obj \ + $(OBJ)\resolve.obj \ + $(OBJ)\roken_gethostby.obj \ + $(OBJ)\rtbl.obj \ + $(OBJ)\sendmsg_w32.obj \ + $(OBJ)\setprogname.obj \ + $(OBJ)\simple_exec_w32.obj \ + $(OBJ)\sleep.obj \ + $(OBJ)\snprintf.obj \ + $(OBJ)\socket.obj \ + $(OBJ)\sockstartup_w32.obj \ + $(OBJ)\strcollect.obj \ + $(OBJ)\strpool.obj \ + $(OBJ)\strptime.obj \ + $(OBJ)\strsep.obj \ + $(OBJ)\strsep_copy.obj \ + $(OBJ)\strtok_r.obj \ + $(OBJ)\syslogc.obj \ + $(OBJ)\timeval.obj \ + $(OBJ)\tm2time.obj \ + $(OBJ)\unvis.obj \ + $(OBJ)\verr.obj \ + $(OBJ)\verrx.obj \ + $(OBJ)\vis.obj \ + $(OBJ)\vwarn.obj \ + $(OBJ)\vwarnx.obj \ + $(OBJ)\warn.obj \ + $(OBJ)\warnerr.obj \ + $(OBJ)\warnx.obj + +{}.c{$(OBJ)}.obj: + $(C2OBJ) -DBUILD_ROKEN_LIB + +$(LIBROKEN): $(libroken_la_OBJS) + $(LIBCON) + +$(OBJ)\make-roken.exe: $(OBJ)\make-roken.obj + $(EXECONLINK) + +$(OBJ)\make-roken.c: roken.h.in roken.awk $(INCDIR)\config.h + $(AWK) -f roken.awk roken.h.in > $(OBJ)\make-roken.c || $(RM) $(OBJ)\make-roken.c + +$(INCDIR)\roken.h: $(OBJ)\make-roken.exe + $(OBJ)\make-roken.exe > $@ || $(RM) $@ + +INCFILES = \ + $(INCDIR)\base64.h \ + $(INCDIR)\dirent.h \ + $(INCDIR)\dlfcn.h \ + $(INCDIR)\err.h \ + $(INCDIR)\fnmatch.h \ + $(INCDIR)\getarg.h \ + $(INCDIR)\glob.h \ + $(INCDIR)\hex.h \ + $(INCDIR)\ifaddrs.h \ + $(INCDIR)\parse_bytes.h \ + $(INCDIR)\parse_time.h \ + $(INCDIR)\parse_units.h \ + $(INCDIR)\resolve.h \ + $(INCDIR)\roken.h \ + $(INCDIR)\roken-common.h \ + $(INCDIR)\rtbl.h \ + $(INCDIR)\syslog.h \ + $(INCDIR)\vis.h \ + $(INCDIR)\xdbm.h + +clean:: + -$(RM) $(XHEADERS) + +all:: $(INCFILES) $(LIBROKEN) + +clean:: + -$(RM) $(LIBROKEN) + +TMP_PROGS = $(OBJ)\snprintf-test.exe $(OBJ)\resolve-test.exe + +# Tests + +TEST_PROGS = \ + $(OBJ)\base64-test.exe \ + $(OBJ)\getaddrinfo-test.exe \ + $(OBJ)\getifaddrs-test.exe \ + $(OBJ)\hex-test.exe \ + $(OBJ)\test-readenv.exe \ + $(OBJ)\parse_bytes-test.exe \ + $(OBJ)\parse_reply-test.exe \ + $(OBJ)\parse_time-test.exe \ + $(OBJ)\snprintf-test.exe \ + $(OBJ)\strpftime-test.exe \ + $(OBJ)\dirent-test.exe + +$(OBJ)\strftime_test.obj: strftime.c + $(C2OBJ) -DTEST_SNPRINTF -DTEST_STRPFTIME -DBUILD_ROKEN_LIB + +$(OBJ)\strptime_test.obj: strptime.c + $(C2OBJ) -DTEST_SNPRINTF -DTEST_STRPFTIME -DBUILD_ROKEN_LIB + +$(OBJ)\snprintf_test.obj: snprintf.c + $(C2OBJ) -DTEST_SNPRINTF -DTEST_STRPFTIME -DBUILD_ROKEN_LIB + +$(OBJ)\libtest.lib: $(OBJ)\strftime_test.obj $(OBJ)\strptime_test.obj $(OBJ)\snprintf_test.obj + $(LIBCON) + +$(OBJ)\parse_reply-test.obj: parse_reply-test.c + $(C2OBJ) -DTEST_RESOLVE -DBUILD_ROKEN_LIB + +$(OBJ)\resolve_test.obj: resolve.c + $(C2OBJ) -DTEST_RESOLVE -DBUILD_ROKEN_LIB + +$(OBJ)\parse_reply-test.exe: $(OBJ)\parse_reply-test.obj $(OBJ)\resolve_test.obj + $(EXECONLINK) + +$(OBJ)\test-readenv.exe: $(OBJ)\test-readenv.obj $(OBJ)\test-mem.obj + $(EXECONLINK) + +$(OBJ)\parse_time-test.exe: $(OBJ)\parse_time-test.obj $(OBJ)\test-mem.obj $(LIBROKEN) + $(EXECONLINK) + +$(OBJ)\strpftime-test.obj: strpftime-test.c + $(C2OBJ) -DTEST_STRPFTIME -DBUILD_ROKEN_LIB + +$(OBJ)\strpftime-test.exe: $(OBJ)\strpftime-test.obj $(OBJ)\libtest.lib $(LIBROKEN) + $(EXECONLINK) + +$(OBJ)\snprintf-test.obj: snprintf-test.c + $(C2OBJ) -DTEST_SNPRINTF -DBUILD_ROKEN_LIB + +$(OBJ)\snprintf-test.exe: $(OBJ)\snprintf-test.obj $(OBJ)\libtest.lib $(LIBROKEN) + +$(OBJ)\resolve-test.exe: $(OBJ)\resolve-test.obj $(LIBROKEN) + +$(OBJ)\base64-test.exe: $(OBJ)\base64-test.obj $(OBJ)\base64.obj + +$(OBJ)\getaddrinfo-test.exe: $(OBJ)\getaddrinfo-test.obj $(LIBROKEN) + +$(OBJ)\hex-test.exe: $(OBJ)\hex-test.obj $(LIBROKEN) + +$(OBJ)\test-readenv.exe: $(OBJ)\test-readenv.obj $(LIBROKEN) + +$(OBJ)\parse_bytes-test.exe: $(OBJ)\parse_bytes-test.obj $(LIBROKEN) + +$(OBJ)\parse_reply-test.exe: $(OBJ)\parse_reply-test.obj $(LIBROKEN) + +$(OBJ)\dirent-test.exe: $(OBJ)\dirent-test.obj $(LIBROKEN) + +$(OBJ)\getifaddrs-test.exe: $(OBJ)\getifaddrs-test.obj $(LIBROKEN) + +test-binaries: $(TEST_PROGS) $(TMP_PROGS) + +test-run: + cd $(OBJ) + dirent-test.exe + base64-test.exe + getaddrinfo-test.exe + getifaddrs-test.exe + hex-test.exe + test-readenv.exe + parse_bytes-test.exe +# Need to rewrite this test: +# parse_reply-test.exe + parse_time-test.exe + snprintf-test.exe + strpftime-test.exe + cd $(SRCDIR) + +test:: test-binaries test-run + diff --git a/lib/roken/base64.c b/lib/roken/base64.c index a9f0535dd..4c06bd2d1 100644 --- a/lib/roken/base64.c +++ b/lib/roken/base64.c @@ -51,7 +51,7 @@ pos(char c) return -1; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL base64_encode(const void *data, int size, char **str) { char *s, *p; @@ -120,7 +120,7 @@ token_decode(const char *token) return (marker << 24) | val; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL base64_decode(const char *str, void *data) { const char *p; diff --git a/lib/roken/base64.h b/lib/roken/base64.h index f42c0ba42..dfae4c13b 100644 --- a/lib/roken/base64.h +++ b/lib/roken/base64.h @@ -38,16 +38,18 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL base64_encode(const void *, int, char **); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL base64_decode(const char *, void *); #endif diff --git a/lib/roken/bswap.c b/lib/roken/bswap.c index 67d240c23..7f8c1c22b 100644 --- a/lib/roken/bswap.c +++ b/lib/roken/bswap.c @@ -36,7 +36,7 @@ #ifndef HAVE_BSWAP32 -unsigned int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL bswap32 (unsigned int val) { return (val & 0xff) << 24 | @@ -48,7 +48,7 @@ bswap32 (unsigned int val) #ifndef HAVE_BSWAP16 -unsigned short ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION unsigned short ROKEN_LIB_CALL bswap16 (unsigned short val) { return (val & 0xff) << 8 | diff --git a/lib/roken/chown.c b/lib/roken/chown.c index c01e2aa94..90a82d958 100644 --- a/lib/roken/chown.c +++ b/lib/roken/chown.c @@ -35,7 +35,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL chown(const char *path, uid_t owner, gid_t group) { return 0; diff --git a/lib/roken/closefrom.c b/lib/roken/closefrom.c index 7aa0ef737..770eb2c67 100644 --- a/lib/roken/closefrom.c +++ b/lib/roken/closefrom.c @@ -42,7 +42,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL closefrom(int fd) { int num = getdtablesize(); diff --git a/lib/roken/concat.c b/lib/roken/concat.c index 631a0786b..2ae777d5d 100644 --- a/lib/roken/concat.c +++ b/lib/roken/concat.c @@ -35,7 +35,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_concat (char *s, size_t len, ...) { int ret; @@ -47,7 +47,7 @@ roken_concat (char *s, size_t len, ...) return ret; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_vconcat (char *s, size_t len, va_list args) { const char *a; @@ -65,7 +65,7 @@ roken_vconcat (char *s, size_t len, va_list args) return 0; } -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL roken_vmconcat (char **s, size_t max_len, va_list args) { const char *a; @@ -97,7 +97,7 @@ roken_vmconcat (char **s, size_t max_len, va_list args) return len; } -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL roken_mconcat (char **s, size_t max_len, ...) { int ret; diff --git a/lib/roken/copyhostent.c b/lib/roken/copyhostent.c index 69c1ba40f..4ed630210 100644 --- a/lib/roken/copyhostent.c +++ b/lib/roken/copyhostent.c @@ -39,7 +39,7 @@ * return a malloced copy of `h' */ -struct hostent * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL copyhostent (const struct hostent *h) { struct hostent *res; diff --git a/lib/roken/daemon.c b/lib/roken/daemon.c index 2fc98371b..591a9a953 100644 --- a/lib/roken/daemon.c +++ b/lib/roken/daemon.c @@ -47,7 +47,7 @@ static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93"; #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL daemon(int nochdir, int noclose) { int fd; diff --git a/lib/roken/dirent-test.c b/lib/roken/dirent-test.c new file mode 100644 index 000000000..ac87339fe --- /dev/null +++ b/lib/roken/dirent-test.c @@ -0,0 +1,278 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include "dirent.h" + +/* Note that we create a known directory structure in a subdirectory + of the current directory to run our tests. */ + +#define TESTDIR "dirent-test-dir" + +const char * dir_entries[] = { + "A", + "B", + "C", + "CAA", + "CAAA", + "CABBBB", + "CAABBB.txt", + "A filename with spaces" +}; + +const char * entries_begin_with_C[] = { + "C", + "CAA", + "CAAA", + "CABBBB", + "CAABBB.txt" +}; + +const char * entries_end_with_A[] = { + "A", + "CAA", + "CAAA" +}; + +const int n_dir_entries = sizeof(dir_entries)/sizeof(dir_entries[0]); + +int teardown_test(void); + +void fail_test(const char * reason, ...) +{ + va_list args; + + va_start(args, reason); + vfprintf(stderr, reason, args); + va_end(args); + + fprintf(stderr, " : errno = %d (%s)\n", errno, strerror(errno)); + teardown_test(); + abort(); +} + +void fail_test_nf(const char * format, ...) +{ + va_list args; + + fprintf(stderr, "FAIL:"); + + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); + + fprintf(stderr, " : errno = %d (%s)\n", errno, strerror(errno)); +} + +int touch(const char * filename) +{ + int fd; + + fd = _open(filename, _O_CREAT, _S_IREAD| _S_IWRITE); + + if (fd == -1) + return -1; + + return _close(fd); +} + +int setup_test(void) +{ + int i; + + fprintf(stderr, "Creating test directory %s ...\n", TESTDIR); + + if (_mkdir(TESTDIR)) + fail_test("Can't create test directory \"" TESTDIR "\""); + + if (_chdir(TESTDIR)) + fail_test("Can't change to test directory"); + + for (i=0; i < n_dir_entries; i++) { + if (touch(dir_entries[i])) + fail_test("Can't create test file '%s'", dir_entries[i]); + } + + fprintf(stderr, "Done with test setup.\n"); + + return 0; +} + +int teardown_test(void) +{ + char dirname[_MAX_PATH]; + size_t len; + int i; + + printf ("Begin cleanup...\n"); + + if (_getcwd(dirname, sizeof(dirname)/sizeof(char)) != NULL && + + (len = strlen(dirname)) > sizeof(TESTDIR)/sizeof(char) && + + !strcmp(dirname + len + 1 - sizeof(TESTDIR)/sizeof(char), TESTDIR)) { + + /* fallthrough */ + + } else { + /* did we create the directory? */ + + if (!_rmdir( TESTDIR )) { + fprintf(stderr, "Removed test directory\n"); + return 0; + } else { + if (errno == ENOTEMPTY) { + if (_chdir(TESTDIR)) { + fprintf(stderr, "Can't change to test directory. Aborting cleanup.\n"); + return -1; + } else { + /* fallthrough */ + } + } else { + return -1; + } + } + } + + fprintf(stderr, "Cleaning up test directory %s ...\n", TESTDIR); + + for (i=0; i < n_dir_entries; i++) { + if (_unlink(dir_entries[i])) { + /* if the test setup failed, we expect this to happen for + at least some files */ + } + } + + if (_chdir("..")) { + fprintf(stderr, "Can't escape test directory. Giving in.\n"); + return -1; + } + + if (_rmdir( TESTDIR )) { + fprintf(stderr, "Can't remove test directory.\n"); + return -1; + } + + printf("Cleaned up test directory\n"); + return 0; +} + +int check_list(const char * filespec, const char ** list, int n, int expect_dot_and_dotdot) +{ + DIR * d; + struct dirent * e; + int n_found = 0; + int i; + int rv = 0; + int retry = 1; + + d = opendir(filespec); + if (d == NULL) { + fail_test_nf("opendir failed for [%s]", filespec); + return -1; + } + + printf("Checking filespec [%s]... ", filespec); + + retry: + while ((e = readdir(d)) != NULL) { + n_found ++; + + if (expect_dot_and_dotdot && + (!strcmp(e->d_name, ".") || + !strcmp(e->d_name, ".."))) + continue; + + for (i=0; i < n; i++) { + if (!strcmp(list[i], e->d_name)) + break; + } + + if (i == n) { + fail_test_nf("Found unexpected entry [%s]", e->d_name); + rv = -1; + } + } + + if (n_found != n) { + fail_test_nf("Unexpected number of entries [%d]. Expected %d", n_found, n); + rv = -1; + } + + if (retry) { + retry = 0; + n_found = 0; + + rewinddir(d); + goto retry; + } + + if (closedir(d)) { + fail_test_nf("closedir() failed"); + } + + printf("done\n"); + + return rv; +} + +int run_tests() +{ + /* assumes that the test directory has been set up and we have + changed into the test directory. */ + + check_list("*", dir_entries, n_dir_entries + 2, 1); + check_list("*.*", dir_entries, n_dir_entries + 2, 1); + check_list("C*", entries_begin_with_C, sizeof(entries_begin_with_C)/sizeof(entries_begin_with_C[0]), 0); + check_list("*A", entries_end_with_A, sizeof(entries_end_with_A)/sizeof(entries_end_with_A[0]), 0); + + return 0; +} + +int main(int argc, char ** argv) +{ + if (setup_test()) + return 1; + + run_tests(); + + teardown_test(); + + return 0; +} diff --git a/lib/roken/dirent.c b/lib/roken/dirent.c new file mode 100644 index 000000000..7e16bc84d --- /dev/null +++ b/lib/roken/dirent.c @@ -0,0 +1,180 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include "dirent.h" + +#ifndef _WIN32 +#error Only implemented for Win32 +#endif + +struct _dirent_dirinfo { + int magic; + long n_entries; + long nc_entries; + long cursor; + struct dirent **entries; +}; +#define DIRINFO_MAGIC 0xf8c0639d +#define IS_DP(p) ((p) && ((DIR *)(p))->magic == DIRINFO_MAGIC) + +#define INITIAL_ENTRIES 16 + +ROKEN_LIB_FUNCTION DIR * ROKEN_LIB_CALL +opendir(const char * filespec) +{ + DIR * dp; + struct _finddata_t fd; + intptr_t fd_handle; + + memset(&fd, 0, sizeof(fd)); + + fd_handle = _findfirst(filespec, &fd); + + if (fd_handle == -1) + return NULL; + + dp = malloc(sizeof(*dp)); + if (dp == NULL) + goto done; + + memset(dp, 0, sizeof(*dp)); + dp->magic = DIRINFO_MAGIC; + dp->cursor = 0; + dp->n_entries = 0; + dp->nc_entries = INITIAL_ENTRIES; + dp->entries = calloc(dp->nc_entries, sizeof(dp->entries[0])); + + if (dp->entries == NULL) { + closedir(dp); + dp = NULL; + goto done; + } + + do { + long len = strlen(fd.name); + struct dirent * e; + + if (dp->n_entries == dp->nc_entries) { + struct dirent ** ne; + + dp->nc_entries *= 2; + ne = realloc(dp->entries, sizeof(dp->entries[0]) * dp->nc_entries); + + if (ne == NULL) { + closedir(dp); + dp = NULL; + goto done; + } + + dp->entries = ne; + } + + e = malloc(sizeof(*e) + len * sizeof(char)); + if (e == NULL) { + closedir(dp); + dp = NULL; + goto done; + } + + e->d_ino = 0; /* no inodes :( */ + strcpy_s(e->d_name, len + 1, fd.name); + + dp->entries[dp->n_entries++] = e; + + } while (_findnext(fd_handle, &fd) == 0); + + done: + if (fd_handle != -1) + _findclose(fd_handle); + + return dp; +} + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +closedir(DIR * dp) +{ + if (!IS_DP(dp)) + return EINVAL; + + if (dp->entries) { + long i; + + for (i=0; i < dp->n_entries; i++) { + free(dp->entries[i]); + } + + free(dp->entries); + } + + free(dp); + + return 0; +} + +ROKEN_LIB_FUNCTION struct dirent * ROKEN_LIB_CALL +readdir(DIR * dp) +{ + if (!IS_DP(dp) || + dp->cursor < 0 || + dp->cursor >= dp->n_entries) + + return NULL; + + return dp->entries[dp->cursor++]; +} + +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +rewinddir(DIR * dp) +{ + if (IS_DP(dp)) + dp->cursor = 0; +} + +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +seekdir(DIR * dp, long offset) +{ + if (IS_DP(dp) && offset >= 0 && offset < dp->n_entries) + dp->cursor = offset; +} + +ROKEN_LIB_FUNCTION long ROKEN_LIB_CALL +telldir(DIR * dp) +{ + return dp->cursor; +} diff --git a/lib/roken/dirent.h b/lib/roken/dirent.h new file mode 100644 index 000000000..c9a86c63f --- /dev/null +++ b/lib/roken/dirent.h @@ -0,0 +1,66 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifndef __DIRENT_H__ +#define __DIRENT_H__ + +#ifndef ROKEN_LIB_FUNCTION +#ifdef _WIN32 +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl +#else +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL +#endif +#endif + +#include + +struct dirent { + ino_t d_ino; + char d_name[1]; +}; + +typedef struct _dirent_dirinfo DIR; + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL closedir(DIR *); + +ROKEN_LIB_FUNCTION DIR * ROKEN_LIB_CALL opendir(const char *); + +ROKEN_LIB_FUNCTION struct dirent * ROKEN_LIB_CALL readdir(DIR *); + +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rewinddir(DIR *); + +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL seekdir(DIR *, long); + +ROKEN_LIB_FUNCTION long ROKEN_LIB_CALL telldir(DIR *); + +#endif diff --git a/lib/roken/dlfcn.h b/lib/roken/dlfcn.h new file mode 100644 index 000000000..d0972573d --- /dev/null +++ b/lib/roken/dlfcn.h @@ -0,0 +1,78 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifndef __dlfcn_h__ +#define __dlfcn_h__ + +#ifndef ROKEN_LIB_FUNCTION +#ifdef _WIN32 +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl +#else +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL +#endif +#endif + +#define DLSYM_RET_TYPE void * + +#ifdef __cplusplus +extern "C" +#endif + +/* Implementation based on + http://www.opengroup.org/onlinepubs/009695399/basedefs/dlfcn.h.html */ + +#define RTLD_LAZY (1<<0) + +#define RTLD_NOW (1<<1) + +#define RTLD_GLOBAL (1<<2) + +#define RTLD_LOCAL (1<<3) + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +dlclose(void *); + +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL +dlerror(void); + +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL +dlopen(const char *, int); + +ROKEN_LIB_FUNCTION DLSYM_RET_TYPE ROKEN_LIB_CALL +dlsym(void *, const char *); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __dlfcn_h__ */ diff --git a/lib/roken/dlfcn_w32.c b/lib/roken/dlfcn_w32.c new file mode 100644 index 000000000..713887330 --- /dev/null +++ b/lib/roken/dlfcn_w32.c @@ -0,0 +1,96 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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 +#include +#include + +#define ERR_STR_LEN 256 + +__declspec(thread) static char err_str[ERR_STR_LEN]; + +static void set_error(const char * e) { + StringCbCopy(err_str, sizeof(err_str), e); +} + +static void set_error_from_last(void) { + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, + 0, GetLastError(), 0, + err_str, sizeof(err_str)/sizeof(err_str[0]), + NULL); +} + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +dlclose(void * vhm) +{ + BOOL brv; + + brv = FreeLibrary((HMODULE) vhm); + if (!brv) { + set_error_from_last(); + } + return !brv; +} + +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL +dlerror(void) +{ + return err_str; +} + +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL +dlopen(const char *fn, int flags) +{ + HMODULE hm; + + /* We don't support dlopen(0, ...) on Windows.*/ + if ( fn == NULL ) { + set_error("Not implemented"); + return NULL; + } + + hm = LoadLibrary(fn); + + if (hm == NULL) { + set_error_from_last(); + } + + return (void *) hm; +} + +ROKEN_LIB_FUNCTION DLSYM_RET_TYPE ROKEN_LIB_CALL +dlsym(void * vhm, const char * func_name) +{ + HMODULE hm = (HMODULE) vhm; + + return GetProcAddress(hm, func_name); +} + diff --git a/lib/roken/dumpdata.c b/lib/roken/dumpdata.c index c5513c323..3280d7337 100644 --- a/lib/roken/dumpdata.c +++ b/lib/roken/dumpdata.c @@ -33,15 +33,13 @@ #include -#include - #include "roken.h" /* * Write datablob to a filename, don't care about errors. */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_dumpdata (const char *filename, const void *buf, size_t size) { int fd; diff --git a/lib/roken/ecalloc.c b/lib/roken/ecalloc.c index c8e650403..04b37330c 100644 --- a/lib/roken/ecalloc.c +++ b/lib/roken/ecalloc.c @@ -42,7 +42,7 @@ * Like calloc but never fails. */ -void * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL ecalloc (size_t number, size_t size) { void *tmp = calloc (number, size); diff --git a/lib/roken/emalloc.c b/lib/roken/emalloc.c index c937e6d70..2520230a3 100644 --- a/lib/roken/emalloc.c +++ b/lib/roken/emalloc.c @@ -42,7 +42,7 @@ * Like malloc but never fails. */ -void * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL emalloc (size_t sz) { void *tmp = malloc (sz); diff --git a/lib/roken/environment.c b/lib/roken/environment.c index 49a6f4a54..64c354d62 100644 --- a/lib/roken/environment.c +++ b/lib/roken/environment.c @@ -127,7 +127,7 @@ read_env_file(FILE *F, char ***env, int *assigned) * list of malloced strings in `env' */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL read_environment(const char *file, char ***env) { int assigned; @@ -141,7 +141,7 @@ read_environment(const char *file, char ***env) return assigned; } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL free_environment(char **env) { int i; diff --git a/lib/roken/eread.c b/lib/roken/eread.c index 18de0b85e..f102ff82d 100644 --- a/lib/roken/eread.c +++ b/lib/roken/eread.c @@ -33,7 +33,6 @@ #include -#include #include #include "roken.h" @@ -42,7 +41,7 @@ * Like read but never fails (and never returns partial data). */ -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL eread (int fd, void *buf, size_t nbytes) { ssize_t ret; diff --git a/lib/roken/erealloc.c b/lib/roken/erealloc.c index f77c8ec73..1c30ecc60 100644 --- a/lib/roken/erealloc.c +++ b/lib/roken/erealloc.c @@ -42,7 +42,7 @@ * Like realloc but never fails. */ -void * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL erealloc (void *ptr, size_t sz) { void *tmp = realloc (ptr, sz); diff --git a/lib/roken/err.c b/lib/roken/err.c index a5c3dddb5..5fbe84fdf 100644 --- a/lib/roken/err.c +++ b/lib/roken/err.c @@ -35,7 +35,7 @@ #include "err.h" -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL err(int eval, const char *fmt, ...) { va_list ap; diff --git a/lib/roken/err.hin b/lib/roken/err.hin index 9fd1856e2..96fe5cf85 100644 --- a/lib/roken/err.hin +++ b/lib/roken/err.hin @@ -48,40 +48,42 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL verr(int eval, const char *fmt, va_list ap) __attribute__ ((noreturn, format (printf, 2, 0))); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL err(int eval, const char *fmt, ...) __attribute__ ((noreturn, format (printf, 2, 3))); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL verrx(int eval, const char *fmt, va_list ap) __attribute__ ((noreturn, format (printf, 2, 0))); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL errx(int eval, const char *fmt, ...) __attribute__ ((noreturn, format (printf, 2, 3))); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vwarn(const char *fmt, va_list ap) __attribute__ ((format (printf, 1, 0))); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL warn(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vwarnx(const char *fmt, va_list ap) __attribute__ ((format (printf, 1, 0))); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL warnx(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); diff --git a/lib/roken/errx.c b/lib/roken/errx.c index 60fc7e7c0..f75ad0179 100644 --- a/lib/roken/errx.c +++ b/lib/roken/errx.c @@ -35,7 +35,7 @@ #include "err.h" -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL errx(int eval, const char *fmt, ...) { va_list ap; diff --git a/lib/roken/esetenv.c b/lib/roken/esetenv.c index bbafdbea1..3cbf5ed36 100644 --- a/lib/roken/esetenv.c +++ b/lib/roken/esetenv.c @@ -37,7 +37,7 @@ #include -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL esetenv(const char *var, const char *val, int rewrite) { if (setenv (rk_UNCONST(var), rk_UNCONST(val), rewrite)) diff --git a/lib/roken/estrdup.c b/lib/roken/estrdup.c index ab7f26550..d275a2830 100644 --- a/lib/roken/estrdup.c +++ b/lib/roken/estrdup.c @@ -42,7 +42,7 @@ * Like strdup but never fails. */ -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL estrdup (const char *str) { char *tmp = strdup (str); diff --git a/lib/roken/ewrite.c b/lib/roken/ewrite.c index ac00f3b94..262b0183b 100644 --- a/lib/roken/ewrite.c +++ b/lib/roken/ewrite.c @@ -33,7 +33,6 @@ #include -#include #include #include "roken.h" @@ -42,7 +41,7 @@ * Like write but never fails (and never returns partial data). */ -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL ewrite (int fd, const void *buf, size_t nbytes) { ssize_t ret; diff --git a/lib/roken/fchown.c b/lib/roken/fchown.c index 453bb3eb0..050c2dd3b 100644 --- a/lib/roken/fchown.c +++ b/lib/roken/fchown.c @@ -35,7 +35,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fchown(int fd, uid_t owner, gid_t group) { return 0; diff --git a/lib/roken/flock.c b/lib/roken/flock.c index e15a3f796..525ad8a83 100644 --- a/lib/roken/flock.c +++ b/lib/roken/flock.c @@ -37,11 +37,11 @@ #include "roken.h" - #define OP_MASK (LOCK_SH | LOCK_EX | LOCK_UN) -int ROKEN_LIB_FUNCTION -rk_flock(int fd, int operation) + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +fk_flock(int fd, int operation) { #if defined(HAVE_FCNTL) && defined(F_SETLK) struct flock arg; @@ -75,6 +75,76 @@ rk_flock(int fd, int operation) break; } return code; + +#elif defined(_WIN32) + /* Windows */ + +#define FLOCK_OFFSET_LOW 0 +#define FLOCK_OFFSET_HIGH 0 +#define FLOCK_LENGTH_LOW 0x00000000 +#define FLOCK_LENGTH_HIGH 0x80000000 + + HANDLE hFile; + OVERLAPPED ov; + BOOL rv = FALSE; + DWORD f = 0; + + hFile = (HANDLE) _get_osfhandle(fd); + if (hFile == NULL || hFile == INVALID_HANDLE_VALUE) { + _set_errno(EBADF); + return -1; + } + + ZeroMemory(&ov, sizeof(ov)); + ov.hEvent = NULL; + ov.Offset = FLOCK_OFFSET_LOW; + ov.OffsetHigh = FLOCK_OFFSET_HIGH; + + if (operation & LOCK_NB) + f = LOCKFILE_FAIL_IMMEDIATELY; + + switch (operation & OP_MASK) { + case LOCK_UN: /* Unlock */ + rv = UnlockFileEx(hFile, 0, + FLOCK_LENGTH_LOW, FLOCK_LENGTH_HIGH, &ov); + break; + + case LOCK_SH: /* Shared lock */ + rv = LockFileEx(hFile, f, 0, + FLOCK_LENGTH_LOW, FLOCK_LENGTH_HIGH, &ov); + break; + + case LOCK_EX: /* Exclusive lock */ + rv = LockFileEx(hFile, f|LOCKFILE_EXCLUSIVE_LOCK, 0, + FLOCK_LENGTH_LOW, FLOCK_LENGTH_HIGH, + &ov); + break; + + default: + _set_errno(EINVAL); + return -1; + } + + if (!rv) { + switch (GetLastError()) { + case ERROR_SHARING_VIOLATION: + case ERROR_LOCK_VIOLATION: + case ERROR_IO_PENDING: + _set_errno(EWOULDBLOCK); + break; + + case ERROR_ACCESS_DENIED: + _set_errno(EACCES); + break; + + default: + _set_errno(ENOLCK); + } + return -1; + } + + return 0; + #else return -1; #endif diff --git a/lib/roken/fnmatch.c b/lib/roken/fnmatch.c index 179b17f90..f693faec8 100644 --- a/lib/roken/fnmatch.c +++ b/lib/roken/fnmatch.c @@ -45,6 +45,12 @@ static char rcsid[] = "$NetBSD: fnmatch.c,v 1.11 1995/02/27 03:43:06 cgd Exp $"; * Compares a filename or pathname to a pattern. */ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + #include #include @@ -52,7 +58,7 @@ static char rcsid[] = "$NetBSD: fnmatch.c,v 1.11 1995/02/27 03:43:06 cgd Exp $"; static const char *rangematch (const char *, int, int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_fnmatch(const char *pattern, const char *string, int flags) { const char *stringstart; diff --git a/lib/roken/fnmatch.hin b/lib/roken/fnmatch.hin index d5d54a562..1a66d4274 100644 --- a/lib/roken/fnmatch.hin +++ b/lib/roken/fnmatch.hin @@ -36,9 +36,11 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION __declspec(dllimport) +#define ROKEN_LIB_CALL __stdcall #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif diff --git a/lib/roken/freeaddrinfo.c b/lib/roken/freeaddrinfo.c index 434e49e88..7132e95dd 100644 --- a/lib/roken/freeaddrinfo.c +++ b/lib/roken/freeaddrinfo.c @@ -39,7 +39,7 @@ * free the list of `struct addrinfo' starting at `ai' */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL freeaddrinfo(struct addrinfo *ai) { struct addrinfo *tofree; diff --git a/lib/roken/freehostent.c b/lib/roken/freehostent.c index 335504300..61fbb223b 100644 --- a/lib/roken/freehostent.c +++ b/lib/roken/freehostent.c @@ -39,7 +39,7 @@ * free a malloced hostent */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL freehostent (struct hostent *h) { char **p; diff --git a/lib/roken/gai_strerror.c b/lib/roken/gai_strerror.c index 10beac05e..1e326bee3 100644 --- a/lib/roken/gai_strerror.c +++ b/lib/roken/gai_strerror.c @@ -62,7 +62,7 @@ static struct gai_error { * */ -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL gai_strerror(int ecode) { struct gai_error *g; diff --git a/lib/roken/get_default_username.c b/lib/roken/get_default_username.c index 96fa1b06d..da6806b15 100644 --- a/lib/roken/get_default_username.c +++ b/lib/roken/get_default_username.c @@ -40,7 +40,7 @@ * NULL if we can't guess at all. */ -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL get_default_username (void) { const char *user; @@ -73,5 +73,11 @@ get_default_username (void) return pwd->pw_name; } #endif +#ifdef _WIN32 + /* TODO: We can call GetUserNameEx() and figure out a + username. However, callers do not free the return value of this + function. */ +#endif + return user; } diff --git a/lib/roken/get_window_size.c b/lib/roken/get_window_size.c index 60fb1764f..13e7ebf15 100644 --- a/lib/roken/get_window_size.c +++ b/lib/roken/get_window_size.c @@ -57,7 +57,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, struct winsize *wp) { int ret = -1; @@ -85,6 +85,20 @@ get_window_size(int fd, struct winsize *wp) wp->ws_col = dst[0]; ret = 0; } +#elif defined(_WIN32) + { + intptr_t fh = 0; + CONSOLE_SCREEN_BUFFER_INFO sb_info; + + fh = _get_osfhandle(fd); + if (fh != (intptr_t) INVALID_HANDLE_VALUE && + GetConsoleScreenBufferInfo((HANDLE) fh, &sb_info)) { + wp->ws_row = 1 + sb_info.srWindow.Bottom - sb_info.srWindow.Top; + wp->ws_col = 1 + sb_info.srWindow.Right - sb_info.srWindow.Left; + + ret = 0; + } + } #endif if (ret != 0) { char *s; diff --git a/lib/roken/getaddrinfo.c b/lib/roken/getaddrinfo.c index 8c6129976..c8ed95413 100644 --- a/lib/roken/getaddrinfo.c +++ b/lib/roken/getaddrinfo.c @@ -365,7 +365,7 @@ get_nodes (const char *nodename, * }; */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getaddrinfo(const char *nodename, const char *servname, const struct addrinfo *hints, diff --git a/lib/roken/getaddrinfo_hostspec.c b/lib/roken/getaddrinfo_hostspec.c index 44694eeb8..b18c54fb6 100644 --- a/lib/roken/getaddrinfo_hostspec.c +++ b/lib/roken/getaddrinfo_hostspec.c @@ -37,7 +37,7 @@ /* getaddrinfo via string specifying host and port */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_getaddrinfo_hostspec2(const char *hostspec, int socktype, int port, @@ -92,7 +92,7 @@ roken_getaddrinfo_hostspec2(const char *hostspec, return getaddrinfo (host, portstr, &hints, ai); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_getaddrinfo_hostspec(const char *hostspec, int port, struct addrinfo **ai) diff --git a/lib/roken/getarg.c b/lib/roken/getarg.c index 60b0f645a..f2d132067 100644 --- a/lib/roken/getarg.c +++ b/lib/roken/getarg.c @@ -91,7 +91,7 @@ mandoc_template(struct getargs *args, const char *extra_string, char *(i18n)(const char *)) { - int i; + size_t i; char timestr[64], cmd[64]; char buf[128]; const char *p; @@ -207,7 +207,7 @@ builtin_i18n(const char *str) return rk_UNCONST(str); } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL arg_printusage (struct getargs *args, size_t num_args, const char *progname, @@ -217,7 +217,7 @@ arg_printusage (struct getargs *args, progname, extra_string, builtin_i18n); } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL arg_printusage_i18n (struct getargs *args, size_t num_args, const char *usage, @@ -225,8 +225,7 @@ arg_printusage_i18n (struct getargs *args, const char *extra_string, char *(i18n)(const char *)) { - int i; - size_t max_len = 0; + size_t i, max_len = 0; char buf[128]; int col = 0, columns; struct winsize ws; @@ -287,6 +286,7 @@ arg_printusage_i18n (struct getargs *args, } if (args[i].short_name && !ISFLAG(args[i])) { snprintf(buf, sizeof(buf), "[-%c", args[i].short_name); + buf[sizeof(buf)/sizeof(buf[0]) - 1] = '\0'; len += 2; len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf), 0, 0, &args[i], i18n); @@ -353,7 +353,7 @@ static int arg_match_long(struct getargs *args, size_t num_args, char *argv, int argc, char **rargv, int *goptind) { - int i; + size_t i; char *goptarg = NULL; int negate = 0; int partial_match = 0; @@ -474,6 +474,7 @@ arg_match_long(struct getargs *args, size_t num_args, default: abort (); + return 0; /* Not-reached */ } /* not reached */ @@ -484,7 +485,7 @@ static int arg_match_short (struct getargs *args, size_t num_args, char *argv, int argc, char **rargv, int *goptind) { - int j, k; + size_t j, k; for(j = 1; j > 0 && j < strlen(rargv[*goptind]); j++) { for(k = 0; k < num_args; k++) { @@ -550,7 +551,7 @@ arg_match_short (struct getargs *args, size_t num_args, return 0; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getarg(struct getargs *args, size_t num_args, int argc, char **argv, int *goptind) { @@ -562,7 +563,7 @@ getarg(struct getargs *args, size_t num_args, #elif defined(HAVE_RANDOM) srandom(time(NULL)); #else - srand (time(NULL)); + srand ((int) time(NULL)); #endif (*goptind)++; for(i = *goptind; i < argc; i++) { @@ -586,7 +587,7 @@ getarg(struct getargs *args, size_t num_args, return ret; } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL free_getarg_strings (getarg_strings *s) { free (s->strings); diff --git a/lib/roken/getarg.h b/lib/roken/getarg.h index 64b65aa76..79573a0ea 100644 --- a/lib/roken/getarg.h +++ b/lib/roken/getarg.h @@ -40,9 +40,11 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif @@ -86,17 +88,17 @@ typedef struct getarg_collect_info { void *data; } getarg_collect_info; -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getarg(struct getargs *args, size_t num_args, int argc, char **argv, int *goptind); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL arg_printusage (struct getargs *args, size_t num_args, const char *progname, const char *extra_string); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL arg_printusage_i18n (struct getargs *args, size_t num_args, const char *usage, @@ -104,7 +106,7 @@ arg_printusage_i18n (struct getargs *args, const char *extra_string, char *(i18n)(const char *)); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL free_getarg_strings (getarg_strings *); #endif /* __GETARG_H__ */ diff --git a/lib/roken/getcap.c b/lib/roken/getcap.c index fc90870d8..d6250f525 100644 --- a/lib/roken/getcap.c +++ b/lib/roken/getcap.c @@ -83,24 +83,24 @@ static int getent (char **, size_t *, char **, int, const char *, int, char *); static int nfcmp (char *, char *); -int ROKEN_LIB_FUNCTION cgetset(const char *ent); -char *ROKEN_LIB_FUNCTION cgetcap(char *buf, const char *cap, int type); -int ROKEN_LIB_FUNCTION cgetent(char **buf, char **db_array, const char *name); -int ROKEN_LIB_FUNCTION cgetmatch(const char *buf, const char *name); -int ROKEN_LIB_FUNCTION cgetclose(void); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetset(const char *ent); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL cgetcap(char *buf, const char *cap, int type); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetent(char **buf, char **db_array, const char *name); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetmatch(const char *buf, const char *name); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetclose(void); #if 0 int cgetfirst(char **buf, char **db_array); int cgetnext(char **bp, char **db_array); #endif -int ROKEN_LIB_FUNCTION cgetstr(char *buf, const char *cap, char **str); -int ROKEN_LIB_FUNCTION cgetustr(char *buf, const char *cap, char **str); -int ROKEN_LIB_FUNCTION cgetnum(char *buf, const char *cap, long *num); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetstr(char *buf, const char *cap, char **str); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetustr(char *buf, const char *cap, char **str); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetnum(char *buf, const char *cap, long *num); /* * Cgetset() allows the addition of a user specified buffer to be added * to the database array, in effect "pushing" the buffer on top of the * virtual database. 0 is returned on success, -1 on failure. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetset(const char *ent) { const char *source, *check; @@ -153,7 +153,7 @@ cgetset(const char *ent) * If (cap, '@') or (cap, terminator, '@') is found before (cap, terminator) * return NULL. */ -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL cgetcap(char *buf, const char *cap, int type) { char *bp; @@ -204,7 +204,7 @@ cgetcap(char *buf, const char *cap, int type) * encountered (couldn't open/read a file, etc.), and -3 if a potential * reference loop is detected. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetent(char **buf, char **db_array, const char *name) { size_t dummy; @@ -700,7 +700,7 @@ static FILE *pfp; static int slash; static char **dbp; -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetclose(void) { if (pfp != NULL) { @@ -847,7 +847,7 @@ cgetnext(char **bp, char **db_array) * couldn't be found, -2 if a system error was encountered (storage * allocation failure). */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetstr(char *buf, const char *cap, char **str) { u_int m_room; @@ -980,7 +980,7 @@ cgetstr(char *buf, const char *cap, char **str) * -1 if the requested string capability couldn't be found, -2 if a system * error was encountered (storage allocation failure). */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetustr(char *buf, const char *cap, char **str) { u_int m_room; @@ -1049,7 +1049,7 @@ cgetustr(char *buf, const char *cap, char **str) * the long pointed to by num. 0 is returned on success, -1 if the requested * numeric capability couldn't be found. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetnum(char *buf, const char *cap, long *num) { long n; diff --git a/lib/roken/getcwd.c b/lib/roken/getcwd.c index c83b56e2d..f8917b245 100644 --- a/lib/roken/getcwd.c +++ b/lib/roken/getcwd.c @@ -42,7 +42,7 @@ #include "roken.h" -char* ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char* ROKEN_LIB_CALL getcwd(char *path, size_t size) { char xxx[MaxPathLen]; diff --git a/lib/roken/getdtablesize.c b/lib/roken/getdtablesize.c index a515af345..08c0661fa 100644 --- a/lib/roken/getdtablesize.c +++ b/lib/roken/getdtablesize.c @@ -61,7 +61,7 @@ #include #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void) { int files = -1; diff --git a/lib/roken/getegid.c b/lib/roken/getegid.c index dfd82db1a..663fb1df1 100644 --- a/lib/roken/getegid.c +++ b/lib/roken/getegid.c @@ -37,7 +37,7 @@ #ifndef HAVE_GETEGID -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getegid(void) { return getgid(); diff --git a/lib/roken/geteuid.c b/lib/roken/geteuid.c index 3246d0256..598a73929 100644 --- a/lib/roken/geteuid.c +++ b/lib/roken/geteuid.c @@ -37,7 +37,7 @@ #ifndef HAVE_GETEUID -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL geteuid(void) { return getuid(); diff --git a/lib/roken/getgid.c b/lib/roken/getgid.c index 6a8e66db6..b24ceebc8 100644 --- a/lib/roken/getgid.c +++ b/lib/roken/getgid.c @@ -36,7 +36,7 @@ #ifndef HAVE_GETGID -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getgid(void) { return 17; diff --git a/lib/roken/gethostname.c b/lib/roken/gethostname.c index 7051667f7..838909140 100644 --- a/lib/roken/gethostname.c +++ b/lib/roken/gethostname.c @@ -47,7 +47,7 @@ * interface is identical to gethostname(2).) */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL gethostname(char *name, int namelen) { #if defined(HAVE_UNAME) diff --git a/lib/roken/getifaddrs-test.c b/lib/roken/getifaddrs-test.c index 76ed061bc..2762e4552 100644 --- a/lib/roken/getifaddrs-test.c +++ b/lib/roken/getifaddrs-test.c @@ -3,6 +3,8 @@ * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * + * Portions Copyright (c) 2009, Secure Endpoints Inc. All rights reserved. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -38,18 +40,62 @@ #include +void +print_addr(const char *s, struct sockaddr *sa) +{ + int i; + printf(" %s=%d/", s, sa->sa_family); +#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN + for(i = 0; i < sa->sa_len - ((long)sa->sa_data - (long)&sa->sa_family); i++) + printf("%02x", ((unsigned char*)sa->sa_data)[i]); +#else + for(i = 0; i < sizeof(sa->sa_data); i++) + printf("%02x", ((unsigned char*)sa->sa_data)[i]); +#endif + printf("\n"); +} + +void +print_ifaddrs(struct ifaddrs *x) +{ + struct ifaddrs *p; + + for(p = x; p; p = p->ifa_next) { + printf("%s\n", p->ifa_name); + printf(" flags=%x\n", p->ifa_flags); + if(p->ifa_addr) + print_addr("addr", p->ifa_addr); + if(p->ifa_dstaddr) + print_addr("dstaddr", p->ifa_dstaddr); + if(p->ifa_netmask) + print_addr("netmask", p->ifa_netmask); + printf(" %p\n", p->ifa_data); + } +} + int main(int argc, char **argv) { struct ifaddrs *addrs = NULL; int ret; + if (SOCK_INIT) + errx(1, "Couldn't initialize sockets. Err=%d\n", SOCK_ERRNO); + ret = getifaddrs(&addrs); if (ret != 0) err(1, "getifaddrs"); + if (addrs == NULL) + errx(1, "address == NULL"); + + print_ifaddrs(addrs); + /* Check that freeifaddrs doesn't crash */ freeifaddrs(addrs); + if (SOCK_EXIT) + errx(1, "Couldn't uninitialize sockets. Err=%d\n", SOCK_ERRNO); + return 0; } diff --git a/lib/roken/getifaddrs.c b/lib/roken/getifaddrs.c index 6acbc1676..3770ebbee 100644 --- a/lib/roken/getifaddrs.c +++ b/lib/roken/getifaddrs.c @@ -498,7 +498,7 @@ nl_open(void) } /* ====================================================================== */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_getifaddrs(struct ifaddrs **ifap) { int sd; @@ -1165,7 +1165,7 @@ getlifaddrs2(struct ifaddrs **ifap, } #endif /* defined(HAVE_IPV6) && defined(SIOCGLIFCONF) && defined(SIOCGLIFFLAGS) */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_getifaddrs(struct ifaddrs **ifap) { int ret = -1; @@ -1193,7 +1193,9 @@ rk_getifaddrs(struct ifaddrs **ifap) return ret; } -void ROKEN_LIB_FUNCTION +#endif /* !AF_NETLINK */ + +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_freeifaddrs(struct ifaddrs *ifp) { struct ifaddrs *p, *q; @@ -1214,8 +1216,6 @@ rk_freeifaddrs(struct ifaddrs *ifp) } } -#endif /* !AF_NETLINK */ - #ifdef TEST void diff --git a/lib/roken/getifaddrs_w32.c b/lib/roken/getifaddrs_w32.c new file mode 100644 index 000000000..96ab497fc --- /dev/null +++ b/lib/roken/getifaddrs_w32.c @@ -0,0 +1,163 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include + +#ifndef _WIN32 +#error This is a Windows specific implementation. +#endif + +static struct sockaddr * +dupaddr(const sockaddr_gen * src) +{ + sockaddr_gen * d = malloc(sizeof(*d)); + + if (d) { + memcpy(d, src, sizeof(*d)); + } + + return (struct sockaddr *) d; +} + +int ROKEN_LIB_FUNCTION +rk_getifaddrs(struct ifaddrs **ifpp) +{ + SOCKET s = INVALID_SOCKET; + size_t il_len = 8192; + int ret = -1; + INTERFACE_INFO *il = NULL; + + *ifpp = NULL; + + s = socket(AF_INET, SOCK_DGRAM, 0); + if (s == INVALID_SOCKET) + return -1; + + for (;;) { + DWORD cbret = 0; + + il = malloc(il_len); + if (!il) + break; + + ZeroMemory(il, il_len); + + if (WSAIoctl(s, SIO_GET_INTERFACE_LIST, NULL, 0, + (LPVOID) il, il_len, &cbret, + NULL, NULL) == 0) { + il_len = cbret; + break; + } + + free (il); + il = NULL; + + if (WSAGetLastError() == WSAEFAULT && cbret > il_len) { + il_len = cbret; + } else { + break; + } + } + + if (!il) + goto _exit; + + /* il is an array of INTERFACE_INFO structures. il_len has the + actual size of the buffer. The number of elements is + il_len/sizeof(INTERFACE_INFO) */ + + { + size_t n = il_len / sizeof(INTERFACE_INFO); + size_t i; + + for (i = 0; i < n; i++ ) { + struct ifaddrs *ifp; + + ifp = malloc(sizeof(*ifp)); + if (ifp == NULL) + break; + + ZeroMemory(ifp, sizeof(*ifp)); + + ifp->ifa_next = NULL; + ifp->ifa_name = NULL; + ifp->ifa_flags = il[i].iiFlags; + ifp->ifa_addr = dupaddr(&il[i].iiAddress); + ifp->ifa_netmask = dupaddr(&il[i].iiNetmask); + ifp->ifa_broadaddr = dupaddr(&il[i].iiBroadcastAddress); + ifp->ifa_data = NULL; + + *ifpp = ifp; + ifpp = &ifp->ifa_next; + } + + if (i == n) + ret = 0; + } + + _exit: + + if (s != INVALID_SOCKET) + closesocket(s); + + if (il) + free (il); + + return ret; +} + +void ROKEN_LIB_FUNCTION +rk_freeifaddrs(struct ifaddrs *ifp) +{ + struct ifaddrs *p, *q; + + for(p = ifp; p; ) { + if (p->ifa_name) + free(p->ifa_name); + if(p->ifa_addr) + free(p->ifa_addr); + if(p->ifa_dstaddr) + free(p->ifa_dstaddr); + if(p->ifa_netmask) + free(p->ifa_netmask); + if(p->ifa_data) + free(p->ifa_data); + q = p; + p = p->ifa_next; + free(q); + } +} diff --git a/lib/roken/getipnodebyaddr.c b/lib/roken/getipnodebyaddr.c index ddaec03a8..7d4095f1d 100644 --- a/lib/roken/getipnodebyaddr.c +++ b/lib/roken/getipnodebyaddr.c @@ -40,7 +40,7 @@ * to a malloced struct hostent or NULL. */ -struct hostent * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL getipnodebyaddr (const void *src, size_t len, int af, int *error_num) { struct hostent *tmp; diff --git a/lib/roken/getipnodebyname.c b/lib/roken/getipnodebyname.c index 16fdbdd24..2ff282707 100644 --- a/lib/roken/getipnodebyname.c +++ b/lib/roken/getipnodebyname.c @@ -44,7 +44,7 @@ static int h_errno = NO_RECOVERY; * to a malloced struct hostent or NULL. */ -struct hostent * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL getipnodebyname (const char *name, int af, int flags, int *error_num) { struct hostent *tmp; diff --git a/lib/roken/getnameinfo.c b/lib/roken/getnameinfo.c index 0621cfeee..b23ad01eb 100644 --- a/lib/roken/getnameinfo.c +++ b/lib/roken/getnameinfo.c @@ -91,7 +91,7 @@ doit (int af, * */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, diff --git a/lib/roken/getnameinfo_verified.c b/lib/roken/getnameinfo_verified.c index 43e4c049f..6175291e4 100644 --- a/lib/roken/getnameinfo_verified.c +++ b/lib/roken/getnameinfo_verified.c @@ -43,7 +43,7 @@ * NI_NAMEREQD flag is set or return the numeric address as a string. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getnameinfo_verified(const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, size_t servlen, diff --git a/lib/roken/getopt.c b/lib/roken/getopt.c index 12bf138d0..9f54c2b69 100644 --- a/lib/roken/getopt.c +++ b/lib/roken/getopt.c @@ -51,7 +51,7 @@ char *optarg; /* argument associated with option */ #define BADARG (int)':' #define EMSG "" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getopt(nargc, nargv, ostr) int nargc; char * const *nargv; diff --git a/lib/roken/getprogname.c b/lib/roken/getprogname.c index 933b6dec7..a310208a8 100644 --- a/lib/roken/getprogname.c +++ b/lib/roken/getprogname.c @@ -40,7 +40,7 @@ const char *__progname; #endif #ifndef HAVE_GETPROGNAME -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL getprogname(void) { return __progname; diff --git a/lib/roken/gettimeofday.c b/lib/roken/gettimeofday.c index dcce56329..e6e2e04a3 100644 --- a/lib/roken/gettimeofday.c +++ b/lib/roken/gettimeofday.c @@ -38,13 +38,13 @@ /* * Simple gettimeofday that only returns seconds. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL gettimeofday (struct timeval *tp, void *ignore) { time_t t; t = time(NULL); - tp->tv_sec = t; + tp->tv_sec = (long) t; tp->tv_usec = 0; return 0; } diff --git a/lib/roken/getuid.c b/lib/roken/getuid.c index 86bca77e1..63fdec19d 100644 --- a/lib/roken/getuid.c +++ b/lib/roken/getuid.c @@ -36,7 +36,7 @@ #ifndef HAVE_GETUID -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getuid(void) { return 17; diff --git a/lib/roken/getusershell.c b/lib/roken/getusershell.c index a1e6333e7..6f7145d52 100644 --- a/lib/roken/getusershell.c +++ b/lib/roken/getusershell.c @@ -81,7 +81,7 @@ static char **initshells (void); /* * Get a list of shells from _PATH_SHELLS, if it exists. */ -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL getusershell() { char *ret; @@ -94,7 +94,7 @@ getusershell() return (ret); } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL endusershell() { if (shells != NULL) @@ -106,7 +106,7 @@ endusershell() curshell = NULL; } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL setusershell() { curshell = initshells(); diff --git a/lib/roken/glob.c b/lib/roken/glob.c index 4cdb9037f..9b37319eb 100644 --- a/lib/roken/glob.c +++ b/lib/roken/glob.c @@ -164,7 +164,7 @@ static int match (Char *, Char *, Char *); static void qprintf (const char *, Char *); #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL glob(const char *pattern, int flags, int (*errfunc)(const char *, int), @@ -739,7 +739,7 @@ match(Char *name, Char *pat, Char *patend) } /* Free allocated data belonging to a glob_t structure. */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL globfree(glob_t *pglob) { int i; diff --git a/lib/roken/hex.c b/lib/roken/hex.c index 95488af5c..91590dd49 100644 --- a/lib/roken/hex.c +++ b/lib/roken/hex.c @@ -50,7 +50,7 @@ pos(char c) return -1; } -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL hex_encode(const void *data, size_t size, char **str) { const unsigned char *q = data; @@ -80,7 +80,7 @@ hex_encode(const void *data, size_t size, char **str) return i * 2; } -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL hex_decode(const char *str, void *data, size_t len) { size_t l; diff --git a/lib/roken/hex.h b/lib/roken/hex.h index b3c45511c..c266268ea 100644 --- a/lib/roken/hex.h +++ b/lib/roken/hex.h @@ -38,18 +38,20 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif #define hex_encode rk_hex_encode #define hex_decode rk_hex_decode -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL hex_encode(const void *, size_t, char **); -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL hex_decode(const char *, void *, size_t); #endif /* _rk_HEX_H_ */ diff --git a/lib/roken/hostent_find_fqdn.c b/lib/roken/hostent_find_fqdn.c index b5f2b42f6..dc3c17ff2 100644 --- a/lib/roken/hostent_find_fqdn.c +++ b/lib/roken/hostent_find_fqdn.c @@ -39,7 +39,7 @@ * Try to find a fqdn (with `.') in he if possible, else return h_name */ -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL hostent_find_fqdn (const struct hostent *he) { const char *ret = he->h_name; diff --git a/lib/roken/hstrerror.c b/lib/roken/hstrerror.c index 79eab2dd5..70b63016e 100644 --- a/lib/roken/hstrerror.c +++ b/lib/roken/hstrerror.c @@ -64,7 +64,7 @@ extern int h_nerr; #endif -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL hstrerror(int herr) { if (0 <= herr && herr < h_nerr) diff --git a/lib/roken/inet_aton.c b/lib/roken/inet_aton.c index c9b21e00f..31644a0cd 100644 --- a/lib/roken/inet_aton.c +++ b/lib/roken/inet_aton.c @@ -38,7 +38,7 @@ /* Minimal implementation of inet_aton. * Cannot distinguish between failure and a local broadcast address. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL inet_aton(const char *cp, struct in_addr *addr) { addr->s_addr = inet_addr(cp); diff --git a/lib/roken/inet_ntop.c b/lib/roken/inet_ntop.c index daf3e926d..0c72b27fc 100644 --- a/lib/roken/inet_ntop.c +++ b/lib/roken/inet_ntop.c @@ -113,7 +113,7 @@ inet_ntop_v6 (const void *src, char *dst, size_t size) } #endif /* HAVE_IPV6 */ -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL inet_ntop(int af, const void *src, char *dst, size_t size) { switch (af) { diff --git a/lib/roken/inet_pton.c b/lib/roken/inet_pton.c index ad60824f4..58a5d1f62 100644 --- a/lib/roken/inet_pton.c +++ b/lib/roken/inet_pton.c @@ -35,7 +35,64 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +#ifdef HAVE_WINSOCK + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +inet_pton(int af, const char *src, void *dst) +{ + switch (af) { + case AF_INET: + { + struct sockaddr_in si4; + INT r; + INT s = sizeof(si4); + + si4.sin_family = AF_INET; + r = WSAStringToAddress(src, AF_INET, NULL, &si4, &s); + + if (r == 0) { + memcpy(dst, &si4.sin_addr, sizeof(si4.sin_addr)); + return 1; + } + } + break; + + case AF_INET6: + { + struct sockaddr_in6 si6; + INT r; + INT s = sizeof(si6); + + si6.sin6_family = AF_INET6; + r = WSAStringToAddress(src, AF_INET6, NULL, &si6, &s); + + if (r == 0) { + memcpy(dst, &si6.sin6_addr, sizeof(si6.sin6_addr)); + return 1; + } + } + break; + + default: + _set_errno( EAFNOSUPPORT ); + return -1; + } + + /* the call failed */ + { + int le = WSAGetLastError(); + + if (le == WSAEINVAL) + return 0; + + _set_errno(le); + return -1; + } +} + +#else /* !HAVE_WINSOCK */ + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL inet_pton(int af, const char *src, void *dst) { if (af != AF_INET) { @@ -44,3 +101,5 @@ inet_pton(int af, const char *src, void *dst) } return inet_aton (src, dst); } + +#endif diff --git a/lib/roken/initgroups.c b/lib/roken/initgroups.c index 50ac23aa4..2ba944c1a 100644 --- a/lib/roken/initgroups.c +++ b/lib/roken/initgroups.c @@ -35,7 +35,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL initgroups(const char *name, gid_t basegid) { return 0; diff --git a/lib/roken/innetgr.c b/lib/roken/innetgr.c index 2f6d9a1dc..e1783bbfb 100644 --- a/lib/roken/innetgr.c +++ b/lib/roken/innetgr.c @@ -35,7 +35,7 @@ #ifndef HAVE_INNETGR -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL innetgr(const char *netgroup, const char *machine, const char *user, const char *domain) { diff --git a/lib/roken/iruserok.c b/lib/roken/iruserok.c index 3f0b5a0a5..95f654681 100644 --- a/lib/roken/iruserok.c +++ b/lib/roken/iruserok.c @@ -214,7 +214,7 @@ __ivaliduser(FILE *hostf, unsigned raddr, const char *luser, * * Returns 0 if ok, -1 if not ok. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL iruserok(unsigned raddr, int superuser, const char *ruser, const char *luser) { char *cp; diff --git a/lib/roken/issuid.c b/lib/roken/issuid.c index 2999e8249..ea0db803e 100644 --- a/lib/roken/issuid.c +++ b/lib/roken/issuid.c @@ -35,7 +35,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL issuid(void) { #if defined(HAVE_ISSETUGID) diff --git a/lib/roken/k_getpwnam.c b/lib/roken/k_getpwnam.c index 0c50118dd..c0db757c4 100644 --- a/lib/roken/k_getpwnam.c +++ b/lib/roken/k_getpwnam.c @@ -38,7 +38,7 @@ #include #endif -struct passwd * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwnam (const char *user) { struct passwd *p; diff --git a/lib/roken/k_getpwuid.c b/lib/roken/k_getpwuid.c index 29b7228e2..d533738d9 100644 --- a/lib/roken/k_getpwuid.c +++ b/lib/roken/k_getpwuid.c @@ -38,7 +38,7 @@ #include #endif -struct passwd * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwuid (uid_t uid) { struct passwd *p; diff --git a/lib/roken/localtime_r.c b/lib/roken/localtime_r.c index 3335180b1..e7d03ef6d 100644 --- a/lib/roken/localtime_r.c +++ b/lib/roken/localtime_r.c @@ -39,7 +39,7 @@ #ifndef HAVE_LOCALTIME_R -struct tm * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct tm * ROKEN_LIB_CALL localtime_r(const time_t *timer, struct tm *result) { struct tm *tm; diff --git a/lib/roken/lstat.c b/lib/roken/lstat.c index a850efd75..469258850 100644 --- a/lib/roken/lstat.c +++ b/lib/roken/lstat.c @@ -35,7 +35,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL lstat(const char *path, struct stat *buf) { return stat(path, buf); diff --git a/lib/roken/memmove.c b/lib/roken/memmove.c index c5cdf6fd6..1825d7eb3 100644 --- a/lib/roken/memmove.c +++ b/lib/roken/memmove.c @@ -41,7 +41,7 @@ #include #endif -void* ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void* ROKEN_LIB_CALL memmove(void *s1, const void *s2, size_t n) { char *s=(char*)s2, *d=(char*)s1; diff --git a/lib/roken/mini_inetd.c b/lib/roken/mini_inetd.c index f3321eaac..a46ac3d68 100644 --- a/lib/roken/mini_inetd.c +++ b/lib/roken/mini_inetd.c @@ -41,46 +41,48 @@ */ static void -accept_it (int s) +accept_it (SOCKET s) { - int s2; + SOCKET s2; s2 = accept(s, NULL, NULL); - if(s2 < 0) + if(IS_BAD_SOCKET(s2)) err (1, "accept"); - close(s); - dup2(s2, STDIN_FILENO); - dup2(s2, STDOUT_FILENO); - /* dup2(s2, STDERR_FILENO); */ - close(s2); + closesocket(s); + dup2(fd_from_socket(s2, _O_RDONLY), STDIN_FILENO); + dup2(fd_from_socket(s2, 0), STDOUT_FILENO); + /* dup2(fd_from_socket(s2, 0), STDERR_FILENO); */ + closesocket(s2); } /* * Listen on a specified port, emulating inetd. */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL mini_inetd_addrinfo (struct addrinfo *ai) { int ret; struct addrinfo *a; int n, nalloc, i; - int *fds; + SOCKET *fds; fd_set orig_read_set, read_set; - int max_fd = -1; + SOCKET max_fd = (SOCKET)-1; for (nalloc = 0, a = ai; a != NULL; a = a->ai_next) ++nalloc; fds = malloc (nalloc * sizeof(*fds)); - if (fds == NULL) + if (fds == NULL) { errx (1, "mini_inetd: out of memory"); + UNREACHABLE(return); + } FD_ZERO(&orig_read_set); for (i = 0, a = ai; a != NULL; a = a->ai_next) { fds[i] = socket (a->ai_family, a->ai_socktype, a->ai_protocol); - if (fds[i] < 0) + if (IS_BAD_SOCKET(fds[i])) continue; socket_set_reuseaddr (fds[i], 1); socket_set_ipv6only(fds[i], 1); @@ -91,11 +93,13 @@ mini_inetd_addrinfo (struct addrinfo *ai) } if (listen (fds[i], SOMAXCONN) < 0) { warn ("listen af = %d", a->ai_family); - close(fds[i]); + closesocket(fds[i]); continue; } +#ifndef NO_LIMIT_FD_SETSIZE if (fds[i] >= FD_SETSIZE) errx (1, "fd too large"); +#endif FD_SET(fds[i], &orig_read_set); max_fd = max(max_fd, fds[i]); ++i; @@ -108,7 +112,7 @@ mini_inetd_addrinfo (struct addrinfo *ai) read_set = orig_read_set; ret = select (max_fd + 1, &read_set, NULL, NULL, NULL); - if (ret < 0 && errno != EINTR) + if (IS_SOCKET_ERROR(ret) && SOCK_ERRNO != EINTR) err (1, "select"); } while (ret <= 0); @@ -116,14 +120,14 @@ mini_inetd_addrinfo (struct addrinfo *ai) if (FD_ISSET (fds[i], &read_set)) { accept_it (fds[i]); for (i = 0; i < n; ++i) - close(fds[i]); + closesocket(fds[i]); free(fds); return; } abort (); } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL mini_inetd (int port) { int error; diff --git a/lib/roken/mkstemp.c b/lib/roken/mkstemp.c index d47919e63..a3ca6c717 100644 --- a/lib/roken/mkstemp.c +++ b/lib/roken/mkstemp.c @@ -42,9 +42,11 @@ #endif #include +#include + #ifndef HAVE_MKSTEMP -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL mkstemp(char *template) { int start, i; diff --git a/lib/roken/ndbm_wrap.c b/lib/roken/ndbm_wrap.c index 8db3662a1..4fbdb4da0 100644 --- a/lib/roken/ndbm_wrap.c +++ b/lib/roken/ndbm_wrap.c @@ -60,7 +60,7 @@ static DBC *cursor; #define D(X) ((DB*)(X)) -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL dbm_close (DBM *db) { #ifdef HAVE_DB3 @@ -71,7 +71,7 @@ dbm_close (DBM *db) #endif } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_delete (DBM *db, datum dkey) { DBT key; @@ -129,19 +129,19 @@ dbm_get (DB *db, int flags) #define DB_KEYEXIST 1 #endif -datum ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_firstkey (DBM *db) { return dbm_get(D(db), DB_FIRST); } -datum ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_nextkey (DBM *db) { return dbm_get(D(db), DB_NEXT); } -DBM* ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION DBM* ROKEN_LIB_CALL dbm_open (const char *file, int flags, mode_t mode) { DB *db; @@ -184,7 +184,7 @@ dbm_open (const char *file, int flags, mode_t mode) return (DBM*)db; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_store (DBM *db, datum dkey, datum dvalue, int flags) { int ret; @@ -204,13 +204,13 @@ dbm_store (DBM *db, datum dkey, datum dvalue, int flags) RETURN(ret); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_error (DBM *db) { return 0; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_clearerr (DBM *db) { return 0; diff --git a/lib/roken/ndbm_wrap.h b/lib/roken/ndbm_wrap.h index 360d502e3..a2ec4f206 100644 --- a/lib/roken/ndbm_wrap.h +++ b/lib/roken/ndbm_wrap.h @@ -41,9 +41,11 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif @@ -78,14 +80,14 @@ typedef struct { } DBM; #endif -int ROKEN_LIB_FUNCTION dbm_clearerr (DBM*); -void ROKEN_LIB_FUNCTION dbm_close (DBM*); -int ROKEN_LIB_FUNCTION dbm_delete (DBM*, datum); -int ROKEN_LIB_FUNCTION dbm_error (DBM*); -datum ROKEN_LIB_FUNCTION dbm_fetch (DBM*, datum); -datum ROKEN_LIB_FUNCTION dbm_firstkey (DBM*); -datum ROKEN_LIB_FUNCTION dbm_nextkey (DBM*); -DBM* ROKEN_LIB_FUNCTION dbm_open (const char*, int, mode_t); -int ROKEN_LIB_FUNCTION dbm_store (DBM*, datum, datum, int); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_clearerr (DBM*); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL dbm_close (DBM*); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_delete (DBM*, datum); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_error (DBM*); +ROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_fetch (DBM*, datum); +ROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_firstkey (DBM*); +ROKEN_LIB_FUNCTION datum ROKEN_LIB_CALL dbm_nextkey (DBM*); +ROKEN_LIB_FUNCTION DBM* ROKEN_LIB_CALL dbm_open (const char*, int, mode_t); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL dbm_store (DBM*, datum, datum, int); #endif /* __ndbm_wrap_h__ */ diff --git a/lib/roken/net_read.c b/lib/roken/net_read.c index 9d055d006..7741e0256 100644 --- a/lib/roken/net_read.c +++ b/lib/roken/net_read.c @@ -33,17 +33,13 @@ #include -#include -#include -#include - #include "roken.h" /* * Like read but never return partial data. */ -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_read (int fd, void *buf, size_t nbytes) { char *cbuf = (char *)buf; @@ -51,11 +47,7 @@ net_read (int fd, void *buf, size_t nbytes) size_t rem = nbytes; while (rem > 0) { -#ifdef WIN32 - count = recv (fd, cbuf, rem, 0); -#else count = read (fd, cbuf, rem); -#endif if (count < 0) { if (errno == EINTR) continue; @@ -69,3 +61,30 @@ net_read (int fd, void *buf, size_t nbytes) } return nbytes; } + +#ifdef SOCKET_IS_NOT_AN_FD + +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL +net_read_s (SOCKET sock, void *buf, size_t nbytes) +{ + char *cbuf = (char *)buf; + ssize_t count; + size_t rem = nbytes; + + while (rem > 0) { + count = recv (sock, cbuf, rem, 0); + if (count < 0) { + if (errno == EINTR) + continue; + else + return count; + } else if (count == 0) { + return count; + } + cbuf += count; + rem -= count; + } + return nbytes; +} + +#endif diff --git a/lib/roken/net_write.c b/lib/roken/net_write.c index 515f21097..a12c06a49 100644 --- a/lib/roken/net_write.c +++ b/lib/roken/net_write.c @@ -33,17 +33,13 @@ #include -#include -#include -#include - #include "roken.h" /* * Like write but never return partial data. */ -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_write (int fd, const void *buf, size_t nbytes) { const char *cbuf = (const char *)buf; @@ -51,11 +47,7 @@ net_write (int fd, const void *buf, size_t nbytes) size_t rem = nbytes; while (rem > 0) { -#ifdef WIN32 - count = send (fd, cbuf, rem, 0); -#else count = write (fd, cbuf, rem); -#endif if (count < 0) { if (errno == EINTR) continue; @@ -67,3 +59,28 @@ net_write (int fd, const void *buf, size_t nbytes) } return nbytes; } + +#ifdef SOCKET_IS_NOT_AN_FD + +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL +net_write_s (SOCKET sock, const void *buf, size_t nbytes) +{ + const char *cbuf = (const char *)buf; + ssize_t count; + size_t rem = nbytes; + + while (rem > 0) { + count = send (sock, cbuf, rem, 0); + if (count < 0) { + if (errno == EINTR) + continue; + else + return count; + } + cbuf += count; + rem -= count; + } + return nbytes; +} + +#endif diff --git a/lib/roken/parse_bytes.c b/lib/roken/parse_bytes.c index 4a7df94e7..561079afc 100644 --- a/lib/roken/parse_bytes.c +++ b/lib/roken/parse_bytes.c @@ -56,19 +56,19 @@ static struct units bytes_short_units[] = { { NULL, 0 } }; -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL parse_bytes (const char *s, const char *def_unit) { return parse_units (s, bytes_units, def_unit); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_bytes (int t, char *s, size_t len) { return unparse_units (t, bytes_units, s, len); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_bytes_short (int t, char *s, size_t len) { return unparse_units_approx (t, bytes_short_units, s, len); diff --git a/lib/roken/parse_bytes.h b/lib/roken/parse_bytes.h index 7d389e808..8a88eca49 100644 --- a/lib/roken/parse_bytes.h +++ b/lib/roken/parse_bytes.h @@ -38,19 +38,21 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL parse_bytes (const char *s, const char *def_unit); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_bytes (int t, char *s, size_t len); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_bytes_short (int t, char *s, size_t len); #endif /* __PARSE_BYTES_H__ */ diff --git a/lib/roken/parse_time-test.c b/lib/roken/parse_time-test.c index d6ba4cbb9..10c0f6dea 100644 --- a/lib/roken/parse_time-test.c +++ b/lib/roken/parse_time-test.c @@ -40,8 +40,8 @@ static struct testcase { size_t size; - time_t val; - char *str; + int val; + char *str; } tests[] = { { 8, 1, "1 second" }, { 17, 61, "1 minute 1 second" }, @@ -97,6 +97,7 @@ main(int argc, char **argv) errx(1, "test %i not zero terminated", i); rk_test_mem_free("underrun"); } + buf = rk_test_mem_alloc(RK_TM_OVERRUN, "overrun", tests[i].str, tests[i].size + 1); j = parse_time(buf, "s"); @@ -110,6 +111,7 @@ main(int argc, char **argv) if (j != tests[i].val) errx(1, "parse_time failed for test %d", i); rk_test_mem_free("underrun"); + } return 0; } diff --git a/lib/roken/parse_time.c b/lib/roken/parse_time.c index b581970bd..febd6a5d2 100644 --- a/lib/roken/parse_time.c +++ b/lib/roken/parse_time.c @@ -50,25 +50,25 @@ static struct units time_units[] = { {NULL, 0}, }; -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL parse_time (const char *s, const char *def_unit) { return parse_units (s, time_units, def_unit); } -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL unparse_time (int t, char *s, size_t len) { return unparse_units (t, time_units, s, len); } -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL unparse_time_approx (int t, char *s, size_t len) { return unparse_units_approx (t, time_units, s, len); } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL print_time_table (FILE *f) { print_units_table (time_units, f); diff --git a/lib/roken/parse_time.h b/lib/roken/parse_time.h index 23aae2fc9..dabcefd81 100644 --- a/lib/roken/parse_time.h +++ b/lib/roken/parse_time.h @@ -38,22 +38,24 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif -int +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL parse_time (const char *s, const char *def_unit); -size_t +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL unparse_time (int t, char *s, size_t len); -size_t +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL unparse_time_approx (int t, char *s, size_t len); -void +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL print_time_table (FILE *f); #endif /* __PARSE_TIME_H__ */ diff --git a/lib/roken/parse_units.c b/lib/roken/parse_units.c index a848298c5..bca4040f1 100644 --- a/lib/roken/parse_units.c +++ b/lib/roken/parse_units.c @@ -70,7 +70,7 @@ parse_something (const char *s, const struct units *units, p = s; while (*p) { - double val; + int val; char *next; const struct units *u, *partial_unit; size_t u_len; @@ -80,7 +80,7 @@ parse_something (const char *s, const struct units *units, while(isspace((unsigned char)*p) || *p == ',') ++p; - val = strtod (p, &next); /* strtol(p, &next, 0); */ + val = (int) strtod (p, &next); /* strtol(p, &next, 0); */ if (p == next) { val = 0; if(!accept_no_val_p) @@ -149,7 +149,7 @@ acc_units(int res, int val, unsigned mult) return res + val * mult; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL parse_units (const char *s, const struct units *units, const char *def_unit) { @@ -175,7 +175,7 @@ acc_flags(int res, int val, unsigned mult) return -1; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL parse_flags (const char *s, const struct units *units, int orig) { @@ -208,7 +208,7 @@ unparse_something (int num, const struct units *units, char *s, size_t len, tmp = (*print) (s, len, divisor, u->name, num); if (tmp < 0) return tmp; - if (tmp > len) { + if (tmp > (int) len) { len = 0; s = NULL; } else { @@ -245,7 +245,7 @@ update_unit_approx (int in, unsigned mult) return update_unit (in, mult); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_units (int num, const struct units *units, char *s, size_t len) { return unparse_something (num, units, s, len, @@ -254,7 +254,7 @@ unparse_units (int num, const struct units *units, char *s, size_t len) "0"); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_units_approx (int num, const struct units *units, char *s, size_t len) { return unparse_something (num, units, s, len, @@ -263,7 +263,7 @@ unparse_units_approx (int num, const struct units *units, char *s, size_t len) "0"); } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL print_units_table (const struct units *units, FILE *f) { const struct units *u, *u2; @@ -308,7 +308,7 @@ update_flag (int in, unsigned mult) return in - mult; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_flags (int num, const struct units *units, char *s, size_t len) { return unparse_something (num, units, s, len, @@ -317,7 +317,7 @@ unparse_flags (int num, const struct units *units, char *s, size_t len) ""); } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL print_flags_table (const struct units *units, FILE *f) { const struct units *u; diff --git a/lib/roken/parse_units.h b/lib/roken/parse_units.h index 2f2235bb0..2d1c28690 100644 --- a/lib/roken/parse_units.h +++ b/lib/roken/parse_units.h @@ -41,9 +41,11 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif @@ -52,28 +54,28 @@ struct units { unsigned mult; }; -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL parse_units (const char *s, const struct units *units, const char *def_unit); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL print_units_table (const struct units *units, FILE *f); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL parse_flags (const char *s, const struct units *units, int orig); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_units (int num, const struct units *units, char *s, size_t len); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_units_approx (int num, const struct units *units, char *s, size_t len); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unparse_flags (int num, const struct units *units, char *s, size_t len); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL print_flags_table (const struct units *units, FILE *f); #endif /* __PARSE_UNITS_H__ */ diff --git a/lib/roken/putenv.c b/lib/roken/putenv.c index a1a119e33..647eb7a34 100644 --- a/lib/roken/putenv.c +++ b/lib/roken/putenv.c @@ -47,7 +47,7 @@ extern char **environ; * value by altering an existing variable or creating a new one. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL putenv(const char *string) { int i; diff --git a/lib/roken/rcmd.c b/lib/roken/rcmd.c index c1ff33919..7fa85a35b 100644 --- a/lib/roken/rcmd.c +++ b/lib/roken/rcmd.c @@ -36,7 +36,7 @@ #include "roken.h" #include -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rcmd(char **ahost, unsigned short inport, const char *locuser, diff --git a/lib/roken/readv.c b/lib/roken/readv.c index 4523b4a48..a15601589 100644 --- a/lib/roken/readv.c +++ b/lib/roken/readv.c @@ -35,7 +35,7 @@ #include "roken.h" -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL readv(int d, const struct iovec *iov, int iovcnt) { ssize_t ret, nb; diff --git a/lib/roken/realloc.c b/lib/roken/realloc.c index 850ab9b3a..8cbc0d63e 100644 --- a/lib/roken/realloc.c +++ b/lib/roken/realloc.c @@ -37,7 +37,7 @@ #include #include "roken.h" -void * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL rk_realloc(void *ptr, size_t size) { if (ptr == NULL) diff --git a/lib/roken/recvmsg.c b/lib/roken/recvmsg.c index 184e9c6a7..aba298b90 100644 --- a/lib/roken/recvmsg.c +++ b/lib/roken/recvmsg.c @@ -35,7 +35,7 @@ #include "roken.h" -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL recvmsg(int s, struct msghdr *msg, int flags) { ssize_t ret, nb; diff --git a/lib/roken/resolve-test.c b/lib/roken/resolve-test.c index 576d6893d..b6572eeba 100644 --- a/lib/roken/resolve-test.c +++ b/lib/roken/resolve-test.c @@ -144,7 +144,7 @@ main(int argc, char **argv) } case rk_ns_t_sshfp : { struct rk_sshfp_record *sshfp = rr->u.sshfp; - int i; + size_t i; printf ("alg %u type %u length %lu data ", sshfp->algorithm, sshfp->type, (unsigned long)sshfp->sshfp_len); @@ -156,7 +156,7 @@ main(int argc, char **argv) } case rk_ns_t_ds : { struct rk_ds_record *ds = rr->u.ds; - int i; + size_t i; printf ("key tag %u alg %u type %u length %u data ", ds->key_tag, ds->algorithm, ds->digest_type, diff --git a/lib/roken/resolve.c b/lib/roken/resolve.c index 419c8d94e..0c0fc1dd9 100644 --- a/lib/roken/resolve.c +++ b/lib/roken/resolve.c @@ -78,7 +78,7 @@ static struct stot{ int _resolve_debug = 0; -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_dns_string_to_type(const char *name) { struct stot *p = stot; @@ -88,7 +88,7 @@ rk_dns_string_to_type(const char *name) return -1; } -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL rk_dns_type_to_string(int type) { struct stot *p = stot; @@ -110,7 +110,7 @@ dns_free_rr(struct rk_resource_record *rr) free(rr); } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_dns_free_data(struct rk_dns_reply *r) { struct rk_resource_record *rr; @@ -584,7 +584,7 @@ dns_lookup_int(const char *domain, int rr_class, int rr_type) return r; } -struct rk_dns_reply * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct rk_dns_reply * ROKEN_LIB_CALL rk_dns_lookup(const char *domain, const char *type_name) { int type; @@ -614,7 +614,7 @@ compare_srv(const void *a, const void *b) #endif /* try to rearrange the srv-records by the algorithm in RFC2782 */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_dns_srv_order(struct rk_dns_reply *r) { struct rk_resource_record **srvs, **ss, **headp; @@ -704,18 +704,18 @@ rk_dns_srv_order(struct rk_dns_reply *r) #else /* NOT defined(HAVE_RES_SEARCH) && defined(HAVE_DN_EXPAND) */ -struct rk_dns_reply * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct rk_dns_reply * ROKEN_LIB_CALL rk_dns_lookup(const char *domain, const char *type_name) { return NULL; } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_dns_free_data(struct rk_dns_reply *r) { } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_dns_srv_order(struct rk_dns_reply *r) { } diff --git a/lib/roken/resolve.h b/lib/roken/resolve.h index 91b2afefe..adec8084b 100644 --- a/lib/roken/resolve.h +++ b/lib/roken/resolve.h @@ -38,9 +38,11 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif @@ -231,15 +233,15 @@ struct rk_dns_reply{ extern "C" { #endif -struct rk_dns_reply* ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct rk_dns_reply* ROKEN_LIB_CALL rk_dns_lookup(const char *, const char *); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_dns_free_data(struct rk_dns_reply *); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_dns_string_to_type(const char *name); -const char *ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL rk_dns_type_to_string(int type); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_dns_srv_order(struct rk_dns_reply*); #ifdef __cplusplus diff --git a/lib/roken/rkpty.c b/lib/roken/rkpty.c index 6043e2b81..0faf66861 100644 --- a/lib/roken/rkpty.c +++ b/lib/roken/rkpty.c @@ -41,7 +41,9 @@ #endif #include #include +#ifdef HAVE_UNISTD_H #include +#endif #ifdef HAVE_PTY_H #include #endif diff --git a/lib/roken/roken-common.h b/lib/roken/roken-common.h index ea7dcaade..f1311641a 100644 --- a/lib/roken/roken-common.h +++ b/lib/roken/roken-common.h @@ -38,9 +38,11 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif @@ -120,6 +122,8 @@ #define O_ACCMODE 003 #endif +#ifndef _WIN32 + #ifndef _PATH_DEV #define _PATH_DEV "/dev/" #endif @@ -144,6 +148,16 @@ #define MAXPATHLEN (1024+4) #endif +#endif /* !_WIN32 */ + +#ifndef PATH_MAX +#define PATH_MAX MAX_PATH +#endif + +#ifndef RETSIGTYPE +#define RETSIGTYPE void +#endif + #ifndef SIG_ERR #define SIG_ERR ((RETSIGTYPE (*)(int))-1) #endif @@ -238,6 +252,11 @@ #define INET6_ADDRSTRLEN 46 #endif +/* + * error codes for inet_ntop/inet_pton + */ +#define EAFNOSUPPORT WSAEAFNOSUPPORT + /* * for shutdown(2) */ @@ -268,183 +287,183 @@ SigAction signal(int iSig, SigAction pAction); /* BSD compatible */ #endif #define simple_execve rk_simple_execve -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execve(const char*, char*const[], char*const[]); #define simple_execve_timed rk_simple_execve_timed -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execve_timed(const char *, char *const[], char *const [], time_t (*)(void *), void *, time_t); #define simple_execvp rk_simple_execvp -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execvp(const char*, char *const[]); #define simple_execvp_timed rk_simple_execvp_timed -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execvp_timed(const char *, char *const[], time_t (*)(void *), void *, time_t); #define simple_execlp rk_simple_execlp -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execlp(const char*, ...); #define simple_execle rk_simple_execle -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execle(const char*, ...); #define wait_for_process rk_wait_for_process -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL wait_for_process(pid_t); #define wait_for_process_timed rk_wait_for_process_timed -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL wait_for_process_timed(pid_t, time_t (*)(void *), void *, time_t); #define pipe_execv rk_pipe_execv -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL pipe_execv(FILE**, FILE**, FILE**, const char*, ...); #define print_version rk_print_version -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL print_version(const char *); #define eread rk_eread -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL eread (int fd, void *buf, size_t nbytes); #define ewrite rk_ewrite -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL ewrite (int fd, const void *buf, size_t nbytes); struct hostent; #define hostent_find_fqdn rk_hostent_find_fqdn -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL hostent_find_fqdn (const struct hostent *); #define esetenv rk_esetenv -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL esetenv(const char *, const char *, int); #define socket_set_address_and_port rk_socket_set_address_and_port -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_address_and_port (struct sockaddr *, const void *, int); #define socket_addr_size rk_socket_addr_size -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL socket_addr_size (const struct sockaddr *); #define socket_set_any rk_socket_set_any -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_any (struct sockaddr *, int); #define socket_sockaddr_size rk_socket_sockaddr_size -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL socket_sockaddr_size (const struct sockaddr *); #define socket_get_address rk_socket_get_address -void * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL socket_get_address (const struct sockaddr *); #define socket_get_port rk_socket_get_port -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL socket_get_port (const struct sockaddr *); #define socket_set_port rk_socket_set_port -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_port (struct sockaddr *, int); #define socket_set_portrange rk_socket_set_portrange -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_portrange (int, int, int); #define socket_set_debug rk_socket_set_debug -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_debug (int); #define socket_set_tos rk_socket_set_tos -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_tos (int, int); #define socket_set_reuseaddr rk_socket_set_reuseaddr -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_reuseaddr (int, int); #define socket_set_ipv6only rk_socket_set_ipv6only -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_ipv6only (int, int); #define vstrcollect rk_vstrcollect -char ** ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL vstrcollect(va_list *ap); #define strcollect rk_strcollect -char ** ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL strcollect(char *first, ...); #define timevalfix rk_timevalfix -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL timevalfix(struct timeval *t1); #define timevaladd rk_timevaladd -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL timevaladd(struct timeval *t1, const struct timeval *t2); #define timevalsub rk_timevalsub -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL timevalsub(struct timeval *t1, const struct timeval *t2); #define pid_file_write rk_pid_file_write -char *ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL pid_file_write (const char *progname); #define pid_file_delete rk_pid_file_delete -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL pid_file_delete (char **); #define read_environment rk_read_environment -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL read_environment(const char *file, char ***env); #define free_environment rk_free_environment -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL free_environment(char **); #define warnerr rk_warnerr -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_warnerr(int doerrno, const char *fmt, va_list ap) __attribute__ ((format (printf, 2, 0))); -void * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL rk_realloc(void *, size_t); struct rk_strpool; -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL rk_strpoolcollect(struct rk_strpool *); -struct rk_strpool * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct rk_strpool * ROKEN_LIB_CALL rk_strpoolprintf(struct rk_strpool *, const char *, ...) __attribute__ ((format (printf, 2, 3))); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_strpoolfree(struct rk_strpool *); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_dumpdata (const char *, const void *, size_t); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_undumpdata (const char *, void **, size_t *); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_xfree (void *); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_cloexec(int); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_cloexec_file(FILE *); int ROKEN_LIB_FUNCTION diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 6fc533c69..33dbdfd11 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -41,6 +41,70 @@ #include #include +#ifndef ROKEN_LIB_FUNCTION +#ifdef _WIN32 +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl +#else +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL +#endif +#endif + +#ifdef HAVE_WINSOCK +/* Declarations for Microsoft Windows */ + +#include + +#define IS_BAD_SOCKET(s) ((s) == INVALID_SOCKET) +#define IS_SOCKET_ERROR(rv) ((rv) == SOCKET_ERROR) +#define SOCK_ERRNO WSAGetLastError() +#define SOCK_IOCTL(s,c,a) ioctlsocket((s),(c),(a)) + +#define ETIMEDOUT WSAETIMEDOUT +#define EWOULDBLOCK WSAEWOULDBLOCK + +#define SOCK_INIT rk_WSAStartup() +#define SOCK_EXIT rk_WSACleanup() +#define NEED_SOCK_INIT 1 + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSAStartup(void); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSACleanup(void); + +#else /* not WinSock */ + +typedef int SOCKET; + +#define closesocket(x) close(x) +#define SOCK_IOCTL(s,c,a) ioctl((s),(c),(a)) +#define IS_BAD_SOCKET(s) ((s) < 0) +#define IS_SOCKET_ERROR(rv) ((rv) < 0) +#define SOCK_ERRNO errno +#define INVALID_SOCKET (-1) + +#define SOCK_INIT (0) +#define SOCK_EXIT (0) +#undef NEED_SOCK_INIT + +#endif + +#ifdef _MSC_VER +/* Declarations for Microsoft Visual C runtime on Windows */ + +#include + +#include + +#define UNREACHABLE(x) x +#define UNUSED_ARGUMENT(x) ((void) x) + +#else + +#define UNREACHABLE(x) +#define UNUSED_ARGUMENT(x) + +#endif + #ifdef _AIX struct ether_addr; struct sockaddr_dl; @@ -133,8 +197,12 @@ struct sockaddr_dl; #endif #ifndef HAVE_SSIZE_T +#ifdef _WIN64 +typedef __int64 ssize_t; +#else typedef int ssize_t; #endif +#endif #include @@ -152,21 +220,21 @@ ROKEN_CPP_START #ifndef HAVE_PUTENV #define putenv rk_putenv -int ROKEN_LIB_FUNCTION putenv(const char *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL putenv(const char *); #endif #if !defined(HAVE_SETENV) || defined(NEED_SETENV_PROTO) #ifndef HAVE_SETENV #define setenv rk_setenv #endif -int ROKEN_LIB_FUNCTION setenv(const char *, const char *, int); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setenv(const char *, const char *, int); #endif #if !defined(HAVE_UNSETENV) || defined(NEED_UNSETENV_PROTO) #ifndef HAVE_UNSETENV #define unsetenv rk_unsetenv #endif -void ROKEN_LIB_FUNCTION unsetenv(const char *); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL unsetenv(const char *); #endif #if !defined(HAVE_GETUSERSHELL) || defined(NEED_GETUSERSHELL_PROTO) @@ -174,15 +242,15 @@ void ROKEN_LIB_FUNCTION unsetenv(const char *); #define getusershell rk_getusershell #define endusershell rk_endusershell #endif -char * ROKEN_LIB_FUNCTION getusershell(void); -void ROKEN_LIB_FUNCTION endusershell(void); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL getusershell(void); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL endusershell(void); #endif #if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO) #ifndef HAVE_SNPRINTF #define snprintf rk_snprintf #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_snprintf (char *, size_t, const char *, ...) __attribute__ ((format (printf, 3, 4))); #endif @@ -191,7 +259,7 @@ int ROKEN_LIB_FUNCTION #ifndef HAVE_VSNPRINTF #define vsnprintf rk_vsnprintf #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_vsnprintf (char *, size_t, const char *, va_list) __attribute__((format (printf, 3, 0))); #endif @@ -200,7 +268,7 @@ int ROKEN_LIB_FUNCTION #ifndef HAVE_ASPRINTF #define asprintf rk_asprintf #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_asprintf (char **, const char *, ...) __attribute__ ((format (printf, 2, 3))); #endif @@ -209,7 +277,7 @@ int ROKEN_LIB_FUNCTION #ifndef HAVE_VASPRINTF #define vasprintf rk_vasprintf #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_vasprintf (char **, const char *, va_list) __attribute__((format (printf, 2, 0))); #endif @@ -218,7 +286,7 @@ int ROKEN_LIB_FUNCTION #ifndef HAVE_ASNPRINTF #define asnprintf rk_asnprintf #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_asnprintf (char **, size_t, const char *, ...) __attribute__ ((format (printf, 3, 4))); #endif @@ -227,83 +295,83 @@ int ROKEN_LIB_FUNCTION #ifndef HAVE_VASNPRINTF #define vasnprintf rk_vasnprintf #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL vasnprintf (char **, size_t, const char *, va_list) __attribute__((format (printf, 3, 0))); #endif #ifndef HAVE_STRDUP #define strdup rk_strdup -char * ROKEN_LIB_FUNCTION strdup(const char *); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strdup(const char *); #endif #if !defined(HAVE_STRNDUP) || defined(NEED_STRNDUP_PROTO) #ifndef HAVE_STRNDUP #define strndup rk_strndup #endif -char * ROKEN_LIB_FUNCTION strndup(const char *, size_t); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strndup(const char *, size_t); #endif #ifndef HAVE_STRLWR #define strlwr rk_strlwr -char * ROKEN_LIB_FUNCTION strlwr(char *); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strlwr(char *); #endif #ifndef HAVE_STRNLEN #define strnlen rk_strnlen -size_t ROKEN_LIB_FUNCTION strnlen(const char*, size_t); +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strnlen(const char*, size_t); #endif #if !defined(HAVE_STRSEP) || defined(NEED_STRSEP_PROTO) #ifndef HAVE_STRSEP #define strsep rk_strsep #endif -char * ROKEN_LIB_FUNCTION strsep(char**, const char*); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strsep(char**, const char*); #endif #if !defined(HAVE_STRSEP_COPY) || defined(NEED_STRSEP_COPY_PROTO) #ifndef HAVE_STRSEP_COPY #define strsep_copy rk_strsep_copy #endif -ssize_t ROKEN_LIB_FUNCTION strsep_copy(const char**, const char*, char*, size_t); +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL strsep_copy(const char**, const char*, char*, size_t); #endif #ifndef HAVE_STRCASECMP #define strcasecmp rk_strcasecmp -int ROKEN_LIB_FUNCTION strcasecmp(const char *, const char *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strcasecmp(const char *, const char *); #endif #ifdef NEED_FCLOSE_PROTO -int ROKEN_LIB_FUNCTION fclose(FILE *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fclose(FILE *); #endif #ifdef NEED_STRTOK_R_PROTO -char * ROKEN_LIB_FUNCTION strtok_r(char *, const char *, char **); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strtok_r(char *, const char *, char **); #endif #ifndef HAVE_STRUPR #define strupr rk_strupr -char * ROKEN_LIB_FUNCTION strupr(char *); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strupr(char *); #endif #ifndef HAVE_STRLCPY #define strlcpy rk_strlcpy -size_t ROKEN_LIB_FUNCTION strlcpy (char *, const char *, size_t); +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcpy (char *, const char *, size_t); #endif #ifndef HAVE_STRLCAT #define strlcat rk_strlcat -size_t ROKEN_LIB_FUNCTION strlcat (char *, const char *, size_t); +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcat (char *, const char *, size_t); #endif #ifndef HAVE_GETDTABLESIZE #define getdtablesize rk_getdtablesize -int ROKEN_LIB_FUNCTION getdtablesize(void); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getdtablesize(void); #endif #if !defined(HAVE_STRERROR) && !defined(strerror) #define strerror rk_strerror -char * ROKEN_LIB_FUNCTION strerror(int); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strerror(int); #endif #if !defined(HAVE_STRERROR) && !defined(strerror) @@ -319,6 +387,7 @@ int ROKEN_LIB_FUNCTION strerror_r(int, char *, size_t); /* This causes a fatal error under Psoriasis */ #ifndef SunOS const char * ROKEN_LIB_FUNCTION hstrerror(int); +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL hstrerror(int); #endif #endif @@ -330,88 +399,88 @@ extern int h_errno; #ifndef HAVE_INET_ATON #define inet_aton rk_inet_aton #endif -int ROKEN_LIB_FUNCTION inet_aton(const char *, struct in_addr *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL inet_aton(const char *, struct in_addr *); #endif #ifndef HAVE_INET_NTOP #define inet_ntop rk_inet_ntop -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL inet_ntop(int af, const void *src, char *dst, size_t size); #endif #ifndef HAVE_INET_PTON #define inet_pton rk_inet_pton -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL inet_pton(int, const char *, void *); #endif #ifndef HAVE_GETCWD #define getcwd rk_getcwd -char* ROKEN_LIB_FUNCTION getcwd(char *, size_t); +ROKEN_LIB_FUNCTION char* ROKEN_LIB_CALL getcwd(char *, size_t); #endif #ifdef HAVE_PWD_H #include -struct passwd * ROKEN_LIB_FUNCTION k_getpwnam (const char *); -struct passwd * ROKEN_LIB_FUNCTION k_getpwuid (uid_t); +ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwnam (const char *); +ROKEN_LIB_FUNCTION struct passwd * ROKEN_LIB_CALL k_getpwuid (uid_t); #endif -const char * ROKEN_LIB_FUNCTION get_default_username (void); +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL get_default_username (void); #ifndef HAVE_SETEUID #define seteuid rk_seteuid -int ROKEN_LIB_FUNCTION seteuid(uid_t); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL seteuid(uid_t); #endif #ifndef HAVE_SETEGID #define setegid rk_setegid -int ROKEN_LIB_FUNCTION setegid(gid_t); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setegid(gid_t); #endif #ifndef HAVE_LSTAT #define lstat rk_lstat -int ROKEN_LIB_FUNCTION lstat(const char *, struct stat *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL lstat(const char *, struct stat *); #endif #if !defined(HAVE_MKSTEMP) || defined(NEED_MKSTEMP_PROTO) #ifndef HAVE_MKSTEMP #define mkstemp rk_mkstemp #endif -int ROKEN_LIB_FUNCTION mkstemp(char *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL mkstemp(char *); #endif #ifndef HAVE_CGETENT #define cgetent rk_cgetent #define cgetstr rk_cgetstr -int ROKEN_LIB_FUNCTION cgetent(char **, char **, const char *); -int ROKEN_LIB_FUNCTION cgetstr(char *, const char *, char **); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetent(char **, char **, const char *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL cgetstr(char *, const char *, char **); #endif #ifndef HAVE_INITGROUPS #define initgroups rk_initgroups -int ROKEN_LIB_FUNCTION initgroups(const char *, gid_t); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL initgroups(const char *, gid_t); #endif #ifndef HAVE_FCHOWN #define fchown rk_fchown -int ROKEN_LIB_FUNCTION fchown(int, uid_t, gid_t); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fchown(int, uid_t, gid_t); #endif #if !defined(HAVE_DAEMON) || defined(NEED_DAEMON_PROTO) #ifndef HAVE_DAEMON #define daemon rk_daemon #endif -int ROKEN_LIB_FUNCTION daemon(int, int); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL daemon(int, int); #endif #ifndef HAVE_CHOWN #define chown rk_chown -int ROKEN_LIB_FUNCTION chown(const char *, uid_t, gid_t); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL chown(const char *, uid_t, gid_t); #endif #ifndef HAVE_RCMD #define rcmd rk_rcmd -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rcmd(char **, unsigned short, const char *, const char *, const char *, int *); #endif @@ -420,13 +489,13 @@ int ROKEN_LIB_FUNCTION #ifndef HAVE_INNETGR #define innetgr rk_innetgr #endif -int ROKEN_LIB_FUNCTION innetgr(const char*, const char*, +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL innetgr(const char*, const char*, const char*, const char*); #endif #ifndef HAVE_IRUSEROK #define iruserok rk_iruserok -int ROKEN_LIB_FUNCTION iruserok(unsigned, int, +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL iruserok(unsigned, int, const char *, const char *); #endif @@ -434,34 +503,34 @@ int ROKEN_LIB_FUNCTION iruserok(unsigned, int, #ifndef HAVE_GETHOSTNAME #define gethostname rk_gethostname #endif -int ROKEN_LIB_FUNCTION gethostname(char *, int); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL gethostname(char *, int); #endif #ifndef HAVE_WRITEV #define writev rk_writev -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL writev(int, const struct iovec *, int); #endif #ifndef HAVE_READV #define readv rk_readv -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL readv(int, const struct iovec *, int); #endif #ifndef HAVE_PIDFILE #define pidfile rk_pidfile -void ROKEN_LIB_FUNCTION pidfile (const char*); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL pidfile (const char*); #endif #ifndef HAVE_BSWAP32 #define bswap32 rk_bswap32 -unsigned int ROKEN_LIB_FUNCTION bswap32(unsigned int); +ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL bswap32(unsigned int); #endif #ifndef HAVE_BSWAP16 #define bswap16 rk_bswap16 -unsigned short ROKEN_LIB_FUNCTION bswap16(unsigned short); +ROKEN_LIB_FUNCTION unsigned short ROKEN_LIB_CALL bswap16(unsigned short); #endif #ifndef HAVE_FLOCK @@ -486,24 +555,37 @@ int rk_flock(int fd, int operation); #define dirfd(x) ((x)->dd_fd) #endif -time_t ROKEN_LIB_FUNCTION tm2time (struct tm, int); +ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL tm2time (struct tm, int); -int ROKEN_LIB_FUNCTION unix_verify_user(char *, char *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unix_verify_user(char *, char *); -int ROKEN_LIB_FUNCTION roken_concat (char *, size_t, ...); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_concat (char *, size_t, ...); -size_t ROKEN_LIB_FUNCTION roken_mconcat (char **, size_t, ...); +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL roken_mconcat (char **, size_t, ...); -int ROKEN_LIB_FUNCTION roken_vconcat (char *, size_t, va_list); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_vconcat (char *, size_t, va_list); -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL roken_vmconcat (char **, size_t, va_list); -ssize_t ROKEN_LIB_FUNCTION net_write (int, const void *, size_t); +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_write (int, const void *, size_t); -ssize_t ROKEN_LIB_FUNCTION net_read (int, void *, size_t); +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_read (int, void *, size_t); -int ROKEN_LIB_FUNCTION issuid(void); +#ifdef SOCKET_IS_NOT_AN_FD + +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_write_s (SOCKET, const void *, size_t); + +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_read_s (SOCKET, void *, size_t); + +#else + +#define net_read_s net_read +#define net_write_s net_write + +#endif + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL issuid(void); #ifndef HAVE_STRUCT_WINSIZE struct winsize { @@ -512,11 +594,11 @@ struct winsize { }; #endif -int ROKEN_LIB_FUNCTION get_window_size(int fd, struct winsize *); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL get_window_size(int fd, struct winsize *); #ifndef HAVE_VSYSLOG #define vsyslog rk_vsyslog -void ROKEN_LIB_FUNCTION vsyslog(int, const char *, va_list); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vsyslog(int, const char *, va_list); #endif #if !HAVE_DECL_OPTARG @@ -531,25 +613,25 @@ extern int opterr; #ifndef HAVE_GETIPNODEBYNAME #define getipnodebyname rk_getipnodebyname -struct hostent * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL getipnodebyname (const char *, int, int, int *); #endif #ifndef HAVE_GETIPNODEBYADDR #define getipnodebyaddr rk_getipnodebyaddr -struct hostent * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL getipnodebyaddr (const void *, size_t, int, int *); #endif #ifndef HAVE_FREEHOSTENT #define freehostent rk_freehostent -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL freehostent (struct hostent *); #endif #ifndef HAVE_COPYHOSTENT #define copyhostent rk_copyhostent -struct hostent * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct hostent * ROKEN_LIB_CALL copyhostent (const struct hostent *); #endif @@ -617,7 +699,7 @@ struct addrinfo { #ifndef HAVE_GETADDRINFO #define getaddrinfo rk_getaddrinfo -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getaddrinfo(const char *, const char *, const struct addrinfo *, @@ -626,7 +708,7 @@ getaddrinfo(const char *, #ifndef HAVE_GETNAMEINFO #define getnameinfo rk_getnameinfo -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, @@ -635,65 +717,65 @@ getnameinfo(const struct sockaddr *, socklen_t, #ifndef HAVE_FREEADDRINFO #define freeaddrinfo rk_freeaddrinfo -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL freeaddrinfo(struct addrinfo *); #endif #ifndef HAVE_GAI_STRERROR #define gai_strerror rk_gai_strerror -const char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL gai_strerror(int); #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getnameinfo_verified(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_getaddrinfo_hostspec(const char *, int, struct addrinfo **); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **); #ifndef HAVE_STRFTIME #define strftime rk_strftime -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strftime (char *, size_t, const char *, const struct tm *); #endif #ifndef HAVE_STRPTIME #define strptime rk_strptime -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strptime (const char *, const char *, struct tm *); #endif #ifndef HAVE_EMALLOC #define emalloc rk_emalloc -void * ROKEN_LIB_FUNCTION emalloc (size_t); +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL emalloc (size_t); #endif #ifndef HAVE_ECALLOC #define ecalloc rk_ecalloc -void * ROKEN_LIB_FUNCTION ecalloc(size_t, size_t); +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL ecalloc(size_t, size_t); #endif #ifndef HAVE_EREALLOC #define erealloc rk_erealloc -void * ROKEN_LIB_FUNCTION erealloc (void *, size_t); +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL erealloc (void *, size_t); #endif #ifndef HAVE_ESTRDUP #define estrdup rk_estrdup -char * ROKEN_LIB_FUNCTION estrdup (const char *); +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL estrdup (const char *); #endif /* * kludges and such */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_gethostby_setup(const char*, const char*); -struct hostent* ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL roken_gethostbyname(const char*); -struct hostent* ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL roken_gethostbyaddr(const void*, size_t, int); #ifdef GETSERVBYNAME_PROTO_COMPATIBLE @@ -716,24 +798,24 @@ roken_gethostbyaddr(const void*, size_t, int); #ifndef HAVE_SETPROGNAME #define setprogname rk_setprogname -void ROKEN_LIB_FUNCTION setprogname(const char *); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL setprogname(const char *); #endif #ifndef HAVE_GETPROGNAME #define getprogname rk_getprogname -const char * ROKEN_LIB_FUNCTION getprogname(void); +ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL getprogname(void); #endif #if !defined(HAVE_SETPROGNAME) && !defined(HAVE_GETPROGNAME) && !HAVE_DECL___PROGNAME extern const char *__progname; #endif -void ROKEN_LIB_FUNCTION mini_inetd_addrinfo (struct addrinfo*); -void ROKEN_LIB_FUNCTION mini_inetd (int); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL mini_inetd_addrinfo (struct addrinfo*); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL mini_inetd (int); #ifndef HAVE_LOCALTIME_R #define localtime_r rk_localtime_r -struct tm * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct tm * ROKEN_LIB_CALL localtime_r(const time_t *, struct tm *); #endif @@ -741,7 +823,7 @@ localtime_r(const time_t *, struct tm *); #ifndef HAVE_STRSVIS #define strsvis rk_strsvis #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strsvis(char *, const char *, int, const char *); #endif @@ -749,7 +831,7 @@ strsvis(char *, const char *, int, const char *); #ifndef HAVE_STRUNVIS #define strunvis rk_strunvis #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strunvis(char *, const char *); #endif @@ -757,7 +839,7 @@ strunvis(char *, const char *); #ifndef HAVE_STRVIS #define strvis rk_strvis #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strvis(char *, const char *, int); #endif @@ -765,7 +847,7 @@ strvis(char *, const char *, int); #ifndef HAVE_STRVISX #define strvisx rk_strvisx #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strvisx(char *, const char *, size_t, int); #endif @@ -773,7 +855,7 @@ strvisx(char *, const char *, size_t, int); #ifndef HAVE_SVIS #define svis rk_svis #endif -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL svis(char *, int, int, int, const char *); #endif @@ -781,7 +863,7 @@ svis(char *, int, int, int, const char *); #ifndef HAVE_UNVIS #define unvis rk_unvis #endif -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unvis(char *, int, int *, int); #endif @@ -789,19 +871,19 @@ unvis(char *, int, int *, int); #ifndef HAVE_VIS #define vis rk_vis #endif -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL vis(char *, int, int, int); #endif #if !defined(HAVE_CLOSEFROM) #define closefrom rk_closefrom -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL closefrom(int); #endif #if !defined(HAVE_TIMEGM) #define timegm rk_timegm -time_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL rk_timegm(struct tm *tm); #endif diff --git a/lib/roken/roken_gethostby.c b/lib/roken/roken_gethostby.c index d87a49a04..c99596c53 100644 --- a/lib/roken/roken_gethostby.c +++ b/lib/roken/roken_gethostby.c @@ -104,7 +104,7 @@ split_spec(const char *spec, char **host, int *port, char **path, int def_port) } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_gethostby_setup(const char *proxy_spec, const char *dns_spec) { char *proxy_host = NULL; @@ -207,7 +207,7 @@ roken_gethostby(const char *hostname) } } -struct hostent* +ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL roken_gethostbyname(const char *hostname) { struct hostent *he; @@ -217,7 +217,7 @@ roken_gethostbyname(const char *hostname) return roken_gethostby(hostname); } -struct hostent* ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct hostent* ROKEN_LIB_CALL roken_gethostbyaddr(const void *addr, size_t len, int type) { struct in_addr a; diff --git a/lib/roken/rtbl.c b/lib/roken/rtbl.c index 7d11a487c..fe0fde662 100644 --- a/lib/roken/rtbl.c +++ b/lib/roken/rtbl.c @@ -59,19 +59,19 @@ struct rtbl_data { char *column_separator; }; -rtbl_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION rtbl_t ROKEN_LIB_CALL rtbl_create (void) { return calloc (1, sizeof (struct rtbl_data)); } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rtbl_set_flags (rtbl_t table, unsigned int flags) { table->flags = flags; } -unsigned int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL rtbl_get_flags (rtbl_t table) { return table->flags; @@ -80,7 +80,7 @@ rtbl_get_flags (rtbl_t table) static struct column_data * rtbl_get_column_by_id (rtbl_t table, unsigned int id) { - int i; + size_t i; for(i = 0; i < table->num_columns; i++) if(table->columns[i]->column_id == id) return table->columns[i]; @@ -90,17 +90,17 @@ rtbl_get_column_by_id (rtbl_t table, unsigned int id) static struct column_data * rtbl_get_column (rtbl_t table, const char *column) { - int i; + size_t i; for(i = 0; i < table->num_columns; i++) if(strcmp(table->columns[i]->header, column) == 0) return table->columns[i]; return NULL; } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rtbl_destroy (rtbl_t table) { - int i, j; + size_t i, j; for (i = 0; i < table->num_columns; i++) { struct column_data *c = table->columns[i]; @@ -119,7 +119,7 @@ rtbl_destroy (rtbl_t table) free (table); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_by_id (rtbl_t table, unsigned int id, const char *header, unsigned int flags) { @@ -148,13 +148,13 @@ rtbl_add_column_by_id (rtbl_t table, unsigned int id, return 0; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column (rtbl_t table, const char *header, unsigned int flags) { return rtbl_add_column_by_id(table, 0, header, flags); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_new_row(rtbl_t table) { size_t max_rows = 0; @@ -183,18 +183,18 @@ rtbl_new_row(rtbl_t table) static void column_compute_width (rtbl_t table, struct column_data *column) { - int i; + size_t i; if(table->flags & RTBL_HEADER_STYLE_NONE) column->width = 0; else column->width = strlen (column->header); for (i = 0; i < column->num_rows; i++) - column->width = max (column->width, strlen (column->rows[i].data)); + column->width = max (column->width, (int) strlen (column->rows[i].data)); } /* DEPRECATED */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_set_prefix (rtbl_t table, const char *prefix) { if (table->column_prefix) @@ -205,7 +205,7 @@ rtbl_set_prefix (rtbl_t table, const char *prefix) return 0; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_set_separator (rtbl_t table, const char *separator) { if (table->column_separator) @@ -216,7 +216,7 @@ rtbl_set_separator (rtbl_t table, const char *separator) return 0; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_set_column_prefix (rtbl_t table, const char *column, const char *prefix) { @@ -232,7 +232,7 @@ rtbl_set_column_prefix (rtbl_t table, const char *column, return 0; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_set_column_affix_by_id(rtbl_t table, unsigned int id, const char *prefix, const char *suffix) { @@ -301,7 +301,7 @@ add_column_entry (struct column_data *c, const char *data) return 0; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_entry_by_id (rtbl_t table, unsigned int id, const char *data) { struct column_data *c = rtbl_get_column_by_id (table, id); @@ -312,7 +312,7 @@ rtbl_add_column_entry_by_id (rtbl_t table, unsigned int id, const char *data) return add_column_entry(c, data); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_entryv_by_id (rtbl_t table, unsigned int id, const char *fmt, ...) { @@ -330,7 +330,7 @@ rtbl_add_column_entryv_by_id (rtbl_t table, unsigned int id, return ret; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_entry (rtbl_t table, const char *column, const char *data) { struct column_data *c = rtbl_get_column (table, column); @@ -341,7 +341,7 @@ rtbl_add_column_entry (rtbl_t table, const char *column, const char *data) return add_column_entry(c, data); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_entryv (rtbl_t table, const char *column, const char *fmt, ...) { va_list ap; @@ -359,10 +359,10 @@ rtbl_add_column_entryv (rtbl_t table, const char *column, const char *fmt, ...) } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_format (rtbl_t table, FILE * f) { - int i, j; + size_t i, j; for (i = 0; i < table->num_columns; i++) column_compute_width (table, table->columns[i]); diff --git a/lib/roken/rtbl.h b/lib/roken/rtbl.h index 60bbc9f87..549d3a8aa 100644 --- a/lib/roken/rtbl.h +++ b/lib/roken/rtbl.h @@ -37,9 +37,11 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif @@ -60,55 +62,55 @@ typedef struct rtbl_data *rtbl_t; /* flags */ #define RTBL_HEADER_STYLE_NONE 1 -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column (rtbl_t, const char*, unsigned int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_by_id (rtbl_t, unsigned int, const char*, unsigned int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_entryv_by_id (rtbl_t table, unsigned int id, const char *fmt, ...) __attribute__ ((format (printf, 3, 0))); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_entry (rtbl_t, const char*, const char*); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_entryv (rtbl_t, const char*, const char*, ...) __attribute__ ((format (printf, 3, 0))); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_add_column_entry_by_id (rtbl_t, unsigned int, const char*); -rtbl_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION rtbl_t ROKEN_LIB_CALL rtbl_create (void); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rtbl_destroy (rtbl_t); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_format (rtbl_t, FILE*); -unsigned int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL rtbl_get_flags (rtbl_t); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_new_row (rtbl_t); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_set_column_affix_by_id (rtbl_t, unsigned int, const char*, const char*); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_set_column_prefix (rtbl_t, const char*, const char*); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rtbl_set_flags (rtbl_t, unsigned int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_set_prefix (rtbl_t, const char*); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rtbl_set_separator (rtbl_t, const char*); #ifdef __cplusplus diff --git a/lib/roken/sendmsg.c b/lib/roken/sendmsg.c index 2c087bd1b..d2e8b00ff 100644 --- a/lib/roken/sendmsg.c +++ b/lib/roken/sendmsg.c @@ -35,8 +35,8 @@ #include "roken.h" -ssize_t ROKEN_LIB_FUNCTION -sendmsg(int s, const struct msghdr *msg, int flags) +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL +sendmsg(SOCKET s, const struct msghdr *msg, int flags) { ssize_t ret; size_t tot = 0; diff --git a/lib/roken/sendmsg_w32.c b/lib/roken/sendmsg_w32.c new file mode 100644 index 000000000..19edf6931 --- /dev/null +++ b/lib/roken/sendmsg_w32.c @@ -0,0 +1,86 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * - Neither the name of Secure Endpoints Inc. 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +/** + * Implementation of sendmsg() for WIN32 + * + * We are using a contrived definition of msghdr which actually uses + * an array of ::_WSABUF structures instead of ::iovec . This allows + * us to call WSASend directly using the given ::msghdr instead of + * having to allocate another array of ::_WSABUF and copying data for + * each call. + * + * Limitations: + * + * - msg->msg_name is ignored. So is msg->control. + * - WSASend() only supports ::MSG_DONTROUTE, ::MSG_OOB and + * ::MSG_PARTIAL. + * + * @param[in] s The socket to use. + * @param[in] msg The message + * @param[in] flags Flags. A combination of ::MSG_DONTROUTE, + * ::MSG_OOB and ::MSG_PARTIAL + * + * @return The number of bytes sent, on success. Or -1 on error. + */ +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL +sendmsg_w32(SOCKET s, const struct msghdr * msg, int flags) +{ + int srv; + DWORD num_bytes_sent = 0; + + /* TODO: For _WIN32_WINNT >= 0x0600 we can use WSASendMsg using + WSAMSG which is a much more direct analogue to sendmsg(). */ + + srv = WSASend(s, msg->msg_iov, msg->msg_iovlen, + &num_bytes_sent, flags, NULL, NULL); + + if (srv == 0) + return (int) num_bytes_sent; + + /* srv == SOCKET_ERROR and WSAGetLastError() == WSA_IO_PENDING + indicates that a non-blocking transfer has been scheduled. + We'll have to check for that if we ever support non-blocking + I/O. */ + + return -1; +} + diff --git a/lib/roken/setegid.c b/lib/roken/setegid.c index b4b3b036a..d9aef122d 100644 --- a/lib/roken/setegid.c +++ b/lib/roken/setegid.c @@ -39,7 +39,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setegid(gid_t egid) { #ifdef HAVE_SETREGID diff --git a/lib/roken/setenv.c b/lib/roken/setenv.c index b6d0c0a6a..bce9bd752 100644 --- a/lib/roken/setenv.c +++ b/lib/roken/setenv.c @@ -44,7 +44,7 @@ * anyway. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setenv(const char *var, const char *val, int rewrite) { char *t; diff --git a/lib/roken/seteuid.c b/lib/roken/seteuid.c index cff8f24d8..2d8c14829 100644 --- a/lib/roken/seteuid.c +++ b/lib/roken/seteuid.c @@ -39,7 +39,7 @@ #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL seteuid(uid_t euid) { #ifdef HAVE_SETREUID diff --git a/lib/roken/setprogname.c b/lib/roken/setprogname.c index 225e6ae09..115af77b8 100644 --- a/lib/roken/setprogname.c +++ b/lib/roken/setprogname.c @@ -40,7 +40,7 @@ extern const char *__progname; #endif #ifndef HAVE_SETPROGNAME -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL setprogname(const char *argv0) { #ifndef HAVE___PROGNAME diff --git a/lib/roken/signal.c b/lib/roken/signal.c index 19a484543..284f1e792 100644 --- a/lib/roken/signal.c +++ b/lib/roken/signal.c @@ -47,7 +47,7 @@ * Do we need any extra hacks for SIGCLD and/or SIGCHLD? */ -SigAction ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION SigAction ROKEN_LIB_CALL signal(int iSig, SigAction pAction) { struct sigaction saNew, saOld; diff --git a/lib/roken/simple_exec.c b/lib/roken/simple_exec.c index 86dde1bad..02d62d770 100644 --- a/lib/roken/simple_exec.c +++ b/lib/roken/simple_exec.c @@ -78,7 +78,7 @@ sigtimeout(int sig) SIGRETURN(0); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL wait_for_process_timed(pid_t pid, time_t (*func)(void *), void *ptr, time_t timeout) { @@ -134,13 +134,13 @@ wait_for_process_timed(pid_t pid, time_t (*func)(void *), return ret; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL wait_for_process(pid_t pid) { return wait_for_process_timed(pid, NULL, NULL, 0); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL pipe_execv(FILE **stdin_fd, FILE **stdout_fd, FILE **stderr_fd, const char *file, ...) { @@ -229,7 +229,7 @@ pipe_execv(FILE **stdin_fd, FILE **stdout_fd, FILE **stderr_fd, return pid; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execvp_timed(const char *file, char *const args[], time_t (*func)(void *), void *ptr, time_t timeout) { @@ -245,14 +245,14 @@ simple_execvp_timed(const char *file, char *const args[], } } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execvp(const char *file, char *const args[]) { return simple_execvp_timed(file, args, NULL, NULL, 0); } /* gee, I'd like a execvpe */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execve_timed(const char *file, char *const args[], char *const envp[], time_t (*func)(void *), void *ptr, time_t timeout) { @@ -268,13 +268,13 @@ simple_execve_timed(const char *file, char *const args[], char *const envp[], } } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execve(const char *file, char *const args[], char *const envp[]) { return simple_execve_timed(file, args, envp, NULL, NULL, 0); } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execlp(const char *file, ...) { va_list ap; @@ -291,7 +291,7 @@ simple_execlp(const char *file, ...) return ret; } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execle(const char *file, ... /* ,char *const envp[] */) { va_list ap; diff --git a/lib/roken/simple_exec_w32.c b/lib/roken/simple_exec_w32.c new file mode 100644 index 000000000..1356018f1 --- /dev/null +++ b/lib/roken/simple_exec_w32.c @@ -0,0 +1,430 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +RCSID("$Id$"); +#endif + +#include +#include + +#ifndef _WIN32 +#error This implementation is Windows specific. +#endif + +/** + * wait_for_process_timed waits for a process to terminate or until a + * specified timeout occurs. + * + * @param[in] pid Process id for the monitored process + + * @param[in] func Timeout callback function. When the wait times out, + * the callback function is called. THe possible return values + * from the callback function are: + * + * - ((time_t) -2) Exit loop without killing child and return -4. + * - ((time_t) -1) Kill child with SIGTERM and wait for child to exit. + * - 0 Don't timeout again + * - n Seconds to next timeout + * + * @param[in] ptr Optional parameter for func() + * + * @param[in] timeout Seconds to first timeout. + * + * @retval -1 Unspecified system error + * @retval -2 Fork failure (not applicable for _WIN32 targets) + * @retval -3 waitpid errors + * @retval -4 exec timeout + * @retval 0- Return value from subprocess + * @retval 126 The program coudln't be found + * @retval 128- The signal that killed the subprocess +128. + */ +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +wait_for_process_timed(pid_t pid, time_t (*func)(void *), + void *ptr, time_t timeout) +{ + HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid); + DWORD wrv = 0; + DWORD dtimeout; + int rv = 0; + + if (hProcess == NULL) + return -4; + + dtimeout = (DWORD) ((timeout == 0)? INFINITE: timeout * 1000); + + do { + wrv = WaitForSingleObject(hProcess, dtimeout); + + if (wrv == WAIT_OBJECT_0) { + + DWORD prv = 0; + + GetExitCodeProcess(hProcess, &prv); + rv = (int) prv; + break; + + } else if (wrv == WAIT_TIMEOUT) { + + if (func == NULL) + continue; + + timeout = (*func)(ptr); + + if (timeout == (time_t)-1) { + + if (TerminateProcess(hProcess, 128 + 9)) { + dtimeout = INFINITE; + continue; + } + rv = -1; + break; + + } else if (timeout == (time_t) -2) { + + rv = -4; + break; + + } else { + + dtimeout = (DWORD) ((timeout == 0)? INFINITE: timeout * 1000); + continue; + + } + + } else { + + rv = -1; + break; + + } + + } while(TRUE); + + CloseHandle(hProcess); + + return rv; +} + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +wait_for_process(pid_t pid) +{ + return wait_for_process_timed(pid, NULL, NULL, 0); +} + +static char * +collect_commandline(const char * fn, va_list * ap) +{ + size_t len = 0; + size_t alloc_len = 0; + const char * s; + char * cmd = NULL; + + for (s = fn; s; s = (char *) va_arg(*ap, char *)) { + size_t cmp_len; + int need_quote = FALSE; + + if (FAILED(StringCchLength(s, MAX_PATH, &cmp_len))) { + if (cmd) + free(cmd); + return NULL; + } + + if (cmp_len == 0) + continue; + + if (strchr(s, ' ') && /* need to quote any component that + has embedded spaces, but not if + they are already quoted. */ + s[0] != '"' && + s[cmp_len - 1] != '"') { + need_quote = TRUE; + cmp_len += 2 * sizeof(char); + } + + if (s != fn) + cmp_len += 1 * sizeof(char); + + if (alloc_len < len + cmp_len + 1) { + char * nc; + + alloc_len += ((len + cmp_len - alloc_len) / MAX_PATH + 1) * MAX_PATH; + nc = (char *) realloc(cmd, alloc_len * sizeof(char)); + if (nc == NULL) { + if (cmd) + free(cmd); + return NULL; + } + } + + if (cmd == NULL) + return NULL; + + if (s != fn) + cmd[len++] = ' '; + + if (need_quote) { + StringCchPrintf(cmd + len, alloc_len - len, "\"%s\"", s); + } else { + StringCchCopy(cmd + len, alloc_len - len, s); + } + + len += cmp_len; + } + + return cmd; +} + +ROKEN_LIB_FUNCTION pid_t ROKEN_LIB_CALL +pipe_execv(FILE **stdin_fd, FILE **stdout_fd, FILE **stderr_fd, + const char *file, ...) +{ + HANDLE hOut_r = NULL; + HANDLE hOut_w = NULL; + HANDLE hIn_r = NULL; + HANDLE hIn_w = NULL; + HANDLE hErr_r = NULL; + HANDLE hErr_w = NULL; + + SECURITY_ATTRIBUTES sa; + STARTUPINFO si; + PROCESS_INFORMATION pi; + + char * commandline = NULL; + + pid_t rv = (pid_t) -1; + + { + va_list ap; + + va_start(ap, file); + commandline = collect_commandline(file, &ap); + + if (commandline == NULL) + return rv; + } + + ZeroMemory(&si, sizeof(si)); + ZeroMemory(&pi, sizeof(pi)); + ZeroMemory(&sa, sizeof(sa)); + + pi.hProcess = NULL; + pi.hThread = NULL; + + sa.nLength = sizeof(sa); + sa.bInheritHandle = TRUE; + sa.lpSecurityDescriptor = NULL; + + if ((stdout_fd && !CreatePipe(&hOut_r, &hOut_w, &sa, 0 /* Use default */)) || + + (stdin_fd && !CreatePipe(&hIn_r, &hIn_w, &sa, 0)) || + + (stderr_fd && !CreatePipe(&hErr_r, &hErr_w, &sa, 0)) || + + (!stdout_fd && (hOut_w = CreateFile("CON", GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, + &sa, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) || + + (!stdin_fd && (hIn_r = CreateFile("CON",GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, + &sa, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) || + + (!stderr_fd && (hErr_w = CreateFile("CON", GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, + &sa, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)) + + goto _exit; + + /* We don't want the child processes inheriting these */ + if (hOut_r) + SetHandleInformation(hOut_r, HANDLE_FLAG_INHERIT, FALSE); + + if (hIn_w) + SetHandleInformation(hIn_w, HANDLE_FLAG_INHERIT, FALSE); + + if (hErr_r) + SetHandleInformation(hErr_r, HANDLE_FLAG_INHERIT, FALSE); + + si.cb = sizeof(si); + si.lpReserved = NULL; + si.lpDesktop = NULL; + si.lpTitle = NULL; + si.dwFlags = STARTF_USESTDHANDLES; + si.hStdInput = hIn_r; + si.hStdOutput = hOut_w; + si.hStdError = hErr_w; + + if (!CreateProcess(file, commandline, NULL, NULL, + TRUE, /* bInheritHandles */ + CREATE_NO_WINDOW, /* dwCreationFlags */ + NULL, /* lpEnvironment */ + NULL, /* lpCurrentDirectory */ + &si, + &pi)) { + + rv = (pid_t) (GetLastError() == ERROR_FILE_NOT_FOUND)? 127 : -1; + goto _exit; + } + + if (stdin_fd) { + *stdin_fd = _fdopen(_open_osfhandle((intptr_t) hIn_w, 0), "wb"); + if (*stdin_fd) + hIn_w = NULL; + } + + if (stdout_fd) { + *stdout_fd = _fdopen(_open_osfhandle((intptr_t) hOut_r, _O_RDONLY), "rb"); + if (*stdout_fd) + hOut_r = NULL; + } + + if (stderr_fd) { + *stderr_fd = _fdopen(_open_osfhandle((intptr_t) hErr_r, _O_RDONLY), "rb"); + if (*stderr_fd) + hErr_r = NULL; + } + + rv = (pid_t) pi.dwProcessId; + + _exit: + + if (pi.hProcess) CloseHandle(pi.hProcess); + + if (pi.hThread) CloseHandle(pi.hThread); + + if (hIn_r) CloseHandle(hIn_r); + + if (hIn_w) CloseHandle(hIn_w); + + if (hOut_r) CloseHandle(hOut_r); + + if (hOut_w) CloseHandle(hOut_w); + + if (hErr_r) CloseHandle(hErr_r); + + if (hErr_w) CloseHandle(hErr_w); + + return rv; +} + + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +simple_execvp_timed(const char *file, char *const args[], + time_t (*func)(void *), void *ptr, time_t timeout) +{ + intptr_t hp; + int rv; + + hp = spawnvp(_P_NOWAIT, file, args); + + if (hp == -1) + return (errno == ENOENT)? 127: 126; + else if (hp == 0) + return 0; + + rv = wait_for_process_timed(GetProcessId((HANDLE) hp), func, ptr, timeout); + + CloseHandle((HANDLE) hp); + + return rv; +} + + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +simple_execvp(const char *file, char *const args[]) +{ + return simple_execvp_timed(file, args, NULL, NULL, 0); +} + + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +simple_execve_timed(const char *file, char *const args[], char *const envp[], + time_t (*func)(void *), void *ptr, time_t timeout) +{ + intptr_t hp; + int rv; + + hp = spawnve(_P_NOWAIT, file, args, envp); + + if (hp == -1) + return (errno == ENOENT)? 127: 126; + else if (hp == 0) + return 0; + + rv = wait_for_process_timed(GetProcessId((HANDLE) hp), func, ptr, timeout); + + CloseHandle((HANDLE) hp); + + return rv; +} + + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +simple_execve(const char *file, char *const args[], char *const envp[]) +{ + return simple_execve_timed(file, args, envp, NULL, NULL, 0); +} + + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +simple_execlp(const char *file, ...) +{ + va_list ap; + char **argv; + int ret; + + va_start(ap, file); + argv = vstrcollect(&ap); + va_end(ap); + if(argv == NULL) + return -1; + ret = simple_execvp(file, argv); + free(argv); + return ret; +} + + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +simple_execle(const char *file, ... /* ,char *const envp[] */) +{ + va_list ap; + char **argv; + char *const* envp; + int ret; + + va_start(ap, file); + argv = vstrcollect(&ap); + envp = va_arg(ap, char **); + va_end(ap); + if(argv == NULL) + return -1; + ret = simple_execve(file, argv, envp); + free(argv); + return ret; +} diff --git a/lib/roken/sleep.c b/lib/roken/sleep.c new file mode 100644 index 000000000..c19439c53 --- /dev/null +++ b/lib/roken/sleep.c @@ -0,0 +1,47 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#ifndef _WIN32 +#error Only implemented on Windows +#endif + +ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL +sleep(unsigned int seconds) +{ + SleepEx(1000 * (DWORD) seconds, FALSE); + return 0; +} diff --git a/lib/roken/snprintf.c b/lib/roken/snprintf.c index 6beab4fe3..51dca3c9d 100644 --- a/lib/roken/snprintf.c +++ b/lib/roken/snprintf.c @@ -40,6 +40,10 @@ #include "roken.h" #include +#if defined(TEST_SNPRINTF) +#include "snprintf-test.h" +#endif /* TEST_SNPRINTF */ + enum format_flags { minus_flag = 1, plus_flag = 2, @@ -119,10 +123,10 @@ typedef long longest; -static int +static size_t pad(struct snprintf_state *state, int width, char c) { - int len = 0; + size_t len = 0; while(width-- > 0){ (*state->append_char)(state, c); ++len; @@ -252,14 +256,14 @@ append_number(struct snprintf_state *state, * return length */ -static int +static size_t append_string (struct snprintf_state *state, const unsigned char *arg, int width, int prec, int flags) { - int len = 0; + size_t len = 0; if(arg == NULL) arg = (const unsigned char*)"(null)"; @@ -344,12 +348,12 @@ else \ * zyxprintf - return length, as snprintf */ -static int +static size_t xyzprintf (struct snprintf_state *state, const char *char_format, va_list ap) { const unsigned char *format = (const unsigned char *)char_format; unsigned char c; - int len = 0; + size_t len = 0; while((c = *format++)) { if (c == '%') { @@ -531,7 +535,7 @@ xyzprintf (struct snprintf_state *state, const char *char_format, va_list ap) } #if !defined(HAVE_SNPRINTF) || defined(TEST_SNPRINTF) -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_snprintf (char *str, size_t sz, const char *format, ...) { va_list args; @@ -564,7 +568,7 @@ rk_snprintf (char *str, size_t sz, const char *format, ...) #endif #if !defined(HAVE_ASPRINTF) || defined(TEST_SNPRINTF) -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_asprintf (char **ret, const char *format, ...) { va_list args; @@ -596,7 +600,7 @@ rk_asprintf (char **ret, const char *format, ...) #endif #if !defined(HAVE_ASNPRINTF) || defined(TEST_SNPRINTF) -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_asnprintf (char **ret, size_t max_sz, const char *format, ...) { va_list args; @@ -626,7 +630,7 @@ rk_asnprintf (char **ret, size_t max_sz, const char *format, ...) #endif #if !defined(HAVE_VASPRINTF) || defined(TEST_SNPRINTF) -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_vasprintf (char **ret, const char *format, va_list args) { return vasnprintf (ret, 0, format, args); @@ -635,10 +639,10 @@ rk_vasprintf (char **ret, const char *format, va_list args) #if !defined(HAVE_VASNPRINTF) || defined(TEST_SNPRINTF) -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args) { - int st; + size_t st; struct snprintf_state state; state.max_sz = max_sz; @@ -674,7 +678,7 @@ rk_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args) #endif #if !defined(HAVE_VSNPRINTF) || defined(TEST_SNPRINTF) -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_vsnprintf (char *str, size_t sz, const char *format, va_list args) { struct snprintf_state state; diff --git a/lib/roken/socket.c b/lib/roken/socket.c index ab1b7ff34..8a83c85b8 100644 --- a/lib/roken/socket.c +++ b/lib/roken/socket.c @@ -40,7 +40,7 @@ * Set `sa' to the unitialized address of address family `af' */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_any (struct sockaddr *sa, int af) { switch (af) { @@ -74,7 +74,7 @@ socket_set_any (struct sockaddr *sa, int af) * set `sa' to (`ptr', `port') */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_address_and_port (struct sockaddr *sa, const void *ptr, int port) { switch (sa->sa_family) { @@ -108,7 +108,7 @@ socket_set_address_and_port (struct sockaddr *sa, const void *ptr, int port) * Return the size of an address of the type in `sa' */ -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL socket_addr_size (const struct sockaddr *sa) { switch (sa->sa_family) { @@ -120,7 +120,7 @@ socket_addr_size (const struct sockaddr *sa) #endif default : errx (1, "unknown address family %d", sa->sa_family); - break; + UNREACHABLE(return 0); } } @@ -128,7 +128,7 @@ socket_addr_size (const struct sockaddr *sa) * Return the size of a `struct sockaddr' in `sa'. */ -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL socket_sockaddr_size (const struct sockaddr *sa) { switch (sa->sa_family) { @@ -140,7 +140,7 @@ socket_sockaddr_size (const struct sockaddr *sa) #endif default : errx (1, "unknown address family %d", sa->sa_family); - break; + UNREACHABLE(return 0); } } @@ -148,7 +148,7 @@ socket_sockaddr_size (const struct sockaddr *sa) * Return the binary address of `sa'. */ -void * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL socket_get_address (const struct sockaddr *sa) { switch (sa->sa_family) { @@ -164,7 +164,7 @@ socket_get_address (const struct sockaddr *sa) #endif default : errx (1, "unknown address family %d", sa->sa_family); - break; + UNREACHABLE(return NULL); } } @@ -172,7 +172,7 @@ socket_get_address (const struct sockaddr *sa) * Return the port number from `sa'. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL socket_get_port (const struct sockaddr *sa) { switch (sa->sa_family) { @@ -188,7 +188,7 @@ socket_get_port (const struct sockaddr *sa) #endif default : errx (1, "unknown address family %d", sa->sa_family); - break; + UNREACHABLE(return 0); } } @@ -196,7 +196,7 @@ socket_get_port (const struct sockaddr *sa) * Set the port in `sa' to `port'. */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_port (struct sockaddr *sa, int port) { switch (sa->sa_family) { @@ -221,8 +221,8 @@ socket_set_port (struct sockaddr *sa, int port) /* * Set the range of ports to use when binding with port = 0. */ -void ROKEN_LIB_FUNCTION -socket_set_portrange (int sock, int restr, int af) +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +socket_set_portrange (SOCKET sock, int restr, int af) { #if defined(IP_PORTRANGE) if (af == AF_INET) { @@ -247,8 +247,8 @@ socket_set_portrange (int sock, int restr, int af) * Enable debug on `sock'. */ -void ROKEN_LIB_FUNCTION -socket_set_debug (int sock) +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +socket_set_debug (SOCKET sock) { #if defined(SO_DEBUG) && defined(HAVE_SETSOCKOPT) int on = 1; @@ -262,8 +262,8 @@ socket_set_debug (int sock) * Set the type-of-service of `sock' to `tos'. */ -void ROKEN_LIB_FUNCTION -socket_set_tos (int sock, int tos) +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +socket_set_tos (SOCKET sock, int tos) { #if defined(IP_TOS) && defined(HAVE_SETSOCKOPT) if (setsockopt (sock, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof (int)) < 0) @@ -276,8 +276,8 @@ socket_set_tos (int sock, int tos) * set the reuse of addresses on `sock' to `val'. */ -void ROKEN_LIB_FUNCTION -socket_set_reuseaddr (int sock, int val) +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +socket_set_reuseaddr (SOCKET sock, int val) { #if defined(SO_REUSEADDR) && defined(HAVE_SETSOCKOPT) if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&val, @@ -290,10 +290,21 @@ socket_set_reuseaddr (int sock, int val) * Set the that the `sock' should bind to only IPv6 addresses. */ -void ROKEN_LIB_FUNCTION -socket_set_ipv6only (int sock, int val) +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +socket_set_ipv6only (SOCKET sock, int val) { #if defined(IPV6_V6ONLY) && defined(HAVE_SETSOCKOPT) setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&val, sizeof(val)); #endif } + + +#ifdef SOCKET_IS_NOT_AN_FD + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +fd_from_socket(SOCKET sock, int flags) +{ + return _open_osfhandle((intptr_t) sock, flags); +} + +#endif diff --git a/lib/roken/sockstartup_w32.c b/lib/roken/sockstartup_w32.c new file mode 100644 index 000000000..675d5aad7 --- /dev/null +++ b/lib/roken/sockstartup_w32.c @@ -0,0 +1,77 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#ifndef _WIN32 +#error Only implemented for Windows +#endif + +volatile LONG _startup_count = 0; + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +rk_WSAStartup(void) +{ + WSADATA wsad; + + if (!WSAStartup( MAKEWORD(2, 2), &wsad )) { + if (wsad.wVersion != MAKEWORD(2, 2)) { + /* huh? We can't use 2.2? */ + WSACleanup(); + return -1; + } + + InterlockedIncrement(&_startup_count); + return 0; + } + + return -1; +} + + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +rk_WSACleanup(void) +{ + LONG l; + + if ((l = InterlockedDecrement(&_startup_count)) < 0) { + l = InterlockedIncrement(&_startup_count) - 1; + } + + if (l >= 0) { + return WSACleanup(); + } + return -1; +} diff --git a/lib/roken/strcasecmp.c b/lib/roken/strcasecmp.c index 200175d67..00a0a8ef0 100644 --- a/lib/roken/strcasecmp.c +++ b/lib/roken/strcasecmp.c @@ -40,7 +40,7 @@ #ifndef HAVE_STRCASECMP -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strcasecmp(const char *s1, const char *s2) { while(toupper((unsigned char)*s1) == toupper((unsigned char)*s2)) { diff --git a/lib/roken/strcollect.c b/lib/roken/strcollect.c index f444d05e2..0afc3f0c6 100644 --- a/lib/roken/strcollect.c +++ b/lib/roken/strcollect.c @@ -66,7 +66,7 @@ sub (char **argv, int i, int argc, va_list *ap) * terminated by NULL. */ -char ** ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL vstrcollect(va_list *ap) { return sub (NULL, 0, 0, ap); @@ -76,7 +76,7 @@ vstrcollect(va_list *ap) * */ -char ** ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL strcollect(char *first, ...) { va_list ap; diff --git a/lib/roken/strdup.c b/lib/roken/strdup.c index e06ac5222..ce004562f 100644 --- a/lib/roken/strdup.c +++ b/lib/roken/strdup.c @@ -36,7 +36,7 @@ #include #ifndef HAVE_STRDUP -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strdup(const char *old) { char *t = malloc(strlen(old)+1); diff --git a/lib/roken/strerror.c b/lib/roken/strerror.c index 015d5c57c..b5ec6918e 100644 --- a/lib/roken/strerror.c +++ b/lib/roken/strerror.c @@ -40,7 +40,7 @@ extern int sys_nerr; extern char *sys_errlist[]; -char* ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char* ROKEN_LIB_CALL strerror(int eno) { static char emsg[1024]; diff --git a/lib/roken/strftime.c b/lib/roken/strftime.c index 08c78ea7f..3918cea93 100644 --- a/lib/roken/strftime.c +++ b/lib/roken/strftime.c @@ -166,7 +166,7 @@ week_number_mon4 (const struct tm *tm) * */ -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strftime (char *buf, size_t maxsize, const char *format, const struct tm *tm) { @@ -382,7 +382,7 @@ strftime (char *buf, size_t maxsize, const char *format, "%%%c", *format); break; } - if (ret < 0 || ret >= maxsize - n) + if (ret < 0 || ret >= (int)(maxsize - n)) return 0; n += ret; buf += ret; diff --git a/lib/roken/strlcat.c b/lib/roken/strlcat.c index 2d3744a5f..5b8945351 100644 --- a/lib/roken/strlcat.c +++ b/lib/roken/strlcat.c @@ -36,7 +36,7 @@ #ifndef HAVE_STRLCAT -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcat (char *dst, const char *src, size_t dst_sz) { size_t len = strlen(dst); diff --git a/lib/roken/strlcpy.c b/lib/roken/strlcpy.c index b151d2184..f8a0bb766 100644 --- a/lib/roken/strlcpy.c +++ b/lib/roken/strlcpy.c @@ -36,7 +36,7 @@ #ifndef HAVE_STRLCPY -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcpy (char *dst, const char *src, size_t dst_sz) { size_t n; diff --git a/lib/roken/strlwr.c b/lib/roken/strlwr.c index 1a6634b73..68bd4edad 100644 --- a/lib/roken/strlwr.c +++ b/lib/roken/strlwr.c @@ -38,7 +38,7 @@ #include "roken.h" #ifndef HAVE_STRLWR -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strlwr(char *str) { char *s; diff --git a/lib/roken/strncasecmp.c b/lib/roken/strncasecmp.c index 0af38e173..f244fb582 100644 --- a/lib/roken/strncasecmp.c +++ b/lib/roken/strncasecmp.c @@ -39,7 +39,7 @@ #ifndef HAVE_STRNCASECMP -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL strncasecmp(const char *s1, const char *s2, size_t n) { while(n > 0 diff --git a/lib/roken/strndup.c b/lib/roken/strndup.c index af89664d8..e67c9983a 100644 --- a/lib/roken/strndup.c +++ b/lib/roken/strndup.c @@ -38,7 +38,7 @@ #include "roken.h" #ifndef HAVE_STRNDUP -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strndup(const char *old, size_t sz) { size_t len = strnlen (old, sz); diff --git a/lib/roken/strnlen.c b/lib/roken/strnlen.c index dfbcc2bf5..f26cd8451 100644 --- a/lib/roken/strnlen.c +++ b/lib/roken/strnlen.c @@ -35,7 +35,7 @@ #include "roken.h" -size_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strnlen(const char *s, size_t len) { size_t i; diff --git a/lib/roken/strpftime-test.h b/lib/roken/strpftime-test.h index 5d1f74256..5f9b23fda 100644 --- a/lib/roken/strpftime-test.h +++ b/lib/roken/strpftime-test.h @@ -45,4 +45,11 @@ #define strftime test_strftime #define strptime test_strptime +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL +strftime (char *buf, size_t maxsize, const char *format, + const struct tm *tm); + +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL +strptime (const char *buf, const char *format, struct tm *timeptr); + #endif /* __STRFTIME_TEST_H__ */ diff --git a/lib/roken/strpool.c b/lib/roken/strpool.c index 642d335de..6e6a737bc 100644 --- a/lib/roken/strpool.c +++ b/lib/roken/strpool.c @@ -46,7 +46,7 @@ struct rk_strpool { * */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_strpoolfree(struct rk_strpool *p) { if (p->str) { @@ -60,7 +60,7 @@ rk_strpoolfree(struct rk_strpool *p) * */ -struct rk_strpool * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION struct rk_strpool * ROKEN_LIB_CALL rk_strpoolprintf(struct rk_strpool *p, const char *fmt, ...) { va_list ap; @@ -97,7 +97,7 @@ rk_strpoolprintf(struct rk_strpool *p, const char *fmt, ...) * */ -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL rk_strpoolcollect(struct rk_strpool *p) { char *str; diff --git a/lib/roken/strptime.c b/lib/roken/strptime.c index 91eb62918..3d31922e8 100644 --- a/lib/roken/strptime.c +++ b/lib/roken/strptime.c @@ -177,7 +177,7 @@ first_day (int year) int ret = 4; for (; year > 1970; --year) - ret = (ret + 365 + is_leap_year (year) ? 1 : 0) % 7; + ret = (ret + (is_leap_year (year) ? 366 : 365)) % 7; return ret; } @@ -237,7 +237,7 @@ set_week_number_mon4 (struct tm *timeptr, int wnum) * */ -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strptime (const char *buf, const char *format, struct tm *timeptr) { char c; diff --git a/lib/roken/strsep.c b/lib/roken/strsep.c index 5cbf8557a..76b447c37 100644 --- a/lib/roken/strsep.c +++ b/lib/roken/strsep.c @@ -39,7 +39,7 @@ #ifndef HAVE_STRSEP -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strsep(char **str, const char *delim) { char *save = *str; diff --git a/lib/roken/strsep_copy.c b/lib/roken/strsep_copy.c index 908e37ca4..9624b5a46 100644 --- a/lib/roken/strsep_copy.c +++ b/lib/roken/strsep_copy.c @@ -41,7 +41,7 @@ /* strsep, but with const stringp, so return string in buf */ -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL strsep_copy(const char **stringp, const char *delim, char *buf, size_t len) { const char *save = *stringp; diff --git a/lib/roken/strtok_r.c b/lib/roken/strtok_r.c index a8ffde58e..16a9daf24 100644 --- a/lib/roken/strtok_r.c +++ b/lib/roken/strtok_r.c @@ -39,7 +39,7 @@ #ifndef HAVE_STRTOK_R -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strtok_r(char *s1, const char *s2, char **lasts) { char *ret; diff --git a/lib/roken/strupr.c b/lib/roken/strupr.c index db2d987f9..fdff7f44a 100644 --- a/lib/roken/strupr.c +++ b/lib/roken/strupr.c @@ -38,7 +38,7 @@ #include "roken.h" #ifndef HAVE_STRUPR -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strupr(char *str) { char *s; diff --git a/lib/roken/swab.c b/lib/roken/swab.c index 19a443eca..9b8d1d1f9 100644 --- a/lib/roken/swab.c +++ b/lib/roken/swab.c @@ -36,7 +36,7 @@ #ifndef HAVE_SWAB -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL swab (char *from, char *to, int nbytes) { while(nbytes >= 2) { diff --git a/lib/roken/syslog.h b/lib/roken/syslog.h new file mode 100644 index 000000000..f68dd1134 --- /dev/null +++ b/lib/roken/syslog.h @@ -0,0 +1,248 @@ +/* + * Copyright (c) 1982, 1986, 1988, 1993 + * The Regents of the University of California. 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. + * 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. + * + * @(#)syslog.h 8.1 (Berkeley) 6/2/93 + */ + +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +#ifndef _SYS_SYSLOG_H +#define _SYS_SYSLOG_H 1 + +#include + +/* + * priorities/facilities are encoded into a single 32-bit quantity, where the + * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility + * (0-big number). Both the priorities and the facilities map roughly + * one-to-one to strings in the syslogd(8) source code. This mapping is + * included in this file. + * + * priorities (these are ordered) + */ +#define LOG_EMERG 0 /* system is unusable */ +#define LOG_ALERT 1 /* action must be taken immediately */ +#define LOG_CRIT 2 /* critical conditions */ +#define LOG_ERR 3 /* error conditions */ +#define LOG_WARNING 4 /* warning conditions */ +#define LOG_NOTICE 5 /* normal but significant condition */ +#define LOG_INFO 6 /* informational */ +#define LOG_DEBUG 7 /* debug-level messages */ + +#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ + /* extract priority */ +#define LOG_PRI(p) ((p) & LOG_PRIMASK) +#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) + +#ifdef SYSLOG_NAMES +#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ + /* mark "facility" */ +#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) +typedef struct _code { + char *c_name; + int c_val; +} CODE; + +CODE prioritynames[] = + { + { "alert", LOG_ALERT }, + { "crit", LOG_CRIT }, + { "debug", LOG_DEBUG }, + { "emerg", LOG_EMERG }, + { "err", LOG_ERR }, + { "error", LOG_ERR }, /* DEPRECATED */ + { "info", LOG_INFO }, + { "none", INTERNAL_NOPRI }, /* INTERNAL */ + { "notice", LOG_NOTICE }, + { "panic", LOG_EMERG }, /* DEPRECATED */ + { "warn", LOG_WARNING }, /* DEPRECATED */ + { "warning", LOG_WARNING }, + { NULL, -1 } + }; +#endif + +/* facility codes */ +#define LOG_KERN (0<<3) /* kernel messages */ +#define LOG_USER (1<<3) /* random user-level messages */ +#define LOG_MAIL (2<<3) /* mail system */ +#define LOG_DAEMON (3<<3) /* system daemons */ +#define LOG_AUTH (4<<3) /* security/authorization messages */ +#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ +#define LOG_LPR (6<<3) /* line printer subsystem */ +#define LOG_NEWS (7<<3) /* network news subsystem */ +#define LOG_UUCP (8<<3) /* UUCP subsystem */ +#define LOG_CRON (9<<3) /* clock daemon */ +#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ +#define LOG_FTP (11<<3) /* ftp daemon */ + + /* other codes through 15 reserved for system use */ +#define LOG_LOCAL0 (16<<3) /* reserved for local use */ +#define LOG_LOCAL1 (17<<3) /* reserved for local use */ +#define LOG_LOCAL2 (18<<3) /* reserved for local use */ +#define LOG_LOCAL3 (19<<3) /* reserved for local use */ +#define LOG_LOCAL4 (20<<3) /* reserved for local use */ +#define LOG_LOCAL5 (21<<3) /* reserved for local use */ +#define LOG_LOCAL6 (22<<3) /* reserved for local use */ +#define LOG_LOCAL7 (23<<3) /* reserved for local use */ + +#define LOG_NFACILITIES 24 /* current number of facilities */ +#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ + /* facility of pri */ +#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) + +#ifdef SYSLOG_NAMES +CODE facilitynames[] = + { + { "auth", LOG_AUTH }, + { "authpriv", LOG_AUTHPRIV }, + { "cron", LOG_CRON }, + { "daemon", LOG_DAEMON }, + { "ftp", LOG_FTP }, + { "kern", LOG_KERN }, + { "lpr", LOG_LPR }, + { "mail", LOG_MAIL }, + { "mark", INTERNAL_MARK }, /* INTERNAL */ + { "news", LOG_NEWS }, + { "security", LOG_AUTH }, /* DEPRECATED */ + { "syslog", LOG_SYSLOG }, + { "user", LOG_USER }, + { "uucp", LOG_UUCP }, + { "local0", LOG_LOCAL0 }, + { "local1", LOG_LOCAL1 }, + { "local2", LOG_LOCAL2 }, + { "local3", LOG_LOCAL3 }, + { "local4", LOG_LOCAL4 }, + { "local5", LOG_LOCAL5 }, + { "local6", LOG_LOCAL6 }, + { "local7", LOG_LOCAL7 }, + { NULL, -1 } + }; +#endif + +/* + * arguments to setlogmask. + */ +#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ +#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ + +/* + * Option flags for openlog. + * + * LOG_ODELAY no longer does anything. + * LOG_NDELAY is the inverse of what it used to be. + */ +#define LOG_PID 0x01 /* log the pid with each message */ +#define LOG_CONS 0x02 /* log on the console if errors in sending */ +#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ +#define LOG_NDELAY 0x08 /* don't delay open */ +#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ +#define LOG_PERROR 0x20 /* log to stderr as well */ + +#define SYSLOG_PORT 514 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Close desriptor used to write to system logger. */ +extern void closelog (void); + +/* Open connection to system logger. */ +extern void openlog (char *__ident, int __option, int __facility); + +/* Set the log mask level. */ +extern int setlogmask (int __mask); + +/* Generate a log message using FMT string and option arguments. */ +extern void syslog (int __pri, char *__fmt, ...); + +/* Generate a log message using FMT and using arguments pointed to by AP. */ +extern void vsyslog (int __pri, char *__fmt, va_list __ap); + +#ifdef _WIN32 + /* Windows specific. + + init_syslog() *must* be called before calling any of the above + functions. exit_syslog() will be scheduled using atexit(). + However, it is not an error and encouraged to call + exit_syslog() before the application exits. + + During operation, the application is free to call exit_syslog() + followed by init_syslog() to re-initialize the library. i.e. if + a different syslog host is to be used. + + */ + + /* Initializes the syslog library and sets the syslog host. The + hostname parameter is of the form "[:]". The + may be a numeric port or it may be a name of a service. + If the is specified using a service name, it will be + looked up using getservbyname(). + + On failure, the hostname and port will be set to "localhost" + and SYSLOG_PORT respectively. + */ + extern void init_syslog(const char * hostname); + + extern void exit_syslog(void); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* syslog.h */ diff --git a/lib/roken/syslogc.c b/lib/roken/syslogc.c new file mode 100644 index 000000000..bf013a155 --- /dev/null +++ b/lib/roken/syslogc.c @@ -0,0 +1,341 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +/* + * Based on code by Alexander Yaworsky + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#define SYSLOG_DGRAM_SIZE 1024 + +static BOOL syslog_opened = FALSE; + +static int syslog_mask = 0xFF; +static char syslog_ident[ 128 ] = ""; +static int syslog_facility = LOG_USER; +static char syslog_procid_str[ 20 ]; + +static SOCKADDR_IN syslog_hostaddr; +static SOCKET syslog_socket = INVALID_SOCKET; +static char local_hostname[ MAX_COMPUTERNAME_LENGTH + 1 ]; + +static char syslog_hostname[ MAX_COMPUTERNAME_LENGTH + 1 ] = "localhost"; +static unsigned short syslog_port = SYSLOG_PORT; + +static int datagramm_size; + +volatile BOOL initialized = FALSE; +BOOL wsa_initialized = FALSE; +CRITICAL_SECTION cs_syslog; + +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +init_syslog(const char * hostname) +{ + WSADATA wsd; + char * service; + + if ( initialized ) + return; + + if( WSAStartup( MAKEWORD( 2, 2 ), &wsd ) ) { + fprintf(stderr, "Can't initialize WinSock\n"); + /* we let the rest of the initialization code go through, + although none of the syslog calls would succeed. */ + } else { + wsa_initialized = TRUE; + } + + if (hostname) + strcpy_s(syslog_hostname, sizeof(syslog_hostname), hostname); + else + strcpy_s(syslog_hostname, sizeof(syslog_hostname), ""); + + service = strchr(syslog_hostname, ':'); + + if (service) { + int tp; + + *service++ = '\0'; + + if ((tp = atoi(service)) <= 0) { + struct servent * se; + + se = getservbyname(service, "udp"); + + syslog_port = (se == NULL)? SYSLOG_PORT: se->s_port; + } else { + syslog_port = (unsigned short) tp; + } + } else { + syslog_port = SYSLOG_PORT; + } + + InitializeCriticalSection(&cs_syslog); + initialized = TRUE; + + atexit(exit_syslog); +} + +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +exit_syslog(void) +{ + if ( !initialized ) + return; + + closelog(); + + if ( wsa_initialized ) + WSACleanup(); + + DeleteCriticalSection(&cs_syslog); + initialized = FALSE; +} + +static void init_logger_addr() +{ + struct hostent * phe = NULL; + + memset( &syslog_hostaddr, 0, sizeof(SOCKADDR_IN) ); + syslog_hostaddr.sin_family = AF_INET; + + if (syslog_hostname[0] == '\0') + goto use_default; + + phe = gethostbyname( syslog_hostname ); + if( !phe ) + goto use_default; + + memcpy( &syslog_hostaddr.sin_addr.s_addr, phe->h_addr, phe->h_length ); + + syslog_hostaddr.sin_port = htons( syslog_port ); + return; + +use_default: + syslog_hostaddr.sin_addr.S_un.S_addr = htonl( 0x7F000001 ); + syslog_hostaddr.sin_port = htons( SYSLOG_PORT ); +} + +/****************************************************************************** + * closelog + * + * Close desriptor used to write to system logger. + */ +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +closelog() +{ + if ( !initialized ) + return; + + EnterCriticalSection(&cs_syslog); + if( syslog_opened ) { + closesocket( syslog_socket ); + syslog_socket = INVALID_SOCKET; + syslog_opened = FALSE; + } + LeaveCriticalSection(&cs_syslog); +} + +/****************************************************************************** + * openlog + * + * Open connection to system logger. + */ +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +openlog( char* ident, int option, int facility ) +{ + BOOL failed = FALSE; + SOCKADDR_IN sa_local; + DWORD n; + int size; + + if ( !initialized ) + return; + + EnterCriticalSection(&cs_syslog); + + if( syslog_opened ) + goto done; + + failed = TRUE; + + syslog_facility = facility? facility : LOG_USER; + + if( option & LOG_PID ) + sprintf_s( syslog_procid_str, sizeof(syslog_procid_str), "[%lu]", GetCurrentProcessId() ); + else + syslog_procid_str[0] = '\0'; + + /* FIXME: handle other options */ + + n = sizeof(local_hostname); + if( !GetComputerName( local_hostname, &n ) ) + goto done; + + syslog_socket = INVALID_SOCKET; + + init_logger_addr(); + + for( n = 0;; n++ ) + { + syslog_socket = socket( AF_INET, SOCK_DGRAM, 0 ); + if( INVALID_SOCKET == syslog_socket ) + goto done; + + memset( &sa_local, 0, sizeof(SOCKADDR_IN) ); + sa_local.sin_family = AF_INET; + if( bind( syslog_socket, (SOCKADDR*) &sa_local, sizeof(SOCKADDR_IN) ) == 0 ) + break; + closesocket( syslog_socket ); + syslog_socket = INVALID_SOCKET; + if( n == 100 ) + goto done; + Sleep(0); + } + + /* get size of datagramm */ + size = sizeof(datagramm_size); + if( getsockopt( syslog_socket, SOL_SOCKET, SO_MAX_MSG_SIZE, (char*) &datagramm_size, &size ) ) + goto done; + if( datagramm_size - strlen(local_hostname) - (ident? strlen(ident) : 0) < 64 ) + goto done; + if( datagramm_size > SYSLOG_DGRAM_SIZE ) + datagramm_size = SYSLOG_DGRAM_SIZE; + + if (ident) + strcpy_s(syslog_ident, sizeof(syslog_ident), ident); + + syslog_facility = (facility ? facility : LOG_USER); + failed = FALSE; + + done: + if( failed ) { + if( syslog_socket != INVALID_SOCKET ) + closesocket( syslog_socket ); + } + syslog_opened = !failed; + + LeaveCriticalSection(&cs_syslog); +} + +/****************************************************************************** + * setlogmask + * + * Set the log mask level. + */ +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +setlogmask( int mask ) +{ + int ret; + + if ( !initialized ) + return 0; + + EnterCriticalSection(&cs_syslog); + + ret = syslog_mask; + if( mask ) + syslog_mask = mask; + + LeaveCriticalSection(&cs_syslog); + + return ret; +} + +/****************************************************************************** + * syslog + * + * Generate a log message using FMT string and option arguments. + */ +ROKEN_LIB_FUNCTION void +syslog( int pri, char* fmt, ... ) +{ + va_list ap; + + va_start( ap, fmt ); + vsyslog( pri, fmt, ap ); + va_end( ap ); +} + +/****************************************************************************** + * vsyslog + * + * Generate a log message using FMT and using arguments pointed to by AP. + */ +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +vsyslog( int pri, char* fmt, va_list ap ) +{ + static char *month[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; + char datagramm[ SYSLOG_DGRAM_SIZE ]; + SYSTEMTIME stm; + int len; + char *p; + + if ( !initialized ) + return; + + EnterCriticalSection(&cs_syslog); + + if( !(LOG_MASK( LOG_PRI( pri )) & syslog_mask) ) + goto done; + + openlog( NULL, 0, pri & LOG_FACMASK ); + if( !syslog_opened ) + goto done; + + if( !(pri & LOG_FACMASK) ) + pri |= syslog_facility; + + GetLocalTime( &stm ); + len = sprintf_s( datagramm, sizeof(datagramm), + "<%d>%s %2d %02d:%02d:%02d %s %s%s: ", + pri, + month[ stm.wMonth - 1 ], stm.wDay, stm.wHour, stm.wMinute, stm.wSecond, + local_hostname, syslog_ident, syslog_procid_str ); + vsprintf_s( datagramm + len, datagramm_size - len, fmt, ap ); + p = strchr( datagramm, '\n' ); + if( p ) + *p = 0; + p = strchr( datagramm, '\r' ); + if( p ) + *p = 0; + + sendto( syslog_socket, datagramm, strlen(datagramm), 0, (SOCKADDR*) &syslog_hostaddr, sizeof(SOCKADDR_IN) ); + + done: + LeaveCriticalSection(&cs_syslog); +} + diff --git a/lib/roken/test-mem.c b/lib/roken/test-mem.c index ef2a5ed77..2ce961e06 100644 --- a/lib/roken/test-mem.c +++ b/lib/roken/test-mem.c @@ -54,8 +54,16 @@ struct { int fd; } map; +#ifdef HAVE_SIGACTION + struct sigaction sa, osa; +#else + +void (* osigh)(int); + +#endif + char *testname; static RETSIGTYPE @@ -82,7 +90,7 @@ segv_handler(int sig) errx(1, "malloc"); -void * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL rk_test_mem_alloc(enum rk_test_mem_type type, const char *name, void *buf, size_t size) { @@ -98,7 +106,7 @@ rk_test_mem_alloc(enum rk_test_mem_type type, const char *name, map.start = p; map.size = size + 2; p[0] = 0xff; - p[map.size] = 0xff; + p[map.size-1] = 0xff; map.data_start = p + 1; #else unsigned char *p; @@ -149,6 +157,7 @@ rk_test_mem_alloc(enum rk_test_mem_type type, const char *name, abort(); } #endif +#ifdef HAVE_SIGACTION sigemptyset (&sa.sa_mask); sa.sa_flags = 0; #ifdef SA_RESETHAND @@ -156,6 +165,9 @@ rk_test_mem_alloc(enum rk_test_mem_type type, const char *name, #endif sa.sa_handler = segv_handler; sigaction (SIGSEGV, &sa, &osa); +#else + osigh = signal(SIGSEGV, segv_handler); +#endif map.data_size = size; if (buf) @@ -163,7 +175,7 @@ rk_test_mem_alloc(enum rk_test_mem_type type, const char *name, return map.data_start; } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_test_mem_free(const char *map_name) { #ifndef HAVE_MMAP @@ -174,7 +186,7 @@ rk_test_mem_free(const char *map_name) if (p[0] != 0xff) errx(1, "%s: %s underrun %x\n", testname, map_name, p[0]); - if (p[map.size] != 0xff) + if (p[map.size-1] != 0xff) errx(1, "%s: %s overrun %x\n", testname, map_name, p[map.size - 1]); free(map.start); #else @@ -192,5 +204,9 @@ rk_test_mem_free(const char *map_name) free(testname); testname = NULL; +#ifdef HAVE_SIGACTION sigaction (SIGSEGV, &osa, NULL); +#else + signal (SIGSEGV, osigh); +#endif } diff --git a/lib/roken/test-mem.h b/lib/roken/test-mem.h index a00004afa..4d900b4a6 100644 --- a/lib/roken/test-mem.h +++ b/lib/roken/test-mem.h @@ -33,7 +33,7 @@ enum rk_test_mem_type { RK_TM_OVERRUN, RK_TM_UNDERRUN }; -void * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL rk_test_mem_alloc(enum rk_test_mem_type, const char *, void *, size_t); -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_test_mem_free(const char *); diff --git a/lib/roken/timeval.c b/lib/roken/timeval.c index 082bfc8b9..38b1f7ce9 100644 --- a/lib/roken/timeval.c +++ b/lib/roken/timeval.c @@ -43,7 +43,7 @@ * Make `t1' consistent. */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL timevalfix(struct timeval *t1) { if (t1->tv_usec < 0) { @@ -60,7 +60,7 @@ timevalfix(struct timeval *t1) * t1 += t2 */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL timevaladd(struct timeval *t1, const struct timeval *t2) { t1->tv_sec += t2->tv_sec; @@ -72,7 +72,7 @@ timevaladd(struct timeval *t1, const struct timeval *t2) * t1 -= t2 */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL timevalsub(struct timeval *t1, const struct timeval *t2) { t1->tv_sec -= t2->tv_sec; diff --git a/lib/roken/tm2time.c b/lib/roken/tm2time.c index d61ea0b01..ba69a0487 100644 --- a/lib/roken/tm2time.c +++ b/lib/roken/tm2time.c @@ -43,7 +43,7 @@ #endif #include "roken.h" -time_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION time_t ROKEN_LIB_CALL tm2time (struct tm tm, int local) { time_t t; diff --git a/lib/roken/unsetenv.c b/lib/roken/unsetenv.c index 5e4545726..55ba5e36d 100644 --- a/lib/roken/unsetenv.c +++ b/lib/roken/unsetenv.c @@ -45,7 +45,7 @@ extern char **environ; /* * unsetenv -- */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL unsetenv(const char *name) { int len; diff --git a/lib/roken/unvis.c b/lib/roken/unvis.c index d284f50b3..ed6ef9dfa 100644 --- a/lib/roken/unvis.c +++ b/lib/roken/unvis.c @@ -79,16 +79,16 @@ __warn_references(unvis, #define isoctal(c) (((u_char)(c)) >= '0' && ((u_char)(c)) <= '7') -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strunvis (char *, const char *); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_unvis (char *, int, int *, int); /* * unvis - decode characters previously encoded by vis */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_unvis(char *cp, int c, int *astate, int flag) { @@ -250,7 +250,7 @@ rk_unvis(char *cp, int c, int *astate, int flag) * Dst is null terminated. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strunvis(char *dst, const char *src) { char c; diff --git a/lib/roken/verify.c b/lib/roken/verify.c index 396b3c581..fc8fc57b6 100644 --- a/lib/roken/verify.c +++ b/lib/roken/verify.c @@ -42,7 +42,7 @@ #endif #include "roken.h" -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL unix_verify_user(char *user, char *password) { struct passwd *pw; diff --git a/lib/roken/verr.c b/lib/roken/verr.c index eff0420b4..cd3cdf35e 100644 --- a/lib/roken/verr.c +++ b/lib/roken/verr.c @@ -36,7 +36,7 @@ #include "roken.h" #include -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL verr(int eval, const char *fmt, va_list ap) { rk_warnerr(1, fmt, ap); diff --git a/lib/roken/verrx.c b/lib/roken/verrx.c index 0833c5404..84645181c 100644 --- a/lib/roken/verrx.c +++ b/lib/roken/verrx.c @@ -36,7 +36,7 @@ #include "roken.h" #include -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL verrx(int eval, const char *fmt, va_list ap) { rk_warnerr(0, fmt, ap); diff --git a/lib/roken/vis.c b/lib/roken/vis.c index 155b148e8..19ff29d95 100644 --- a/lib/roken/vis.c +++ b/lib/roken/vis.c @@ -106,17 +106,17 @@ static char *do_svis(char *, int, int, int, const char *); #define BELL '\007' #endif -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL rk_vis (char *, int, int, int); -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL rk_svis (char *, int, int, int, const char *); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strvis (char *, const char *, int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strsvis (char *, const char *, int, const char *); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strvisx (char *, const char *, size_t, int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strsvisx (char *, const char *, size_t, int, const char *); @@ -249,7 +249,7 @@ do_svis(char *dst, int c, int flag, int nextc, const char *extra) * svis - visually encode characters, also encoding the characters * pointed to by `extra' */ -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL rk_svis(char *dst, int c, int flag, int nextc, const char *extra) { char *nextra = NULL; @@ -286,7 +286,8 @@ rk_svis(char *dst, int c, int flag, int nextc, const char *extra) * Strsvisx encodes exactly len bytes from src into dst. * This is useful for encoding a block of data. */ -int ROKEN_LIB_FUNCTION + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strsvis(char *dst, const char *csrc, int flag, const char *extra) { int c; @@ -315,7 +316,7 @@ rk_strsvis(char *dst, const char *csrc, int flag, const char *extra) } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strsvisx(char *dst, const char *csrc, size_t len, int flag, const char *extra) { unsigned char c; @@ -353,7 +354,7 @@ rk_strsvisx(char *dst, const char *csrc, size_t len, int flag, const char *extra /* * vis - visually encode characters */ -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL rk_vis(char *dst, int c, int flag, int nextc) { char *extra = NULL; @@ -386,7 +387,7 @@ rk_vis(char *dst, int c, int flag, int nextc) * Strvisx encodes exactly len bytes from src into dst. * This is useful for encoding a block of data. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strvis(char *dst, const char *src, int flag) { char *extra = NULL; @@ -403,7 +404,7 @@ rk_strvis(char *dst, const char *src, int flag) } -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strvisx(char *dst, const char *src, size_t len, int flag) { char *extra = NULL; diff --git a/lib/roken/vis.hin b/lib/roken/vis.hin index a1481b789..412a191e6 100644 --- a/lib/roken/vis.hin +++ b/lib/roken/vis.hin @@ -36,9 +36,11 @@ #ifndef ROKEN_LIB_FUNCTION #ifdef _WIN32 -#define ROKEN_LIB_FUNCTION _stdcall +#define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL __cdecl #else #define ROKEN_LIB_FUNCTION +#define ROKEN_LIB_CALL #endif #endif @@ -84,23 +86,23 @@ ROKEN_CPP_START -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL rk_vis(char *, int, int, int); -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL rk_svis(char *, int, int, int, const char *); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strvis(char *, const char *, int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strsvis(char *, const char *, int, const char *); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strvisx(char *, const char *, size_t, int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strsvisx(char *, const char *, size_t, int, const char *); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strunvis(char *, const char *); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strunvisx(char *, const char *, int); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_unvis(char *, int, int *, int); ROKEN_CPP_END diff --git a/lib/roken/vsyslog.c b/lib/roken/vsyslog.c index dbcec2ace..91541fb73 100644 --- a/lib/roken/vsyslog.c +++ b/lib/roken/vsyslog.c @@ -58,7 +58,7 @@ simple_vsyslog(int pri, const char *fmt, va_list ap) * do like syslog but with a `va_list' */ -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vsyslog(int pri, const char *fmt, va_list ap) { char *fmt2; diff --git a/lib/roken/vwarn.c b/lib/roken/vwarn.c index 771729231..8f1706d4a 100644 --- a/lib/roken/vwarn.c +++ b/lib/roken/vwarn.c @@ -36,7 +36,7 @@ #include "roken.h" #include -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vwarn(const char *fmt, va_list ap) { rk_warnerr(1, fmt, ap); diff --git a/lib/roken/vwarnx.c b/lib/roken/vwarnx.c index 5337987c0..6fb1d8c87 100644 --- a/lib/roken/vwarnx.c +++ b/lib/roken/vwarnx.c @@ -36,7 +36,7 @@ #include "roken.h" #include -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL vwarnx(const char *fmt, va_list ap) { rk_warnerr(0, fmt, ap); diff --git a/lib/roken/warnerr.c b/lib/roken/warnerr.c index 05c10e5ee..9e670239a 100644 --- a/lib/roken/warnerr.c +++ b/lib/roken/warnerr.c @@ -36,7 +36,7 @@ #include "roken.h" #include "err.h" -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_warnerr(int doerrno, const char *fmt, va_list ap) { int sverrno = errno; diff --git a/lib/roken/warnx.c b/lib/roken/warnx.c index 1ffc64785..cf33939b2 100644 --- a/lib/roken/warnx.c +++ b/lib/roken/warnx.c @@ -35,7 +35,7 @@ #include "err.h" -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL warnx(const char *fmt, ...) { va_list ap; diff --git a/lib/roken/write_pid.c b/lib/roken/write_pid.c index e4af6f607..2a6ada586 100644 --- a/lib/roken/write_pid.c +++ b/lib/roken/write_pid.c @@ -33,14 +33,9 @@ #include -#include -#include -#include #include "roken.h" -#include "roken.h" - -char * ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL pid_file_write (const char *progname) { FILE *fp; @@ -59,7 +54,7 @@ pid_file_write (const char *progname) return ret; } -void ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL pid_file_delete (char **filename) { if (*filename != NULL) { @@ -79,7 +74,7 @@ pidfile_cleanup(void) pid_file_delete(&pidfile_path); } -void +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL pidfile(const char *basename) { if(pidfile_path != NULL) diff --git a/lib/roken/writev.c b/lib/roken/writev.c index db44b2ef3..80945e95d 100644 --- a/lib/roken/writev.c +++ b/lib/roken/writev.c @@ -35,7 +35,7 @@ #include "roken.h" -ssize_t ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL writev(int d, const struct iovec *iov, int iovcnt) { ssize_t ret; diff --git a/lib/sl/NTMakefile b/lib/sl/NTMakefile new file mode 100644 index 000000000..34ba643c1 --- /dev/null +++ b/lib/sl/NTMakefile @@ -0,0 +1,76 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\sl + +!include ../../windows/NTMakefile.w32 + +INCFILES=$(INCDIR)\sl.h + +$(LIBSL): $(OBJ)\sl.obj + $(LIBCON) + +$(BINDIR)\slc.exe: $(OBJ)\slc-gram.obj $(OBJ)\slc-lex.obj + $(EXECONLINK) $(LIBROKEN) $(LIBVERS) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\slc-gram.c: slc-gram.y + $(YACC) -o $@ --defines=$(@R).h slc-gram.y + +$(OBJ)\slc-gram.obj: $(OBJ)\slc-gram.c + $(C2OBJ) -I$(SRC)\$(RELDIR) + +$(OBJ)\slc-lex.c: slc-lex.l + $(LEX) -o$@ slc-lex.l + +$(OBJ)\slc-lex.obj: $(OBJ)\slc-lex.c + $(C2OBJ) -I$(SRC)\$(RELDIR) + +$(OBJ)\test_sl.exe: $(OBJ)\test_sl.obj + $(EXECONLINK) $(LIBSL) $(LIBVERS) $(LIBROKEN) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +all:: $(INCFILES) $(LIBSL) $(BINDIR)\slc.exe + +clean:: + -$(RM) $(LIBSL) + -$(RM) $(BINDIR)\slc.exe + +test-binaries: $(OBJ)\test_sl.exe + +test-run: + cd $(OBJ) + test_sl.exe + cd $(SRC)\$(RELDIR) + +test:: test-binaries test-run diff --git a/lib/sqlite/NTMakefile b/lib/sqlite/NTMakefile new file mode 100644 index 000000000..f9e90fb77 --- /dev/null +++ b/lib/sqlite/NTMakefile @@ -0,0 +1,47 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\sqlite + +!include ../../windows/NTMakefile.w32 + +INCFILES= \ + $(INCDIR)\sqlite3.h \ + $(INCDIR)\sqlite3ext.h + +$(LIBSQLITE): $(OBJ)\sqlite3.obj + $(LIBCON) + +all:: $(INCFILES) $(LIBSQLITE) + +clean:: + -$(RM) $(LIBSQLITE) + -$(RM) $(INCFILES) diff --git a/lib/vers/NTMakefile b/lib/vers/NTMakefile new file mode 100644 index 000000000..d91d3825e --- /dev/null +++ b/lib/vers/NTMakefile @@ -0,0 +1,60 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR = lib\vers + +!include ../../windows/NTMakefile.w32 + +INCFILES=$(INCDIR)\vers.h + +$(LIBVERS): $(OBJ)\print_version.obj + $(LIBCON) + +$(OBJ)\print_version.obj: print_version.c + $(C2OBJ) -I$(OBJ) + +$(OBJ)\make-print-version.obj: make-print-version.c + $(C2OBJ) -DKRB5 + +$(OBJ)\make-print-version.exe: $(OBJ)\make-print-version.obj + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\print_version.h: $(OBJ)\make-print-version.exe + $(OBJ)\make-print-version.exe $@ + +all:: $(INCFILES) $(OBJ)\print_version.h $(LIBVERS) + +clean:: + -$(RM) $(OBJ)\print_version.h $(LIBVERS) + -$(RM) $(OBJ)\make-print-version.exe + -$(RM) $(OBJ)\make-print-version.obj diff --git a/lib/wind/NTMakefile b/lib/wind/NTMakefile new file mode 100644 index 000000000..d4cdf1004 --- /dev/null +++ b/lib/wind/NTMakefile @@ -0,0 +1,155 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=lib\wind + +!include ../../windows/NTMakefile.w32 + +libwind_OBJs= \ + $(OBJ)\bidi.obj \ + $(OBJ)\bidi_table.obj \ + $(OBJ)\combining.obj \ + $(OBJ)\combining_table.obj \ + $(OBJ)\errorlist.obj \ + $(OBJ)\errorlist_table.obj \ + $(OBJ)\map.obj \ + $(OBJ)\map_table.obj \ + $(OBJ)\ldap.obj \ + $(OBJ)\normalize.obj \ + $(OBJ)\normalize_table.obj \ + $(OBJ)\punycode.obj \ + $(OBJ)\stringprep.obj \ + $(OBJ)\wind_err.obj \ + $(OBJ)\utf8.obj + +$(LIBWIND): $(libwind_OBJs) + $(LIBCON) + +INCFILES= \ + $(INCDIR)\wind.h \ + $(INCDIR)\wind_err.h \ + $(INCDIR)\map_table.h \ + $(INCDIR)\errorlist_table.h \ + $(INCDIR)\normalize_table.h \ + $(INCDIR)\combining_table.h \ + $(INCDIR)\bidi_table.h \ + $(INCDIR)\punycode_examples.h + +$(OBJ)\map_table.h $(OBJ)\map_table.c: rfc3454.txt gen-map.py stringprep.py + cd $(OBJ) + $(PYTHON) $(SRCDIR)\gen-map.py $(SRCDIR)\rfc3454.txt + cd $(SRCDIR) + +$(OBJ)\errorlist_table.h $(OBJ)\errorlist_table.c: rfc3454.txt gen-errorlist.py stringprep.py + cd $(OBJ) + $(PYTHON) $(SRCDIR)\gen-errorlist.py $(SRCDIR)\rfc3454.txt + cd $(SRCDIR) + +$(OBJ)\normalize_table.h $(OBJ)\normalize_table.c: UnicodeData.txt CompositionExclusions-3.2.0.txt gen-normalize.py + cd $(OBJ) + $(PYTHON) $(SRCDIR)\gen-normalize.py $(SRCDIR)\UnicodeData.txt $(SRCDIR)\CompositionExclusions-3.2.0.txt + cd $(SRCDIR) + +$(OBJ)\combining_table.h $(OBJ)\combining_table.c: UnicodeData.txt gen-combining.py + cd $(OBJ) + $(PYTHON) $(SRCDIR)\gen-combining.py $(SRCDIR)\UnicodeData.txt + cd $(SRCDIR) + +$(OBJ)\bidi_table.h $(OBJ)\bidi_table.c: rfc3454.txt gen-bidi.py + cd $(OBJ) + $(PYTHON) $(SRCDIR)\gen-bidi.py $(SRCDIR)\rfc3454.txt + cd $(SRCDIR) + +$(OBJ)\punycode_examples.h $(OBJ)\punycode_examples.c: gen-punycode-examples.py rfc3492.txt + cd $(OBJ) + $(PYTHON) $(SRCDIR)\gen-punycode-examples.py $(SRCDIR)\rfc3492.txt + cd $(SRCDIR) + +$(OBJ)\wind_err.c $(OBJ)\wind_err.h: wind_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\wind_err.et + cd $(SRCDIR) + +TEST_BINARIES=\ + $(OBJ)\test-bidi.exe \ + $(OBJ)\test-map.exe \ + $(OBJ)\test-rw.exe \ + $(OBJ)\test-normalize.exe \ + $(OBJ)\test-prohibited.exe \ + $(OBJ)\test-punycode.exe \ + $(OBJ)\test-ldap.exe \ + $(OBJ)\test-utf8.exe + +{$(OBJ)}.c{$(OBJ)}.obj: + $(C2OBJ) -I$(SRCDIR) + +{$(OBJ)}.obj{$(OBJ)}.exe: + $(EXECONLINK) $(LIBWIND) $(LIBROKEN) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\test-bidi.exe: $(OBJ)\test-bidi.obj + +$(OBJ)\test-map.exe: $(OBJ)\test-map.obj + +$(OBJ)\test-rw.exe: $(OBJ)\test-rw.obj + +$(OBJ)\test-normalize.exe: $(OBJ)\test-normalize.obj + +$(OBJ)\test-prohibited.exe: $(OBJ)\test-prohibited.obj + +$(OBJ)\test-punycode.exe: $(OBJ)\test-punycode.obj $(OBJ)\punycode_examples.obj + +$(OBJ)\test-ldap.exe: $(OBJ)\test-ldap.obj + +$(OBJ)\test-utf8.exe: $(OBJ)\test-utf8.obj + +test-binaries: $(TEST_BINARIES) + +test-run: + cd $(OBJ) + test-bidi.exe + test-map.exe + test-rw.exe + test-normalize.exe $(SRCDIR)\NormalizationTest.txt + test-prohibited.exe + test-punycode.exe + test-ldap.exe + test-utf8.exe + cd $(SRCDIR) + +all:: $(INCFILES) $(LIBWIND) + +clean:: + -$(RM) $(LIBWIND) + -$(RM) $(INCFILES) + +test:: test-binaries test-run diff --git a/lib/wind/gen-bidi.py b/lib/wind/gen-bidi.py index 42af72f3b..70abb1ed7 100644 --- a/lib/wind/gen-bidi.py +++ b/lib/wind/gen-bidi.py @@ -70,6 +70,7 @@ extern const size_t _wind_l_table_size; bidi_c.file.write( ''' +#include #include "bidi_table.h" ''') diff --git a/lib/wind/gen-combining.py b/lib/wind/gen-combining.py index f7e9bf881..cc692fd2a 100644 --- a/lib/wind/gen-combining.py +++ b/lib/wind/gen-combining.py @@ -73,6 +73,7 @@ extern const size_t _wind_combining_table_size; combining_c.file.write( ''' +#include #include "combining_table.h" const struct translation _wind_combining_table[] = { diff --git a/lib/wind/gen-errorlist.py b/lib/wind/gen-errorlist.py index 6ea88d7bc..b921377ab 100644 --- a/lib/wind/gen-errorlist.py +++ b/lib/wind/gen-errorlist.py @@ -77,6 +77,7 @@ extern const size_t _wind_errorlist_table_size; errorlist_c.file.write( ''' +#include #include "errorlist_table.h" const struct error_entry _wind_errorlist_table[] = { diff --git a/lib/wind/gen-normalize.py b/lib/wind/gen-normalize.py index 0a20b71cf..c076088fd 100644 --- a/lib/wind/gen-normalize.py +++ b/lib/wind/gen-normalize.py @@ -97,6 +97,7 @@ extern const unsigned short _wind_canon_next_table[]; normalize_c.file.write( ''' +#include #include "normalize_table.h" const struct translation _wind_normalize_table[] = { diff --git a/lib/wind/gen-punycode-examples.py b/lib/wind/gen-punycode-examples.py index c22e011d0..44f5dafe5 100644 --- a/lib/wind/gen-punycode-examples.py +++ b/lib/wind/gen-punycode-examples.py @@ -104,6 +104,7 @@ extern const size_t punycode_examples_size; examples_c.file.write( ''' +#include #include "punycode_examples.h" const struct punycode_example punycode_examples[] = { diff --git a/lib/wind/test-bidi.c b/lib/wind/test-bidi.c index d62f48a19..913747378 100644 --- a/lib/wind/test-bidi.c +++ b/lib/wind/test-bidi.c @@ -45,7 +45,7 @@ struct test { }; static struct test passing_cases[] = { - {0, {}}, + {0, {0}}, {1, {0x0041}}, {1, {0x05be}}, }; diff --git a/lib/wind/test-ldap.c b/lib/wind/test-ldap.c index 72a125d5f..7051a7fe8 100644 --- a/lib/wind/test-ldap.c +++ b/lib/wind/test-ldap.c @@ -50,7 +50,7 @@ struct testcase { }; static const struct testcase testcases[] = { - { { 0x20 }, 1, { }, 0 }, + { { 0x20 }, 1, { 0 }, 0 }, { { 0x20, 0x61 }, 2, { 0x20, 0x61, 0x20}, 3 }, { { 0x20, 0x61, 0x20 }, 3, { 0x20, 0x61, 0x20}, 3 }, { { 0x20, 0x61, 0x20, 0x61 }, 4, { 0x20, 0x61, 0x20, 0x20, 0x61, 0x20}, 6 } diff --git a/lib/wind/test-map.c b/lib/wind/test-map.c index 5b0f49381..fcc86007b 100644 --- a/lib/wind/test-map.c +++ b/lib/wind/test-map.c @@ -51,10 +51,10 @@ struct example { }; static struct example cases[] = { - {{}, 0, {}, 0}, + {{0}, 0, {0}, 0}, {{0x0041}, 1, {0x0061}, 1}, {{0x0061}, 1, {0x0061}, 1}, - {{0x00AD}, 1, {}, 0}, + {{0x00AD}, 1, {0}, 0}, {{0x00DF}, 1, {0x0073, 0x0073}, 2} }; @@ -95,3 +95,4 @@ main(void) failures += try(&cases[i]); return failures != 0; } + diff --git a/lib/wind/test-rw.c b/lib/wind/test-rw.c index 62f68e2f3..9e39d8540 100644 --- a/lib/wind/test-rw.c +++ b/lib/wind/test-rw.c @@ -67,7 +67,7 @@ struct testcase { WIND_RW_BOM, 2, "\xfe\xff", 0, - 0, { }, + 0, { 0 }, WIND_RW_BE }, /* no input */ @@ -75,7 +75,7 @@ struct testcase { WIND_RW_BOM, 0, "", 0, - 0, { }, + 0, { 0 }, WIND_RW_BOM }, /* BOM only */ @@ -83,7 +83,7 @@ struct testcase { WIND_RW_BOM, 2, "\xff\xfe", 0, - 0, { }, + 0, { 0 }, WIND_RW_LE }, /* water + z */ @@ -123,7 +123,7 @@ struct testcase { WIND_RW_BOM, 1, "\xfe", WIND_ERR_LENGTH_NOT_MOD2, - 0, { }, + 0, { 0 }, WIND_RW_BOM }, /* error, missing BOM */ @@ -131,7 +131,7 @@ struct testcase { WIND_RW_BOM, 2, "\x00\x20", WIND_ERR_NO_BOM, - 0, { }, + 0, { 0 }, WIND_RW_BOM }, /* error, overrun */ diff --git a/lib/wind/test-utf8.c b/lib/wind/test-utf8.c index 3197528b6..d85df286e 100644 --- a/lib/wind/test-utf8.c +++ b/lib/wind/test-utf8.c @@ -78,7 +78,7 @@ struct testcase { }; static const struct testcase testcases[] = { - {"", 0, {}}, + {"", 0, {0}}, {"\x01", 1, {1}}, {"\x7F", 1, {0x7F}}, {"\x01\x7F", 2, {0x01, 0x7F}}, diff --git a/lib/wind/windlocl.h b/lib/wind/windlocl.h index fb5e0b25d..da9d58cfe 100644 --- a/lib/wind/windlocl.h +++ b/lib/wind/windlocl.h @@ -41,6 +41,7 @@ #endif #include +#include #include "wind.h" #include "wind_err.h" diff --git a/packages/NTMakefile b/packages/NTMakefile new file mode 100644 index 000000000..68fd8c0d8 --- /dev/null +++ b/packages/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=packages + +!include ../windows/NTMakefile.w32 + diff --git a/tests/NTMakefile b/tests/NTMakefile new file mode 100644 index 000000000..8a1698ee2 --- /dev/null +++ b/tests/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=tests + +!include ../windows/NTMakefile.w32 + diff --git a/tests/can/NTMakefile b/tests/can/NTMakefile new file mode 100644 index 000000000..09efe5e3f --- /dev/null +++ b/tests/can/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=tests\can + +!include ../../windows/NTMakefile.w32 + diff --git a/tests/db/NTMakefile b/tests/db/NTMakefile new file mode 100644 index 000000000..fbbc303f1 --- /dev/null +++ b/tests/db/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=tests\db + +!include ../../windows/NTMakefile.w32 + diff --git a/tests/gss/NTMakefile b/tests/gss/NTMakefile new file mode 100644 index 000000000..c1ca7a246 --- /dev/null +++ b/tests/gss/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=tests\gss + +!include ../../windows/NTMakefile.w32 + diff --git a/tests/java/NTMakefile b/tests/java/NTMakefile new file mode 100644 index 000000000..578373997 --- /dev/null +++ b/tests/java/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=tests\java + +!include ../../windows/NTMakefile.w32 + diff --git a/tests/kdc/NTMakefile b/tests/kdc/NTMakefile new file mode 100644 index 000000000..16ca0a7b4 --- /dev/null +++ b/tests/kdc/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=tests\kdc + +!include ../../windows/NTMakefile.w32 + diff --git a/tests/ldap/NTMakefile b/tests/ldap/NTMakefile new file mode 100644 index 000000000..9c5de0988 --- /dev/null +++ b/tests/ldap/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=tests\ldap + +!include ../../windows/NTMakefile.w32 + diff --git a/tests/plugin/NTMakefile b/tests/plugin/NTMakefile new file mode 100644 index 000000000..dc345c980 --- /dev/null +++ b/tests/plugin/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=tests\plugin + +!include ../../windows/NTMakefile.w32 + diff --git a/tools/NTMakefile b/tools/NTMakefile new file mode 100644 index 000000000..e4b34668d --- /dev/null +++ b/tools/NTMakefile @@ -0,0 +1,35 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# + +RELDIR=tools + +!include ../windows/NTMakefile.w32 + diff --git a/windows/NTMakefile.config b/windows/NTMakefile.config new file mode 100644 index 000000000..7f021d808 --- /dev/null +++ b/windows/NTMakefile.config @@ -0,0 +1,91 @@ +# Version strings + +VER_PACKAGE=heimdal +VER_PACKAGE_NAME=Heimdal +VER_PACKAGE_BUGREPORT=heimdal-bugs@h5l.org +VER_PACKAGE_VERSION=1.2.2rc1 +VER_PACKAGE_COPYRIGHT=(C) +VER_PACKAGE_COMPANY=www.h5l.org + +VER_PRODUCT_MAJOR=1 +VER_PRODUCT_MINOR=2 +VER_PRODUCT_AUX=2001 +VER_PRODUCT_PATCH=0 + +# Define to 1 if this is a pre-release build. Undefine otherwise +VER_PRERELEASE=1 + +# Define to a valid string if this build DOES NOT follow normal +# release procedures. I.e. this is a private build whose version +# numbers are not co-ordinated with mainline development. + +#VER_PRIVATE=Private build for MyCompany + +# Define to a valid string if this build DOES follow normal release +# procedures, but is a variation of the standard files of the same +# version numbers. + +#VER_SPECIAL=Special build for testing ticket 12345 + + +# ------------------------------------------------------------ +# Features +# +# For each feature enabled here, a corresponding line must exist in +# the inline Perl script in include\NTMakefile. + +# Enable Kerberos 5 support in applications +KRB5=1 + +# Enable PKINIT +PKINIT=1 + +# Disable AFS support +NO_AFS=1 + +# OpenLDAP package is available +# OPENLDAP=1 + +# OpenLDAP include directory +# OPENLDAP_INC= + +# OpenLDAP library to link against +# OPENLDAP_LIB= + +# Support HDB LDAP module +# OPENLDAP_MODULE=1 + +# OTP support in applications +OTP=1 + +# Authentication support in telnet +AUTHENTICATION=1 + +# Enable diagnostics in telnet +DIAGNOSTICS=1 + +# Enable encryption support in telnet +ENCRYPTION=1 + +# Use the weak AFS string to key functions +# ENABLE_AFS_STRING_TO_KEY=1 + +!ifdef PTHREAD_INC +!ifdef PTHREAD_LIB + +# We have +HAVE_PTHREAD_H=1 + +# Make thread-safe libraries +ENABLE_PTHREAD_SUPPORT=1 + +!endif +!endif + +# Support for broken ENV_{VAR,VAL} telnets +# ENV_HACK=1 + +# Use the Kerberos Credentials Manager +# HAVE_KCM=1 + +DIR_hdbdir=$${COMMON_APPDATA}/heimdal/hdb diff --git a/windows/NTMakefile.w32 b/windows/NTMakefile.w32 new file mode 100644 index 000000000..b7acaee58 --- /dev/null +++ b/windows/NTMakefile.w32 @@ -0,0 +1,375 @@ + +all:: + +clean:: + +test:: + +prep:: + +all:: prep + +!include + +!ifdef NODEBUG +BUILD=rel +!else +BUILD=dbg +!endif + +!if exist($(MAKEDIR)\windows\NTMakefile.w32) +SRC=$(MAKEDIR) +!elseif exist($(MAKEDIR)\..\windows\NTMakefile.w32) +SRC=$(MAKEDIR)\.. +!elseif exist($(MAKEDIR)\..\..\windows\NTMakefile.w32) +SRC=$(MAKEDIR)\..\.. +!else +! error Cant determine source directory +!endif + +!include "NTMakefile.config" + +#---------------------------------------------------------------- +# Directory macros + +DESTDIR=$(SRC)\windows\dest_$(OUTDIR) +OBJDIR =$(SRC)\windows\obj_$(OUTDIR) + +INCDIR =$(DESTDIR)\inc +LIBDIR =$(DESTDIR)\lib +BINDIR =$(DESTDIR)\bin + +!ifdef RELDIR +SRCDIR =$(SRC)\$(RELDIR) +OBJ =$(OBJDIR)\$(RELDIR) +!else +OBJ =$(OBJDIR) +!endif + +# For tests: +PATH=$(PATH);$(BINDIR) + +#---------------------------------------------------------------- +# Command macros + +RMAKE=nmake /nologo /f NTMakefile RECURSE=1 +MKDIR=md +CP=copy /Y +LINK=link +LM=lib +RM=del /q +ECHO=echo +RC=rc + +!ifndef AWK +AWK=gawk.exe +!endif + +!ifndef YACC +YACC=bison.exe -y +!endif + +!ifndef LEX +LEX=flex.exe +!endif + +!ifndef PYTHON +PYTHON=python.exe +!endif + +!ifndef PERL +PERL=perl.exe +!endif + +!ifndef CMP +CMP=cmp.exe +!endif + +# Only used for tests +!ifndef SH +SH=sh.exe +!endif + +!ifndef SED +SED=sed.exe +!endif + +#---------------------------------------------------------------- +# External dependencies + +!ifdef PTHREAD_INC +pthreadinc= -I$(PTHREAD_INC) +!endif + +#---------------------------------------------------------------- +# Build options + +cincdirs=$(cincdirs) -I$(INCDIR) $(pthreadinc) +cdefines=$(cdefines) -DHAVE_CONFIG_H +cwarn=$(cwarn) -D_CRT_SECURE_NO_WARNINGS -wd4996 + +!if "$(CPU)"=="i386" +libmach=/machine:X86 +!elseif "$(CPU)"=="AMD64" +libmach=/machine:X64 +!else +! error Unknown CPU value +!endif + +!ifndef STATICRUNTIME + +C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsdll) $(AUXCFLAGS) $(cdefines) $(cincdirs) $(cwarn) +EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsdll) +EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsdll) +DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsdll) +DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsdll) + +!else # STATICRUNTIME + +C2OBJ_C = $(CC) $(cdebug) $(cflags) $(cvarsmt) $(AUXCFLAGS) $(cdefines) $(cincdirs) $(cwarn) +EXECONLINK_C = $(LINK) $(ldebug) $(conlflags) $(conlibsmt) +EXEGUILINK_C = $(LINK) $(ldebug) $(guilflags) $(guilibsmt) +DLLCONLINK_C = $(LINK) $(ldebug) $(dlllflags) $(conlibsmt) +DLLGUILINK_C = $(LINK) $(ldebug) $(dlllflags) $(guilibsmt) + +!endif + +LIBGUI_C = $(LM) /nologo $(libmach) /SUBSYSTEM:WINDOWS +LIBCON_C = $(LM) /nologo $(libmach) /SUBSYSTEM:CONSOLE + +C2OBJ = $(C2OBJ_C) -Fo$@ -Fd$(@D)\ $** +EXECONLINK = $(EXECONLINK_C) -OUT:$@ $** +EXEGUILINK = $(EXEGUILINK_C) -OUT:$@ $** +DLLCONLINK = $(DLLCONLINK_C) -OUT:$@ $** +DLLGUILINK = $(DLLGUILINK_C) -OUT:$@ $** +LIBGUI = $(LIBGUI_C) /OUT:$@ $** +LIBCON = $(LIBCON_C) /OUT:$@ $** + +# Resources + +RC2RES_C = $(RC) $(cincdirs) $(AUXRCFLAGS) +RC2RES = $(RC2RES_C) -fo $@ $** + +#---------------------------------------------------------------------- +# If this is the initial invocation, we check if all the build +# utilities are there. Also show the commands macros. + +!ifndef RECURSE + +check-utils: + @for %%g in ( "$(AWK)" "$(YACC)" "$(LEX)" "$(PYTHON)" "$(PERL)" "$(CMP)" ) do @( \ + for /f %%f in ( "%%g" ) do @( \ + if exist %%f @( \ + echo Found %%f \ + ) else if "%%~$$PATH:f"=="" @( \ + echo Could not find %%f in PATH && \ + exit /b 1 \ + ) else @( \ + echo Found %%~$$PATH:f \ + ) \ + ) \ + ) + @for %%g in ( "$(SH)" "$(SED)" ) do @( \ + for /f %%f in ( "%%g" ) do @( \ + if exist %%f @( \ + echo Found %%f \ + ) else if "%%~$$PATH:f"=="" @( \ + echo Could not find %%f in PATH && \ + echo Test targets may fail. \ + ) else @( \ + echo Found %%~$$PATH:f \ + ) \ + ) \ + ) + + +prep:: check-utils + +show-cmds: + @$(ECHO) C2OBJ=$(C2OBJ_C:\=\\) + @$(ECHO). + @$(ECHO) EXECONLINK=$(EXECONLINK_C) + @$(ECHO). + @$(ECHO) EXEGUILINK=$(EXEGUILINK_C) + @$(ECHO). + @$(ECHO) DLLCONLINK=$(DLLCONLINK_C) + @$(ECHO). + @$(ECHO) DLLGUILINK=$(DLLGUILINK_C) + @$(ECHO). + @$(ECHO) LIBGUI=$(LIBGUI_C) + @$(ECHO). + @$(ECHO) LIBCON=$(LIBCON_C) + +prep:: show-cmds + +!endif + +{}.c{$(OBJ)}.obj: + $(C2OBJ) + +{$(OBJ)}.c{$(OBJ)}.obj: + $(C2OBJ) + +{}.cpp{$(OBJ)}.obj: + $(C2OBJ) + +{$(OBJ)}.cpp{$(OBJ)}.obj: + $(C2OBJ) + +{}.hin{}.h: + $(CP) $< $@ + +{}.hin{$(INCDIR)}.h: + $(CP) $< $@ + +{}.h{$(INCDIR)}.h: + $(CP) $< $@ + +{$(OBJ)}.h{$(INCDIR)}.h: + $(CP) $< $@ + +{$(OBJ)}.x{$(OBJ)}.c: + $(CP) $< $@ + +{}.rc{$(OBJ)}.res: + $(RC2RES) + +#---------------------------------------------------------------------- +# Announce the build directory + +!ifdef RELDIR +all:: announce + +test:: announce + +clean:: announce + +announce: + @echo. + @echo --------- Entering $(RELDIR:\= ): +!endif + +#---------------------------------------------------------------------- +# Create any required directories if they don't already exist + +prep:: mkdirs + +mkdirs: +! if !exist($(OBJ)) + $(MKDIR) $(OBJ) +! endif +! if !exist($(DESTDIR)) + $(MKDIR) $(DESTDIR) +! endif +! if !exist($(LIBDIR)) + $(MKDIR) $(LIBDIR) +! endif +! if !exist($(BINDIR)) + $(MKDIR) $(BINDIR) +! endif +! if !exist($(INCDIR)) + $(MKDIR) $(INCDIR) +! endif +! if !exist($(INCDIR)\gssapi) + $(MKDIR) $(INCDIR)\gssapi +! endif +! if !exist($(INCDIR)\hcrypto) + $(MKDIR) $(INCDIR)\hcrypto +! endif +! if !exist($(INCDIR)\kadm5) + $(MKDIR) $(INCDIR)\kadm5 +! endif + + +#---------------------------------------------------------------------- +# If SUBDIRS is defined, we should recurse into the subdirectories + +!ifdef SUBDIRS +subdirs: + @for %%f in ( $(SUBDIRS) ) do @ (cd %%f && $(RMAKE) && cd ..) || exit /b 1 + +clean-subdirs: + @for %%f in ( $(SUBDIRS) ) do @ (cd %%f && $(RMAKE) clean && cd ..) || exit /b 1 + +test-subdirs: + @for %%f in ( $(SUBDIRS) ) do @ (cd %%f && $(RMAKE) test && cd ..) || exit /b 1 + +all:: subdirs + +clean:: clean-subdirs + +test:: test-subdirs + +!endif + +#---------------------------------------------------------------------- +# Clean targets + +!ifdef CLEANFILES +clean:: + -$(RM) $(CLEANFILES) +!endif +!ifdef RELDIR +clean:: + -$(RM) $(OBJ)\*.* +!endif + +.SUFFIXES: .c .cpp .hin .h .x + +#---------------------------------------------------------------------- +# Manifest handling +# +# Starting with Visual Studio 8, the C compiler and the linker +# generate manifests so that the applications will link with the +# correct side-by-side DLLs at run-time. These are required for +# correct operation under Windows XP. We also have custom manifests +# which need to be merged with the manifests that VS creates. +# +# The syntax for invoking the _VC_MANIFEST_EMBED_foo macro is: +# $(_VC_MANIFEST_EMBED_???) +# + +MT=mt.exe -nologo + +_VC_MANIFEST_EMBED_EXE= \ +if exist $@.manifest $(MT) -outputresource:$@;1 -manifest $@.manifest + +_VC_MANIFEST_EMBED_DLL= \ +if exist $@.manifest $(MT) -outputresource:$@;2 -manifest $@.manifest + +# Note that if you are merging manifests, then the VS generated +# manifest should be cleaned up after calling _VC_MANIFEST_EMBED_???. +# This ensures that even if the DLL or EXE is executed in-place, the +# embedded manifest will be used. Otherwise the $@.manifest file will +# be used. +_VC_MANIFEST_CLEAN= \ +if exist $@.manifest $(RM) $@.manifest + +# End of manifest handling + +# Code signing +!ifdef CODESIGN +_CODESIGN=$(CODESIGN) $@ +!else +_CODESIGN= +!endif + + +#---------------------------------------------------------------------- +# Various libraries +# + +LIBROKEN =$(LIBDIR)\libroken.lib +LIBVERS =$(LIBDIR)\libvers.lib +LIBEDITLINE =$(LIBDIR)\libeditline.lib +LIBCOMERR =$(LIBDIR)\libcom_err.lib +LIBSL =$(LIBDIR)\libsl.lib +LIBWIND =$(LIBDIR)\libwind.lib +LIBASN1 =$(LIBDIR)\libasn1.lib +LIBSQLITE =$(LIBDIR)\libsqlite.lib +LIBHCRYPTO =$(LIBDIR)\libhcrypto.lib +LIBHX509 =$(LIBDIR)\libhx509.lib +LIBKRB5 =$(LIBDIR)\libkrb5.lib +LIBHEIMNTLM =$(LIBDIR)\libheimntlm.lib +LIBGSSAPI =$(LIBDIR)\libgssapi.lib +LIBHDB =$(LIBDIR)\libhdb.lib diff --git a/windows/version.rc b/windows/version.rc new file mode 100644 index 000000000..cb345f27f --- /dev/null +++ b/windows/version.rc @@ -0,0 +1,87 @@ +#include +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +#ifdef VER_PRIVATE +#define P_PRIVATE VS_FF_PRIVATEBUILD +#else +#define P_PRIVATE 0 +#endif + +#ifdef VER_SPECIAL +#define P_SPECIAL VS_FF_SPECIALBUILD +#else +#define P_SPECIAL 0 +#endif + +#ifdef VER_PRERELEASE +#define P_PRE VS_FF_PRERELEASE +#else +#define P_PRE 0 +#endif + +#ifdef VER_DEBUG +#define P_DEBUG VS_FF_DEBUG +#else +#define P_DEBUG 0 +#endif + +/* If some per-file values aren't specified, we use the application +values as a substitute */ + +#ifndef RC_FILEVER_C +#define RC_FILEVER_C RC_PRODVER_C +#define RC_FILE_VER_0409 RC_PRODUCT_VER_0409 +#endif + +#ifndef RC_FILE_SUBTYPE +#define RC_FILE_SUBTYPE VFT2_UNKNOWN +#endif + +#ifndef RC_FILE_INTERNAL_0409 +#define RC_FILE_INTERNAL_0409 RC_FILE_ORIG_0409 +#endif + +1 VERSIONINFO + FILEVERSION RC_FILEVER_C + PRODUCTVERSION RC_PRODVER_C + FILEFLAGSMASK (VS_FF_DEBUG|VS_FF_PRERELEASE|VS_FF_PRIVATEBUILD|VS_FF_SPECIALBUILD) + FILEFLAGS (P_DEBUG|P_PRE|P_PRIVATE|P_SPECIAL) + FILEOS VOS_NT + FILETYPE RC_FILE_TYPE + FILESUBTYPE RC_FILE_SUBTYPE + BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904E4" + BEGIN + VALUE "ProductName", RC_PRODUCT_NAME_0409 + VALUE "ProductVersion", RC_PRODUCT_VER_0409 + VALUE "CompanyName", RC_COMPANY_0409 + VALUE "LegalCopyright", RC_COPYRIGHT_0409 + +#ifdef RC_FILE_COMMENT_0409 + VALUE "Comments", RC_FILE_COMMENT_0409 +#endif +#ifdef RC_FILE_DESC_0409 + VALUE "FileDescription", RC_FILE_DESC_0409 +#endif + VALUE "FileVersion", RC_FILE_VER_0409 + VALUE "InternalName", RC_FILE_INTERNAL_0409 + VALUE "OriginalFilename", RC_FILE_ORIG_0409 +#ifdef VER_PRIVATE + VALUE "PrivateBuild", VER_PRIVATE +#endif +#ifdef VER_SPECIAL + VALUE "SpecialBuild", VER_SPECIAL +#endif + END + END + + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0409 /* US English */, 1252 /* Multilingual */ + END + END From 9d42b10027e1588136fde839d891c5c9be651947 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Fri, 24 Jul 2009 02:26:19 -0400 Subject: [PATCH 002/134] (krb5_config_parse_file_multi) Don't leak memory when the path tokens can't be expanded --- lib/krb5/config_file.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/krb5/config_file.c b/lib/krb5/config_file.c index df4de16a7..639a55c06 100644 --- a/lib/krb5/config_file.c +++ b/lib/krb5/config_file.c @@ -413,9 +413,6 @@ krb5_config_parse_file_multi (krb5_context context, unsigned lineno = 0; krb5_error_code ret; struct fileptr f; -#ifdef KRB5_USE_PATH_TOKENS - char * exp_fname = NULL; -#endif /** * If the fname starts with "~/" parse configuration file in the @@ -488,10 +485,20 @@ krb5_config_parse_file_multi (krb5_context context, } ======= #ifdef KRB5_USE_PATH_TOKENS - ret = _krb5_expand_path_tokens(context, fname, &exp_fname); - if (ret) - return ret; - fname = exp_fname; + { + char * exp_fname = NULL; + + ret = _krb5_expand_path_tokens(context, fname, &exp_fname); + if (ret) { + if (newfname) + free(newfname); + return ret; + } + + if (newfname) + free(newfname); + fname = newfname = exp_fname; + } #endif f.f = fopen(fname, "r"); @@ -502,10 +509,6 @@ krb5_config_parse_file_multi (krb5_context context, fname, strerror(ret)); if (newfname) free(newfname); -#ifdef KRB5_USE_PATH_TOKENS - if (exp_fname) - free (exp_fname); -#endif return ret; } @@ -515,19 +518,11 @@ krb5_config_parse_file_multi (krb5_context context, krb5_set_error_message (context, ret, "%s:%u: %s", fname, lineno, str); if (newfname) free(newfname); -#ifdef KRB5_USE_PATH_TOKENS - if (exp_fname) - free (exp_fname); -#endif return ret; >>>>>>> Initial Windows port } if (newfname) free(newfname); -#ifdef KRB5_USE_PATH_TOKENS - if (exp_fname) - free (exp_fname); -#endif return 0; } From eef0943c0efc2e4260e09eb7f9fee143b80f4114 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Fri, 24 Jul 2009 02:27:30 -0400 Subject: [PATCH 003/134] (compile_et.c) Pick the last path delimiter whichever kind of slash it is --- lib/com_err/compile_et.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/com_err/compile_et.c b/lib/com_err/compile_et.c index 500663af9..199ef94be 100644 --- a/lib/com_err/compile_et.c +++ b/lib/com_err/compile_et.c @@ -221,8 +221,16 @@ main(int argc, char **argv) p = strrchr(filename, '/'); #ifdef BACKSLASH_PATH_DELIM - if (!p) - p = strrchr(filename, '\\'); + { + char * bs = strrchr(filename, '\\'); + + if (p) { + if (p < bs) + p = bs; + } else { + p = bs; + } + } #endif if(p) p++; From 4da69ab0be7a582f57c7b57d70984fe1d950b0bb Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Fri, 24 Jul 2009 02:29:12 -0400 Subject: [PATCH 004/134] (krb5_sendto) Use IS_BAD_SOCKET() to check if the socket is bad --- lib/krb5/send_to_kdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index e8bcbcb43..54dec6c34 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -414,7 +414,7 @@ krb5_sendto (krb5_context context, for (a = ai; a != NULL; a = a->ai_next) { fd = socket (a->ai_family, a->ai_socktype | SOCK_CLOEXEC, a->ai_protocol); - if (fd < 0) + if (IS_BAD_SOCKET(fd)) continue; rk_cloexec(fd); if (connect (fd, a->ai_addr, a->ai_addrlen) < 0) { From 4332f79a82f66184da4b634d17ab982f8ccd4fd0 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Fri, 24 Jul 2009 02:30:56 -0400 Subject: [PATCH 005/134] (eread,ewrite) Remove redundant includes is included by . --- lib/roken/eread.c | 2 -- lib/roken/ewrite.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/lib/roken/eread.c b/lib/roken/eread.c index f102ff82d..ba30f0230 100644 --- a/lib/roken/eread.c +++ b/lib/roken/eread.c @@ -33,8 +33,6 @@ #include -#include - #include "roken.h" /* diff --git a/lib/roken/ewrite.c b/lib/roken/ewrite.c index 262b0183b..fce570529 100644 --- a/lib/roken/ewrite.c +++ b/lib/roken/ewrite.c @@ -33,8 +33,6 @@ #include -#include - #include "roken.h" /* From 867a1533be6a66fe7f5e0577640cc598955d4791 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Fri, 24 Jul 2009 02:31:31 -0400 Subject: [PATCH 006/134] (arg_match_long) Use UNREACHABLE() macro to mark up unreachable code --- lib/roken/getarg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/roken/getarg.c b/lib/roken/getarg.c index f2d132067..eac46e8f0 100644 --- a/lib/roken/getarg.c +++ b/lib/roken/getarg.c @@ -474,7 +474,7 @@ arg_match_long(struct getargs *args, size_t num_args, default: abort (); - return 0; /* Not-reached */ + UNREACHABLE(return 0); } /* not reached */ From 483da4ae9b19e270742463352524ee0e721b9552 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Fri, 24 Jul 2009 02:32:55 -0400 Subject: [PATCH 007/134] (mini_identd_addrinfo) Use closesocket() to close sockets Also, set closed sockets to INVALID_SOCKET so that they won't be closed again. --- lib/roken/mini_inetd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/roken/mini_inetd.c b/lib/roken/mini_inetd.c index a46ac3d68..7d113098c 100644 --- a/lib/roken/mini_inetd.c +++ b/lib/roken/mini_inetd.c @@ -88,12 +88,14 @@ mini_inetd_addrinfo (struct addrinfo *ai) socket_set_ipv6only(fds[i], 1); if (bind (fds[i], a->ai_addr, a->ai_addrlen) < 0) { warn ("bind af = %d", a->ai_family); - close(fds[i]); + closesocket(fds[i]); + fds[i] = INVALID_SOCKET; continue; } if (listen (fds[i], SOMAXCONN) < 0) { warn ("listen af = %d", a->ai_family); closesocket(fds[i]); + fds[i] = INVALID_SOCKET; continue; } #ifndef NO_LIMIT_FD_SETSIZE From 59a4c6b3699449478c2777347de99d2c9b626cbb Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Fri, 24 Jul 2009 02:34:01 -0400 Subject: [PATCH 008/134] Missing roken.h declarations for Visual C and Windows --- lib/roken/roken.h.in | 97 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 33dbdfd11..977bb445e 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -218,6 +218,67 @@ ROKEN_CPP_START #define setsid _setsid #endif +#ifdef _MSC_VER +/* Additional macros for Visual C/C++ runtime */ + +#define close _close + +#define getpid _getpid + +#define open _open + +#define chdir _chdir + +/* The MSVC implementation of snprintf is not C99 compliant. */ +#define snprintf rk_snprintf +#define vsnprintf rk_vsnprintf +#define vasnprintf rk_vasnprintf +#define vasprintf rk_vasprintf +#define asnprintf rk_asnprintf +#define asprintf rk_asprintf + +#define _PIPE_BUFFER_SZ 8192 +#define pipe(fds) _pipe((fds), _PIPE_BUFFER_SZ, O_BINARY); + +#define ftruncate(fd, sz) _chsize((fd), (sz)) + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +rk_snprintf (char *str, size_t sz, const char *format, ...); + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +rk_asprintf (char **ret, const char *format, ...); + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +rk_asnprintf (char **ret, size_t max_sz, const char *format, ...); + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +rk_vasprintf (char **ret, const char *format, va_list args); + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +rk_vasnprintf (char **ret, size_t max_sz, const char *format, va_list args); + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +rk_vsnprintf (char *str, size_t sz, const char *format, va_list args); + +/* missing stat.h predicates */ + +#define S_ISREG(m) (((m) & _S_IFREG) == _S_IFREG) + +#define S_ISDIR(m) (((m) & _S_IFDIR) == _S_IFDIR) + +#define S_ISCHR(m) (((m) & _S_IFCHR) == _S_IFCHR) + +#define S_ISFIFO(m) (((m) & _S_IFIFO) == _S_IFIFO) + +/* The following are not implemented: + + S_ISLNK(m) + S_ISSOCK(m) + S_ISBLK(m) +*/ + +#endif + #ifndef HAVE_PUTENV #define putenv rk_putenv ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL putenv(const char *); @@ -727,6 +788,37 @@ ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL gai_strerror(int); #endif +/* While we are at it, define WinSock specific scatter gather socket + I/O. */ + +#define iovec _WSABUF +#define iov_base buf +#define iov_len len + +struct msghdr { + void *msg_name; + socklen_t msg_namelen; + struct iovec *msg_iov; + size_t msg_iovlen; + void *msg_control; + socklen_t msg_controllen; + int msg_flags; +}; + +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL +sendmsg_w32(SOCKET s, const struct msghdr * msg, int flags); + +#define sendmsg(s,m,f) sendmsg_w32((s),(m),(f)) + +#endif + +#ifdef NO_SLEEP + +ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL +sleep(unsigned int seconds); + +#endif + ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL getnameinfo_verified(const struct sockaddr *, socklen_t, char *, size_t, @@ -750,6 +842,11 @@ ROKEN_LIB_FUNCTION char * ROKEN_LIB_CALL strptime (const char *, const char *, struct tm *); #endif +#ifndef HAVE_GETTIMEOFDAY +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +gettimeofday (struct timeval *, void *); +#endif + #ifndef HAVE_EMALLOC #define emalloc rk_emalloc ROKEN_LIB_FUNCTION void * ROKEN_LIB_CALL emalloc (size_t); From 6ca5815e3de59cc19253887d8a6dcc1eccf6e1ee Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Fri, 24 Jul 2009 02:34:32 -0400 Subject: [PATCH 009/134] Socket functions should use SOCKET instead of int --- lib/roken/roken-common.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/roken/roken-common.h b/lib/roken/roken-common.h index f1311641a..e83d5049c 100644 --- a/lib/roken/roken-common.h +++ b/lib/roken/roken-common.h @@ -280,11 +280,13 @@ ROKEN_CPP_START #ifndef IRIX4 /* fix for compiler bug */ +#ifndef _WIN32 #ifdef RETSIGTYPE typedef RETSIGTYPE (*SigAction)(int); SigAction signal(int iSig, SigAction pAction); /* BSD compatible */ #endif #endif +#endif #define simple_execve rk_simple_execve ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL @@ -377,23 +379,30 @@ socket_set_port (struct sockaddr *, int); #define socket_set_portrange rk_socket_set_portrange ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_portrange (int, int, int); +socket_set_portrange (SOCKET, int, int); #define socket_set_debug rk_socket_set_debug ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_debug (int); +socket_set_debug (SOCKET); #define socket_set_tos rk_socket_set_tos ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_tos (int, int); +socket_set_tos (SOCKET, int); #define socket_set_reuseaddr rk_socket_set_reuseaddr ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_reuseaddr (int, int); +socket_set_reuseaddr (SOCKET, int); #define socket_set_ipv6only rk_socket_set_ipv6only ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_ipv6only (int, int); +socket_set_ipv6only (SOCKET, int); + +#ifdef SOCKET_IS_NOT_AN_FD +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL +fd_from_socket(SOCKET, int); +#else +#define fd_from_socket(s,f) (s) +#endif #define vstrcollect rk_vstrcollect ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL From dc0b2b8648d40957cb243b744cb12c38299f86ee Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Fri, 24 Jul 2009 02:34:58 -0400 Subject: [PATCH 010/134] Missing foo_LIB_FUNCTION fixes --- cf/make-proto.pl | 3 ++- cf/win32.m4 | 1 + lib/krb5/appdefault.c | 2 +- lib/krb5/context.c | 4 ++-- lib/krb5/init_creds_pw.c | 2 +- lib/krb5/pkinit.c | 2 +- lib/krb5/prog_setup.c | 2 +- lib/krb5/verify_init.c | 2 +- lib/roken/dumpdata.c | 2 +- 9 files changed, 11 insertions(+), 9 deletions(-) diff --git a/cf/make-proto.pl b/cf/make-proto.pl index cad5ced74..12c6d07f5 100644 --- a/cf/make-proto.pl +++ b/cf/make-proto.pl @@ -323,6 +323,7 @@ if ($opt_E) { #define ${opt_E}_VARIABLE __declspec(dllimport) #else #define ${opt_E}_FUNCTION +#define ${opt_E}_CALL #define ${opt_E}_VARIABLE #endif #endif @@ -337,8 +338,8 @@ if ($opt_E) { #define ${opt_E}_VARIABLE __declspec(dllimport) #else #define ${opt_E}_FUNCTION -#define ${opt_E}_VARIABLE #define ${opt_E}_CALL +#define ${opt_E}_VARIABLE #endif #endif #endif diff --git a/cf/win32.m4 b/cf/win32.m4 index ac53bd0c9..5561ad966 100644 --- a/cf/win32.m4 +++ b/cf/win32.m4 @@ -8,6 +8,7 @@ AC_DEFUN([rk_WIN32_EXPORT],[AH_TOP([#ifdef $1 #define $2_VARIABLE __declspec(dllexport) #else #define $2_FUNCTION +#define $2_CALL #define $2_VARIABLE #endif #endif diff --git a/lib/krb5/appdefault.c b/lib/krb5/appdefault.c index a54e4214e..d4dc758fa 100644 --- a/lib/krb5/appdefault.c +++ b/lib/krb5/appdefault.c @@ -75,7 +75,7 @@ krb5_appdefault_boolean(krb5_context context, const char *appname, *ret_val = def_val; } -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_appdefault_string(krb5_context context, const char *appname, krb5_const_realm realm, const char *option, const char *def_val, char **ret_val) diff --git a/lib/krb5/context.c b/lib/krb5/context.c index a8aa1c682..c6454335a 100644 --- a/lib/krb5/context.c +++ b/lib/krb5/context.c @@ -373,7 +373,7 @@ copy_etypes (krb5_context context, * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_copy_context(krb5_context context, krb5_context *out) { krb5_error_code ret; @@ -1195,7 +1195,7 @@ krb5_get_kdc_sec_offset (krb5_context context, int32_t *sec, int32_t *usec) * @ingroup krb5 */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_kdc_sec_offset (krb5_context context, int32_t sec, int32_t usec) { context->kdc_sec_offset = sec; diff --git a/lib/krb5/init_creds_pw.c b/lib/krb5/init_creds_pw.c index e364c711d..1c8fda462 100644 --- a/lib/krb5/init_creds_pw.c +++ b/lib/krb5/init_creds_pw.c @@ -1866,7 +1866,7 @@ krb5_init_creds_get_error(krb5_context context, * @ingroup krb5_credential */ -void KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_init_creds_free(krb5_context context, krb5_init_creds_context ctx) { diff --git a/lib/krb5/pkinit.c b/lib/krb5/pkinit.c index 67dfb9498..1d3845435 100644 --- a/lib/krb5/pkinit.c +++ b/lib/krb5/pkinit.c @@ -2528,7 +2528,7 @@ find_ms_san(hx509_context context, hx509_cert cert, void *ctx) * Private since it need to be redesigned using krb5_get_init_creds() */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL _krb5_pk_enterprise_cert(krb5_context context, const char *user_id, krb5_const_realm realm, diff --git a/lib/krb5/prog_setup.c b/lib/krb5/prog_setup.c index 33e8b5301..1e83b4d06 100644 --- a/lib/krb5/prog_setup.c +++ b/lib/krb5/prog_setup.c @@ -35,7 +35,7 @@ #include #include -KRB5_LIB_FUNCTION void +KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_std_usage(int code, struct getargs *args, int num_args) { arg_printusage(args, num_args, NULL, ""); diff --git a/lib/krb5/verify_init.c b/lib/krb5/verify_init.c index f73942eb4..300cef007 100644 --- a/lib/krb5/verify_init.c +++ b/lib/krb5/verify_init.c @@ -211,7 +211,7 @@ cleanup: * @ingroup krb5_ccache */ -krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_validated_creds(krb5_context context, krb5_creds *creds, krb5_principal client, diff --git a/lib/roken/dumpdata.c b/lib/roken/dumpdata.c index 3280d7337..f30f0e54c 100644 --- a/lib/roken/dumpdata.c +++ b/lib/roken/dumpdata.c @@ -55,7 +55,7 @@ rk_dumpdata (const char *filename, const void *buf, size_t size) * Read all data from a filename, care about errors. */ -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_undumpdata(const char *filename, void **buf, size_t *size) { struct stat sb; From c08c4118530952aadc30ab6ba0674509e97f5af3 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:43:44 -0400 Subject: [PATCH 011/134] Add KRB4 and DIR_hdbdir to the FEATURE_DEFS list Add version.h and heim_threads.h to the list of include files. --- include/NTMakefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/NTMakefile b/include/NTMakefile index 1a5454877..144b6ed2a 100644 --- a/include/NTMakefile +++ b/include/NTMakefile @@ -38,9 +38,10 @@ SUBDIRS=kadm5 hcrypto gssapi INCFILES= \ $(INCDIR)\config.h \ - $(INCDIR)\version.h \ + $(INCDIR)\crypto-headers.h \ + $(INCDIR)\heim_threads.h \ $(INCDIR)\krb5-types.h \ - $(INCDIR)\crypto-headers.h + $(INCDIR)\version.h MAKECRYPTO=$(OBJ)\make_crypto.exe @@ -64,6 +65,7 @@ while(<>) { if (m/\@FEATURE_DEFS\@/) { if ("$(KRB5)") { print "#define KRB5 1\n"; } + if ("$(KRB4)") { print "#define KRB4 1\n"; } if ("$(PKINIT)") { print "#define PKINIT 1\n"; } if ("$(NO_AFS)") { print "#define NO_AFS 1\n"; } if ("$(OPENLDAP)") { print "#define OPENLDAP 1\n"; } @@ -77,6 +79,7 @@ while(<>) { if ("$(HAVE_PTHREAD_H)") { print "#define HAVE_PTHREAD_H 1\n"; } if ("$(ENV_HACK)") { print "#define ENV_HACK 1\n"; } if ("$(HAVE_KCM)") { print "#define HAVE_KCM 1\n"; } + if ("$(DIR_hdbdir)") { print "#define HDB_DB_DIR \"$(DIR_hdbdir)\"\n"; } } elsif (m/\@VERSION_OPTDEFS\@/) { @@ -101,6 +104,7 @@ while(<>) { print $_; } } + << $(INCDIR)\version.h: ..\windows\NTMakefile.config NTMakefile From 85e2907c1c425c7cbf3a450a6b0446955553179b Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:45:57 -0400 Subject: [PATCH 012/134] More changes to config.h.w32 Addition of : NO_PIDFILES : We don't create PID files NO_SIGPIPE, NO_SIGXCPU: These signals don't exist on Windows NO_UNIX_SOCKETS: No AF_UNIX support Also, ignore variable defintions when we are doing a preprocessor-only run. --- include/config.h.w32 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/config.h.w32 b/include/config.h.w32 index 0248bf061..1f0f7e966 100644 --- a/include/config.h.w32 +++ b/include/config.h.w32 @@ -1371,9 +1371,21 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } /* Define if fd_sets aren't limited to FD_SETSIZE sockets */ #define NO_LIMIT_FD_SETSIZE 1 +/* Define if PID files should not be used. */ +#define NO_PIDFILES 1 + +/* Define if SIGPIPE is not supported */ +#define NO_SIGPIPE 1 + +/* Define if SIGXCPU is not supported */ +#define NO_SIGXCPU 1 + /* Define if sleep() is not available */ #define NO_SLEEP 1 +/* Define to 1 if Unix sockets (AF_UNIX) are not available. */ +#define NO_UNIX_SOCKETS 1 + /* Define this to enable old environment option in telnet. */ /* #define OLD_ENVIRON 1 */ @@ -1453,6 +1465,8 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } #define SIGRETURN(x) return (RETSIGTYPE)(x) #endif +#ifndef CPP_ONLY + typedef int pid_t; typedef unsigned int gid_t; @@ -1461,6 +1475,8 @@ typedef unsigned int uid_t; typedef unsigned short mode_t; +#endif + #ifndef __cplusplus #define inline __inline #endif From 69554bf181f41bd926d1992f7d391804c1b54ef3 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:46:30 -0400 Subject: [PATCH 013/134] Use explicit-width integer types in krb5_types.h --- include/krb5-types.h.w32 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/krb5-types.h.w32 b/include/krb5-types.h.w32 index a5630823e..4506983a0 100644 --- a/include/krb5-types.h.w32 +++ b/include/krb5-types.h.w32 @@ -35,13 +35,13 @@ #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; typedef __int64 int64_t; -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; typedef uint8_t u_int8_t; typedef uint16_t u_int16_t; From 041b5c62927043df24a29506241c3121b10fbebf Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:48:07 -0400 Subject: [PATCH 014/134] Update asn/NTMakefile Be explicit about dependencies. A subsequent invocation of the NTMakefile should correctly deduce dependencies for generated files instead of assuming they are always out of date. --- lib/asn1/NTMakefile | 318 +++++++++++++++++++++++--------------------- 1 file changed, 165 insertions(+), 153 deletions(-) diff --git a/lib/asn1/NTMakefile b/lib/asn1/NTMakefile index fe22f88cd..a5c5f41d2 100644 --- a/lib/asn1/NTMakefile +++ b/lib/asn1/NTMakefile @@ -104,6 +104,7 @@ gen_files_k5 = \ $(OBJ)\asn1_PROV_SRV_LOCATION.x \ $(OBJ)\asn1_Principal.x \ $(OBJ)\asn1_PrincipalName.x \ + $(OBJ)\asn1_Principals.x \ $(OBJ)\asn1_Realm.x \ $(OBJ)\asn1_SAMFlags.x \ $(OBJ)\asn1_TGS_REP.x \ @@ -116,7 +117,6 @@ gen_files_k5 = \ $(OBJ)\asn1_krb5int32.x \ $(OBJ)\asn1_krb5uint32.x \ $(OBJ)\asn1_KRB5SignedPathData.x \ - $(OBJ)\asn1_KRB5SignedPathPrincipals.x \ $(OBJ)\asn1_KRB5SignedPath.x gen_files_cms = \ @@ -163,164 +163,175 @@ gen_files_cms = \ $(OBJ)\asn1_UnprotectedAttributes.x gen_files_rfc2459 = \ + $(OBJ)\asn1_AccessDescription.x \ + $(OBJ)\asn1_AlgorithmIdentifier.x \ + $(OBJ)\asn1_Attribute.x \ + $(OBJ)\asn1_AttributeType.x \ + $(OBJ)\asn1_AttributeTypeAndValue.x \ + $(OBJ)\asn1_AttributeValue.x \ + $(OBJ)\asn1_AuthorityInfoAccessSyntax.x \ + $(OBJ)\asn1_AuthorityKeyIdentifier.x \ + $(OBJ)\asn1_BaseDistance.x \ + $(OBJ)\asn1_BasicConstraints.x \ + $(OBJ)\asn1_CRLCertificateList.x \ + $(OBJ)\asn1_CRLDistributionPoints.x \ + $(OBJ)\asn1_CRLReason.x \ + $(OBJ)\asn1_Certificate.x \ + $(OBJ)\asn1_CertificateSerialNumber.x \ + $(OBJ)\asn1_Certificates.x \ + $(OBJ)\asn1_DHPublicKey.x \ + $(OBJ)\asn1_DSAParams.x \ + $(OBJ)\asn1_DSAPublicKey.x \ + $(OBJ)\asn1_DSASigValue.x \ + $(OBJ)\asn1_DigestInfo.x \ + $(OBJ)\asn1_DirectoryString.x \ + $(OBJ)\asn1_DistributionPoint.x \ + $(OBJ)\asn1_DistributionPointName.x \ + $(OBJ)\asn1_DistributionPointReasonFlags.x \ + $(OBJ)\asn1_DomainParameters.x \ + $(OBJ)\asn1_ECParameters.x \ + $(OBJ)\asn1_ECPoint.x \ + $(OBJ)\asn1_ECDSA_Sig_Value.x \ + $(OBJ)\asn1_ExtKeyUsage.x \ + $(OBJ)\asn1_Extension.x \ + $(OBJ)\asn1_Extensions.x \ + $(OBJ)\asn1_GeneralName.x \ + $(OBJ)\asn1_GeneralNames.x \ + $(OBJ)\asn1_GeneralSubtree.x \ + $(OBJ)\asn1_GeneralSubtrees.x \ + $(OBJ)\asn1_KeyIdentifier.x \ + $(OBJ)\asn1_KeyUsage.x \ + $(OBJ)\asn1_Name.x \ + $(OBJ)\asn1_NameConstraints.x \ + $(OBJ)\asn1_OtherName.x \ + $(OBJ)\asn1_PKIXXmppAddr.x \ + $(OBJ)\asn1_ProxyCertInfo.x \ + $(OBJ)\asn1_ProxyPolicy.x \ + $(OBJ)\asn1_RDNSequence.x \ + $(OBJ)\asn1_RSAPrivateKey.x \ + $(OBJ)\asn1_RSAPublicKey.x \ + $(OBJ)\asn1_RelativeDistinguishedName.x \ + $(OBJ)\asn1_SubjectKeyIdentifier.x \ + $(OBJ)\asn1_SubjectPublicKeyInfo.x \ + $(OBJ)\asn1_TBSCRLCertList.x \ + $(OBJ)\asn1_TBSCertificate.x \ + $(OBJ)\asn1_TeletexStringx.x \ + $(OBJ)\asn1_Time.x \ + $(OBJ)\asn1_UniqueIdentifier.x \ + $(OBJ)\asn1_ValidationParms.x \ + $(OBJ)\asn1_Validity.x \ $(OBJ)\asn1_Version.x \ - $(OBJ)\asn1_id_pkcs_1.x \ - $(OBJ)\asn1_id_pkcs1_rsaEncryption.x \ + $(OBJ)\asn1_id_Userid.x \ + $(OBJ)\asn1_id_aes_128_cbc.x \ + $(OBJ)\asn1_id_aes_192_cbc.x \ + $(OBJ)\asn1_id_aes_256_cbc.x \ + $(OBJ)\asn1_id_at_commonName.x \ + $(OBJ)\asn1_id_at_countryName.x \ + $(OBJ)\asn1_id_at_generationQualifier.x \ + $(OBJ)\asn1_id_at_givenName.x \ + $(OBJ)\asn1_id_at_initials.x \ + $(OBJ)\asn1_id_at_localityName.x \ + $(OBJ)\asn1_id_at_name.x \ + $(OBJ)\asn1_id_at_organizationName.x \ + $(OBJ)\asn1_id_at_organizationalUnitName.x \ + $(OBJ)\asn1_id_at_pseudonym.x \ + $(OBJ)\asn1_id_at_serialNumber.x \ + $(OBJ)\asn1_id_at_stateOrProvinceName.x \ + $(OBJ)\asn1_id_at_streetAddress.x \ + $(OBJ)\asn1_id_at_surname.x \ + $(OBJ)\asn1_id_dhpublicnumber.x \ + $(OBJ)\asn1_id_domainComponent.x \ + $(OBJ)\asn1_id_dsa.x \ + $(OBJ)\asn1_id_dsa_with_sha1.x \ + $(OBJ)\asn1_id_ecDH.x \ + $(OBJ)\asn1_id_ecMQV.x \ + $(OBJ)\asn1_id_ecPublicKey.x \ + $(OBJ)\asn1_id_ec_group_secp160r1.x \ + $(OBJ)\asn1_id_ec_group_secp160r2.x \ + $(OBJ)\asn1_id_ec_group_secp256r1.x \ + $(OBJ)\asn1_id_ecdsa_with_SHA1.x \ + $(OBJ)\asn1_id_ecdsa_with_SHA256.x \ + $(OBJ)\asn1_id_heim_rsa_pkcs1_x509.x \ + $(OBJ)\asn1_id_ms_cert_enroll_domaincontroller.x \ + $(OBJ)\asn1_id_ms_client_authentication.x \ + $(OBJ)\asn1_id_netscape.x \ + $(OBJ)\asn1_id_netscape_cert_comment.x \ + $(OBJ)\asn1_id_nistAlgorithm.x \ + $(OBJ)\asn1_id_nist_aes_algs.x \ + $(OBJ)\asn1_id_nist_sha_algs.x \ $(OBJ)\asn1_id_pkcs1_md2WithRSAEncryption.x \ $(OBJ)\asn1_id_pkcs1_md5WithRSAEncryption.x \ + $(OBJ)\asn1_id_pkcs1_rsaEncryption.x \ $(OBJ)\asn1_id_pkcs1_sha1WithRSAEncryption.x \ $(OBJ)\asn1_id_pkcs1_sha256WithRSAEncryption.x \ $(OBJ)\asn1_id_pkcs1_sha384WithRSAEncryption.x \ $(OBJ)\asn1_id_pkcs1_sha512WithRSAEncryption.x \ - $(OBJ)\asn1_id_heim_rsa_pkcs1_x509.x \ - $(OBJ)\asn1_id_pkcs_2.x \ $(OBJ)\asn1_id_pkcs2_md2.x \ $(OBJ)\asn1_id_pkcs2_md4.x \ $(OBJ)\asn1_id_pkcs2_md5.x \ - $(OBJ)\asn1_id_rsa_digestAlgorithm.x \ - $(OBJ)\asn1_id_rsa_digest_md2.x \ - $(OBJ)\asn1_id_rsa_digest_md4.x \ - $(OBJ)\asn1_id_rsa_digest_md5.x \ - $(OBJ)\asn1_id_pkcs_3.x \ + $(OBJ)\asn1_id_pkcs3_des_ede3_cbc.x \ $(OBJ)\asn1_id_pkcs3_rc2_cbc.x \ $(OBJ)\asn1_id_pkcs3_rc4.x \ - $(OBJ)\asn1_id_pkcs3_des_ede3_cbc.x \ - $(OBJ)\asn1_id_rsadsi_encalg.x \ - $(OBJ)\asn1_id_rsadsi_rc2_cbc.x \ - $(OBJ)\asn1_id_rsadsi_des_ede3_cbc.x \ - $(OBJ)\asn1_id_secsig_sha_1.x \ - $(OBJ)\asn1_id_nistAlgorithm.x \ - $(OBJ)\asn1_id_nist_aes_algs.x \ - $(OBJ)\asn1_id_aes_128_cbc.x \ - $(OBJ)\asn1_id_aes_192_cbc.x \ - $(OBJ)\asn1_id_aes_256_cbc.x \ - $(OBJ)\asn1_id_nist_sha_algs.x \ - $(OBJ)\asn1_id_sha256.x \ - $(OBJ)\asn1_id_sha224.x \ - $(OBJ)\asn1_id_sha384.x \ - $(OBJ)\asn1_id_sha512.x \ - $(OBJ)\asn1_id_dhpublicnumber.x \ - $(OBJ)\asn1_id_x9_57.x \ - $(OBJ)\asn1_id_dsa.x \ - $(OBJ)\asn1_id_dsa_with_sha1.x \ - $(OBJ)\asn1_id_x520_at.x \ - $(OBJ)\asn1_id_at_commonName.x \ - $(OBJ)\asn1_id_at_surname.x \ - $(OBJ)\asn1_id_at_serialNumber.x \ - $(OBJ)\asn1_id_at_countryName.x \ - $(OBJ)\asn1_id_at_localityName.x \ - $(OBJ)\asn1_id_at_streetAddress.x \ - $(OBJ)\asn1_id_at_stateOrProvinceName.x \ - $(OBJ)\asn1_id_at_organizationName.x \ - $(OBJ)\asn1_id_at_organizationalUnitName.x \ - $(OBJ)\asn1_id_at_name.x \ - $(OBJ)\asn1_id_at_givenName.x \ - $(OBJ)\asn1_id_at_initials.x \ - $(OBJ)\asn1_id_at_generationQualifier.x \ - $(OBJ)\asn1_id_at_pseudonym.x \ - $(OBJ)\asn1_id_Userid.x \ - $(OBJ)\asn1_id_domainComponent.x \ - $(OBJ)\asn1_id_x509_ce.x \ - $(OBJ)\asn1_id_uspkicommon_card_id.x \ - $(OBJ)\asn1_id_uspkicommon_piv_interim.x \ - $(OBJ)\asn1_id_netscape.x \ - $(OBJ)\asn1_id_netscape_cert_comment.x \ - $(OBJ)\asn1_id_ms_cert_enroll_domaincontroller.x \ - $(OBJ)\asn1_id_ms_client_authentication.x \ - $(OBJ)\asn1_AlgorithmIdentifier.x \ - $(OBJ)\asn1_AttributeType.x \ - $(OBJ)\asn1_AttributeValue.x \ - $(OBJ)\asn1_TeletexStringx.x \ - $(OBJ)\asn1_DirectoryString.x \ - $(OBJ)\asn1_Attribute.x \ - $(OBJ)\asn1_AttributeTypeAndValue.x \ - $(OBJ)\asn1_AuthorityInfoAccessSyntax.x \ - $(OBJ)\asn1_AccessDescription.x \ - $(OBJ)\asn1_RelativeDistinguishedName.x \ - $(OBJ)\asn1_RDNSequence.x \ - $(OBJ)\asn1_Name.x \ - $(OBJ)\asn1_CertificateSerialNumber.x \ - $(OBJ)\asn1_Time.x \ - $(OBJ)\asn1_Validity.x \ - $(OBJ)\asn1_UniqueIdentifier.x \ - $(OBJ)\asn1_SubjectPublicKeyInfo.x \ - $(OBJ)\asn1_Extension.x \ - $(OBJ)\asn1_Extensions.x \ - $(OBJ)\asn1_TBSCertificate.x \ - $(OBJ)\asn1_Certificate.x \ - $(OBJ)\asn1_Certificates.x \ - $(OBJ)\asn1_ValidationParms.x \ - $(OBJ)\asn1_DomainParameters.x \ - $(OBJ)\asn1_DHPublicKey.x \ - $(OBJ)\asn1_OtherName.x \ - $(OBJ)\asn1_GeneralName.x \ - $(OBJ)\asn1_GeneralNames.x \ - $(OBJ)\asn1_id_x509_ce_keyUsage.x \ - $(OBJ)\asn1_KeyUsage.x \ - $(OBJ)\asn1_id_x509_ce_authorityKeyIdentifier.x \ - $(OBJ)\asn1_KeyIdentifier.x \ - $(OBJ)\asn1_AuthorityKeyIdentifier.x \ - $(OBJ)\asn1_id_x509_ce_subjectKeyIdentifier.x \ - $(OBJ)\asn1_SubjectKeyIdentifier.x \ - $(OBJ)\asn1_id_x509_ce_basicConstraints.x \ - $(OBJ)\asn1_BasicConstraints.x \ - $(OBJ)\asn1_id_x509_ce_nameConstraints.x \ - $(OBJ)\asn1_BaseDistance.x \ - $(OBJ)\asn1_GeneralSubtree.x \ - $(OBJ)\asn1_GeneralSubtrees.x \ - $(OBJ)\asn1_NameConstraints.x \ - $(OBJ)\asn1_id_x509_ce_privateKeyUsagePeriod.x \ - $(OBJ)\asn1_id_x509_ce_certificatePolicies.x \ - $(OBJ)\asn1_id_x509_ce_policyMappings.x \ - $(OBJ)\asn1_id_x509_ce_subjectAltName.x \ - $(OBJ)\asn1_id_x509_ce_issuerAltName.x \ - $(OBJ)\asn1_id_x509_ce_subjectDirectoryAttributes.x \ - $(OBJ)\asn1_id_x509_ce_policyConstraints.x \ - $(OBJ)\asn1_id_x509_ce_extKeyUsage.x \ - $(OBJ)\asn1_ExtKeyUsage.x \ - $(OBJ)\asn1_id_x509_ce_cRLDistributionPoints.x \ - $(OBJ)\asn1_id_x509_ce_deltaCRLIndicator.x \ - $(OBJ)\asn1_id_x509_ce_issuingDistributionPoint.x \ - $(OBJ)\asn1_id_x509_ce_holdInstructionCode.x \ - $(OBJ)\asn1_id_x509_ce_invalidityDate.x \ - $(OBJ)\asn1_id_x509_ce_certificateIssuer.x \ - $(OBJ)\asn1_id_x509_ce_inhibitAnyPolicy.x \ - $(OBJ)\asn1_DistributionPointReasonFlags.x \ - $(OBJ)\asn1_DistributionPointName.x \ - $(OBJ)\asn1_DistributionPoint.x \ - $(OBJ)\asn1_CRLDistributionPoints.x \ - $(OBJ)\asn1_DSASigValue.x \ - $(OBJ)\asn1_DSAPublicKey.x \ - $(OBJ)\asn1_DSAParams.x \ - $(OBJ)\asn1_RSAPublicKey.x \ - $(OBJ)\asn1_RSAPrivateKey.x \ - $(OBJ)\asn1_DigestInfo.x \ - $(OBJ)\asn1_TBSCRLCertList.x \ - $(OBJ)\asn1_CRLCertificateList.x \ - $(OBJ)\asn1_id_x509_ce_cRLNumber.x \ - $(OBJ)\asn1_id_x509_ce_freshestCRL.x \ - $(OBJ)\asn1_id_x509_ce_cRLReason.x \ - $(OBJ)\asn1_CRLReason.x \ - $(OBJ)\asn1_PKIXXmppAddr.x \ + $(OBJ)\asn1_id_pkcs_1.x \ + $(OBJ)\asn1_id_pkcs_2.x \ + $(OBJ)\asn1_id_pkcs_3.x \ $(OBJ)\asn1_id_pkix.x \ + $(OBJ)\asn1_id_pkix_kp.x \ + $(OBJ)\asn1_id_pkix_kp_OCSPSigning.x \ + $(OBJ)\asn1_id_pkix_kp_clientAuth.x \ + $(OBJ)\asn1_id_pkix_kp_emailProtection.x \ + $(OBJ)\asn1_id_pkix_kp_serverAuth.x \ + $(OBJ)\asn1_id_pkix_kp_timeStamping.x \ $(OBJ)\asn1_id_pkix_on.x \ $(OBJ)\asn1_id_pkix_on_dnsSRV.x \ $(OBJ)\asn1_id_pkix_on_xmppAddr.x \ - $(OBJ)\asn1_id_pkix_kp.x \ - $(OBJ)\asn1_id_pkix_kp_serverAuth.x \ - $(OBJ)\asn1_id_pkix_kp_clientAuth.x \ - $(OBJ)\asn1_id_pkix_kp_emailProtection.x \ - $(OBJ)\asn1_id_pkix_kp_timeStamping.x \ - $(OBJ)\asn1_id_pkix_kp_OCSPSigning.x \ $(OBJ)\asn1_id_pkix_pe.x \ $(OBJ)\asn1_id_pkix_pe_authorityInfoAccess.x \ $(OBJ)\asn1_id_pkix_pe_proxyCertInfo.x \ $(OBJ)\asn1_id_pkix_ppl.x \ $(OBJ)\asn1_id_pkix_ppl_anyLanguage.x \ - $(OBJ)\asn1_id_pkix_ppl_inheritAll.x \ $(OBJ)\asn1_id_pkix_ppl_independent.x \ - $(OBJ)\asn1_ProxyPolicy.x \ - $(OBJ)\asn1_ProxyCertInfo.x + $(OBJ)\asn1_id_pkix_ppl_inheritAll.x \ + $(OBJ)\asn1_id_rsa_digestAlgorithm.x \ + $(OBJ)\asn1_id_rsa_digest_md2.x \ + $(OBJ)\asn1_id_rsa_digest_md4.x \ + $(OBJ)\asn1_id_rsa_digest_md5.x \ + $(OBJ)\asn1_id_rsadsi_des_ede3_cbc.x \ + $(OBJ)\asn1_id_rsadsi_encalg.x \ + $(OBJ)\asn1_id_rsadsi_rc2_cbc.x \ + $(OBJ)\asn1_id_secsig_sha_1.x \ + $(OBJ)\asn1_id_sha224.x \ + $(OBJ)\asn1_id_sha256.x \ + $(OBJ)\asn1_id_sha384.x \ + $(OBJ)\asn1_id_sha512.x \ + $(OBJ)\asn1_id_uspkicommon_card_id.x \ + $(OBJ)\asn1_id_uspkicommon_piv_interim.x \ + $(OBJ)\asn1_id_x509_ce.x \ + $(OBJ)\asn1_id_x509_ce_authorityKeyIdentifier.x \ + $(OBJ)\asn1_id_x509_ce_basicConstraints.x \ + $(OBJ)\asn1_id_x509_ce_cRLDistributionPoints.x \ + $(OBJ)\asn1_id_x509_ce_cRLNumber.x \ + $(OBJ)\asn1_id_x509_ce_cRLReason.x \ + $(OBJ)\asn1_id_x509_ce_certificateIssuer.x \ + $(OBJ)\asn1_id_x509_ce_certificatePolicies.x \ + $(OBJ)\asn1_id_x509_ce_deltaCRLIndicator.x \ + $(OBJ)\asn1_id_x509_ce_extKeyUsage.x \ + $(OBJ)\asn1_id_x509_ce_freshestCRL.x \ + $(OBJ)\asn1_id_x509_ce_holdInstructionCode.x \ + $(OBJ)\asn1_id_x509_ce_inhibitAnyPolicy.x \ + $(OBJ)\asn1_id_x509_ce_invalidityDate.x \ + $(OBJ)\asn1_id_x509_ce_issuerAltName.x \ + $(OBJ)\asn1_id_x509_ce_issuingDistributionPoint.x \ + $(OBJ)\asn1_id_x509_ce_keyUsage.x \ + $(OBJ)\asn1_id_x509_ce_nameConstraints.x \ + $(OBJ)\asn1_id_x509_ce_policyConstraints.x \ + $(OBJ)\asn1_id_x509_ce_policyMappings.x \ + $(OBJ)\asn1_id_x509_ce_privateKeyUsagePeriod.x \ + $(OBJ)\asn1_id_x509_ce_subjectAltName.x \ + $(OBJ)\asn1_id_x509_ce_subjectDirectoryAttributes.x \ + $(OBJ)\asn1_id_x509_ce_subjectKeyIdentifier.x \ + $(OBJ)\asn1_id_x520_at.x \ + $(OBJ)\asn1_id_x9_57.x gen_files_pkinit = \ $(OBJ)\asn1_id_pkinit.x \ @@ -359,10 +370,11 @@ gen_files_pkinit = \ $(OBJ)\asn1_TrustedCA_Win2k.x \ $(OBJ)\asn1_PA_PK_AS_REQ_Win2k.x \ $(OBJ)\asn1_PA_PK_AS_REP_Win2k.x \ + $(OBJ)\asn1_PA_PK_AS_REP_BTMM.x \ $(OBJ)\asn1_KDCDHKeyInfo_Win2k.x \ $(OBJ)\asn1_ReplyKeyPack_Win2k.x \ $(OBJ)\asn1_PkinitSP80056AOtherInfo.x \ - $(OBJ)\asn1_PkinitSuppPubInfo.x + $(OBJ)\asn1_PkinitSuppPubInfo.x gen_files_pkcs12 = \ $(OBJ)\asn1_id_pkcs_12.x \ @@ -475,18 +487,18 @@ $(BINDIR)\asn1_compile.exe: \ $(OBJ)\hash.obj \ $(OBJ)\lex.obj \ $(OBJ)\main.obj \ - $(OBJ)\parse.obj \ + $(OBJ)\asn1parse.obj \ $(OBJ)\symbol.obj $(EXECONLINK) $(LIBROKEN) $(LIBVERS) $(_VC_MANIFEST_EMBED_EXE) $(_VC_MANIFEST_CLEAN) $(_CODESIGN) -$(OBJ)\lex.c: lex.l $(OBJ)\parse.h +$(OBJ)\lex.c: lex.l $(OBJ)\asn1parse.h $(LEX) -o$@ lex.l -$(OBJ)\parse.c $(OBJ)\parse.h: parse.y - $(YACC) -o $(OBJ)\parse.c --defines=$(OBJ)\parse.h $** +$(OBJ)\asn1parse.c $(OBJ)\asn1parse.h: asn1parse.y + $(YACC) -o $(OBJ)\asn1parse.c --defines=$(OBJ)\asn1parse.h $** $(OBJ)\asn1_err.c $(OBJ)\asn1_err.h: asn1_err.et cd $(OBJ) @@ -554,7 +566,7 @@ $(gen_files_cms:.x=.c) : $$(@R).x $(gen_files_test:.x=.c) : $$(@R).x -$(gen_files_k5) $(OBJ)\krb5_asn1.h: $(BINDIR)\asn1_compile.exe k5.asn1 +$(gen_files_k5) $(OBJ)\krb5_asn1.hx: $(BINDIR)\asn1_compile.exe krb5.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe \ --encode-rfc1510-bit-string \ @@ -563,47 +575,47 @@ $(gen_files_k5) $(OBJ)\krb5_asn1.h: $(BINDIR)\asn1_compile.exe k5.asn1 --sequence=METHOD-DATA \ --sequence=ETYPE-INFO \ --sequence=ETYPE-INFO2 \ - $(SRCDIR)\k5.asn1 krb5_asn1 \ + $(SRCDIR)\krb5.asn1 krb5_asn1 \ || ($(RM) $(OBJ)\krb5_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_pkinit) $(OBJ)\pkinit_asn1.h: $(BINDIR)\asn1_compile.exe pkinit.asn1 +$(gen_files_pkinit) $(OBJ)\pkinit_asn1.hx: $(BINDIR)\asn1_compile.exe pkinit.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe $(SRCDIR)\pkinit.asn1 pkinit_asn1 \ || ($(RM) $(OBJ)\pkinit_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_pkcs8) $(OBJ)\pkcs8_asn1.h: $(BINDIR)\asn1_compile.exe pkcs8.asn1 +$(gen_files_pkcs8) $(OBJ)\pkcs8_asn1.hx: $(BINDIR)\asn1_compile.exe pkcs8.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe $(SRCDIR)\pkcs8.asn1 pkcs8_asn1 \ || ($(RM) $(OBJ)\pkcs8_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_pkcs9) $(OBJ)\pkcs9_asn1.h: $(BINDIR)\asn1_compile.exe pkcs9.asn1 +$(gen_files_pkcs9) $(OBJ)\pkcs9_asn1.hx: $(BINDIR)\asn1_compile.exe pkcs9.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe $(SRCDIR)\pkcs9.asn1 pkcs9_asn1 \ || ($(RM) $(OBJ)\pkcs9_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_pkcs12) $(OBJ)\pkcs12_asn1.h: $(BINDIR)\asn1_compile.exe pkcs12.asn1 +$(gen_files_pkcs12) $(OBJ)\pkcs12_asn1.hx: $(BINDIR)\asn1_compile.exe pkcs12.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe $(SRCDIR)\pkcs12.asn1 pkcs12_asn1 \ || ($(RM) $(OBJ)\pkcs12_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_digest) $(OBJ)\digest_asn1.h: $(BINDIR)\asn1_compile.exe digest.asn1 +$(gen_files_digest) $(OBJ)\digest_asn1.hx: $(BINDIR)\asn1_compile.exe digest.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe $(SRCDIR)\digest.asn1 digest_asn1 \ || ($(RM) $(OBJ)\digest_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_kx509) $(OBJ)\kx509_asn1.h: $(BINDIR)\asn1_compile.exe kx509.asn1 +$(gen_files_kx509) $(OBJ)\kx509_asn1.hx: $(BINDIR)\asn1_compile.exe kx509.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe $(SRCDIR)\kx509.asn1 kx509_asn1 \ || ($(RM) $(OBJ)\kx509_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_rfc2459) $(OBJ)\rfc2459_asn1.h: $(BINDIR)\asn1_compile.exe rfc2459.asn1 +$(gen_files_rfc2459) $(OBJ)\rfc2459_asn1.hx: $(BINDIR)\asn1_compile.exe rfc2459.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe \ --preserve-binary=TBSCertificate \ @@ -616,13 +628,13 @@ $(gen_files_rfc2459) $(OBJ)\rfc2459_asn1.h: $(BINDIR)\asn1_compile.exe rfc2459.a || ($(RM) $(OBJ)\krb5_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_cms) $(OBJ)\cms_asn1.h: $(BINDIR)\asn1_compile.exe cms.asn1 +$(gen_files_cms) $(OBJ)\cms_asn1.hx: $(BINDIR)\asn1_compile.exe cms.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe $(SRCDIR)\CMS.asn1 cms_asn1 \ || ($(RM) $(OBJ)\cms_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_test) $(OBJ)\test_asn1.h: $(BINDIR)\asn1_compile.exe test.asn1 +$(gen_files_test) $(OBJ)\test_asn1.hx: $(BINDIR)\asn1_compile.exe test.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe \ --sequence=TESTSeqOf \ From 72537c1f83eb3961ad6da127bd218f1b9c9a188d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:48:31 -0400 Subject: [PATCH 015/134] Update gssapi/NTMakefile --- lib/gssapi/NTMakefile | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/gssapi/NTMakefile b/lib/gssapi/NTMakefile index b00e14e24..4fdc275ee 100644 --- a/lib/gssapi/NTMakefile +++ b/lib/gssapi/NTMakefile @@ -39,6 +39,7 @@ krb5src = \ krb5/acquire_cred.c \ krb5/add_cred.c \ krb5/address_to_krb5addr.c \ + krb5/aeap.c \ krb5/arcfour.c \ krb5/canonicalize_name.c \ krb5/ccache_name.c \ @@ -77,11 +78,11 @@ krb5src = \ krb5/release_cred.c \ krb5/release_name.c \ krb5/sequence.c \ + krb5/store_cred.c \ krb5/set_cred_option.c \ krb5/set_sec_context_option.c \ krb5/ticket_flags.c \ krb5/unwrap.c \ - krb5/v1.c \ krb5/verify_mic.c \ krb5/wrap.c @@ -89,10 +90,12 @@ mechsrc = \ mech/context.h \ mech/context.c \ mech/cred.h \ + mech/doxygen.c \ mech/gss_accept_sec_context.c \ mech/gss_acquire_cred.c \ mech/gss_add_cred.c \ mech/gss_add_oid_set_member.c \ + mech/gss_aeap.c \ mech/gss_buffer_set.c \ mech/gss_canonicalize_name.c \ mech/gss_compare_name.c \ @@ -134,6 +137,7 @@ mechsrc = \ mech/gss_set_cred_option.c \ mech/gss_set_sec_context_option.c \ mech/gss_sign.c \ + mech/gss_store_cred.c \ mech/gss_test_oid_set_member.c \ mech/gss_unseal.c \ mech/gss_unwrap.c \ @@ -186,7 +190,7 @@ ntlmsrc = \ ntlm/process_context_token.c \ ntlm/release_cred.c \ ntlm/release_name.c \ - ntlm/digest.c + ntlm/kdc.c $(OBJ)\ntlm\ntlm-private.h: $(ntlmsrc) $(PERL) ../../cf/make-proto.pl -q -P remove -p $@ $(ntlmsrc) @@ -215,13 +219,19 @@ $(gssapi_files:.x=.c): $$(@R).x $(spnego_files:.x=.c): $$(@R).x -$(gssapi_files) $(OBJ)\gssapi\gssapi_asn1.h: $(BINDIR)\asn1_compile.exe mech\gssapi.asn1 +$(OBJ)\gssapi\gssapi_asn1.h: $(OBJ)\gssapi\gssapi_asn1.hx + $(CP) $** $@ + +$(OBJ)\spnego\spnego_asn1.h: $(OBJ)\spnego\spnego_asn1.hx + $(CP) $** $@ + +$(gssapi_files) $(OBJ)\gssapi\gssapi_asn1.hx: $(BINDIR)\asn1_compile.exe mech\gssapi.asn1 cd $(OBJ)\gssapi $(BINDIR)\asn1_compile.exe $(SRCDIR)\mech\gssapi.asn1 gssapi_asn1 \ || ( $(RM) $(OBJ)\gssapi\gssapi_asn1.h ; exit /b 1 ) cd $(SRCDIR) -$(spnego_files) $(OBJ)\spnego\spnego_asn1.h: $(BINDIR)\asn1_compile.exe spnego\spnego.asn1 +$(spnego_files) $(OBJ)\spnego\spnego_asn1.hx: $(BINDIR)\asn1_compile.exe spnego\spnego.asn1 cd $(OBJ)\spnego $(BINDIR)\asn1_compile --sequence=MechTypeList $(SRCDIR)\spnego\spnego.asn1 spnego_asn1 \ || ( $(RM) $(OBJ)\spnego\spnego_asn1.h ; exit /b 1 ) @@ -249,6 +259,7 @@ libgssapi_OBJs= \ $(OBJ)\krb5\acquire_cred.obj \ $(OBJ)\krb5\add_cred.obj \ $(OBJ)\krb5\address_to_krb5addr.obj \ + $(OBJ)\krb5\aeap.obj \ $(OBJ)\krb5\arcfour.obj \ $(OBJ)\krb5\canonicalize_name.obj \ $(OBJ)\krb5\ccache_name.obj \ @@ -285,18 +296,20 @@ libgssapi_OBJs= \ $(OBJ)\krb5\release_cred.obj \ $(OBJ)\krb5\release_name.obj \ $(OBJ)\krb5\sequence.obj \ + $(OBJ)\krb5\store_cred.obj \ $(OBJ)\krb5\set_cred_option.obj \ $(OBJ)\krb5\set_sec_context_option.obj \ $(OBJ)\krb5\ticket_flags.obj \ $(OBJ)\krb5\unwrap.obj \ - $(OBJ)\krb5\v1.obj \ $(OBJ)\krb5\verify_mic.obj \ $(OBJ)\krb5\wrap.obj \ $(OBJ)\mech\context.obj \ + $(OBJ)\mech\doxygen.obj \ $(OBJ)\mech\gss_accept_sec_context.obj \ $(OBJ)\mech\gss_acquire_cred.obj \ $(OBJ)\mech\gss_add_cred.obj \ $(OBJ)\mech\gss_add_oid_set_member.obj \ + $(OBJ)\mech\gss_aeap.obj \ $(OBJ)\mech\gss_buffer_set.obj \ $(OBJ)\mech\gss_canonicalize_name.obj \ $(OBJ)\mech\gss_compare_name.obj \ @@ -338,6 +351,7 @@ libgssapi_OBJs= \ $(OBJ)\mech\gss_set_cred_option.obj \ $(OBJ)\mech\gss_set_sec_context_option.obj \ $(OBJ)\mech\gss_sign.obj \ + $(OBJ)\mech\gss_store_cred.obj \ $(OBJ)\mech\gss_test_oid_set_member.obj \ $(OBJ)\mech\gss_unseal.obj \ $(OBJ)\mech\gss_unwrap.obj \ @@ -373,7 +387,7 @@ libgssapi_OBJs= \ $(OBJ)\ntlm\process_context_token.obj \ $(OBJ)\ntlm\release_cred.obj \ $(OBJ)\ntlm\release_name.obj \ - $(OBJ)\ntlm\digest.obj \ + $(OBJ)\ntlm\kdc.obj \ $(OBJ)\spnego\accept_sec_context.obj \ $(OBJ)\spnego\compat.obj \ $(OBJ)\spnego\context_stubs.obj \ @@ -384,7 +398,7 @@ libgssapi_OBJs= \ $(spnego_files:.x=.obj) \ $(gssapi_files:.x=.obj) -GCOPTS=-I$(SRCDIR) -I$(OBJ) -DBUILD_GSSAPI_LIB +GCOPTS=-I$(SRCDIR) -I$(OBJ) -Igssapi -DBUILD_GSSAPI_LIB {$(OBJ)\krb5}.c{$(OBJ)\krb5}.obj: $(C2OBJ) -I$(OBJ)\krb5 $(GCOPTS) @@ -408,7 +422,7 @@ GCOPTS=-I$(SRCDIR) -I$(OBJ) -DBUILD_GSSAPI_LIB $(C2OBJ) -I$(OBJ)\spnego $(GCOPTS) {spnego}.c{$(OBJ)\spnego}.obj: - $(C2OBJ) -I$(OBJ)\spnego $(GCOPTS) + $(C2OBJ) -I$(OBJ)\spnego -Imech $(GCOPTS) {$(OBJ)\gssapi}.c{$(OBJ)\gssapi}.obj: $(C2OBJ) -I$(OBJ)\gssapi $(GCOPTS) From ce7d7846481d78d953a7843ef900015ec2921d5b Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:49:41 -0400 Subject: [PATCH 016/134] Avoid using 'interface' as a variable name --- lib/gssapi/ntlm/accept_sec_context.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gssapi/ntlm/accept_sec_context.c b/lib/gssapi/ntlm/accept_sec_context.c index 9efa1c8cf..93abe317e 100644 --- a/lib/gssapi/ntlm/accept_sec_context.c +++ b/lib/gssapi/ntlm/accept_sec_context.c @@ -41,17 +41,17 @@ OM_uint32 _gss_ntlm_allocate_ctx(OM_uint32 *minor_status, ntlm_ctx *ctx) { OM_uint32 maj_stat; - struct ntlm_server_interface *interface = NULL; + struct ntlm_server_interface *ns_interface = NULL; #ifdef DIGEST - interface = &ntlmsspi_kdc_digest; + ns_interface = &ntlmsspi_kdc_digest; #endif - if (interface == NULL) + if (ns_interface == NULL) return GSS_S_FAILURE; *ctx = calloc(1, sizeof(**ctx)); - (*ctx)->server = interface; + (*ctx)->server = ns_interface; maj_stat = (*(*ctx)->server->nsi_init)(minor_status, &(*ctx)->ictx); if (maj_stat != GSS_S_COMPLETE) From c1a6ab1d559ef8c22e15232db8734cd17df66a01 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:50:00 -0400 Subject: [PATCH 017/134] Update hcrypto/NTMakefile --- lib/hcrypto/NTMakefile | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/lib/hcrypto/NTMakefile b/lib/hcrypto/NTMakefile index 9fdd4ac1d..85aa180f3 100644 --- a/lib/hcrypto/NTMakefile +++ b/lib/hcrypto/NTMakefile @@ -40,24 +40,24 @@ AUXCFLAGS=$(AUXCFLAGS) -DKRB5 -I$(INCDIR)\hcrypto HCRYPTOINCLUDEDIR=$(INCDIR)\hcrypto INCFILES= \ - $(HCRYPTOINCLUDEDIR)\aes.h \ - $(HCRYPTOINCLUDEDIR)\bn.h \ - $(HCRYPTOINCLUDEDIR)\des.h \ - $(HCRYPTOINCLUDEDIR)\dh.h \ - $(HCRYPTOINCLUDEDIR)\dsa.h \ - $(HCRYPTOINCLUDEDIR)\engine.h \ - $(HCRYPTOINCLUDEDIR)\evp.h \ - $(HCRYPTOINCLUDEDIR)\hmac.h \ - $(HCRYPTOINCLUDEDIR)\md2.h \ - $(HCRYPTOINCLUDEDIR)\md4.h \ - $(HCRYPTOINCLUDEDIR)\md5.h \ - $(HCRYPTOINCLUDEDIR)\pkcs12.h \ - $(HCRYPTOINCLUDEDIR)\rand.h \ - $(HCRYPTOINCLUDEDIR)\randi.h \ - $(HCRYPTOINCLUDEDIR)\rc2.h \ - $(HCRYPTOINCLUDEDIR)\rc4.h \ - $(HCRYPTOINCLUDEDIR)\rsa.h \ - $(HCRYPTOINCLUDEDIR)\sha.h \ + $(HCRYPTOINCLUDEDIR)\aes.h \ + $(HCRYPTOINCLUDEDIR)\bn.h \ + $(HCRYPTOINCLUDEDIR)\des.h \ + $(HCRYPTOINCLUDEDIR)\dh.h \ + $(HCRYPTOINCLUDEDIR)\dsa.h \ + $(HCRYPTOINCLUDEDIR)\engine.h \ + $(HCRYPTOINCLUDEDIR)\evp.h \ + $(HCRYPTOINCLUDEDIR)\hmac.h \ + $(HCRYPTOINCLUDEDIR)\md2.h \ + $(HCRYPTOINCLUDEDIR)\md4.h \ + $(HCRYPTOINCLUDEDIR)\md5.h \ + $(HCRYPTOINCLUDEDIR)\pkcs12.h \ + $(HCRYPTOINCLUDEDIR)\rand.h \ + $(HCRYPTOINCLUDEDIR)\randi.h \ + $(HCRYPTOINCLUDEDIR)\rc2.h \ + $(HCRYPTOINCLUDEDIR)\rc4.h \ + $(HCRYPTOINCLUDEDIR)\rsa.h \ + $(HCRYPTOINCLUDEDIR)\sha.h \ $(HCRYPTOINCLUDEDIR)\ui.h mkincdir: @@ -86,6 +86,8 @@ libhcrypt_OBJs = \ $(OBJ)\dh-imath.obj \ $(OBJ)\dsa.obj \ $(OBJ)\evp.obj \ + $(OBJ)\evp-hcrypto.obj \ + $(OBJ)\evp-aes-cts.obj \ $(OBJ)\engine.obj \ $(OBJ)\hmac.obj \ $(OBJ)\md2.obj \ From adab1b3cc1ac678c7e937e1447e1467ad6ec851e Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:51:56 -0400 Subject: [PATCH 018/134] Move HC_DEPRECATED_CRYPTO to front The HC_DEPRECATED_CRYPTO macro is used as a storage class specifier on Windows, and hence must be placed before the return type for a function declaration. --- lib/hcrypto/evp.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/hcrypto/evp.h b/lib/hcrypto/evp.h index 600f69b7a..ae92ab489 100644 --- a/lib/hcrypto/evp.h +++ b/lib/hcrypto/evp.h @@ -214,24 +214,24 @@ HC_CPP_BEGIN */ const EVP_MD *EVP_md_null(void); -const EVP_MD *EVP_md2(void) HC_DEPRECATED_CRYPTO; -const EVP_MD *EVP_md4(void) HC_DEPRECATED_CRYPTO; -const EVP_MD *EVP_md5(void) HC_DEPRECATED_CRYPTO; -const EVP_MD *EVP_sha(void) HC_DEPRECATED; +HC_DEPRECATED_CRYPTO const EVP_MD *EVP_md2(void); +HC_DEPRECATED_CRYPTO const EVP_MD *EVP_md4(void); +HC_DEPRECATED_CRYPTO const EVP_MD *EVP_md5(void); +const EVP_MD *EVP_sha(void); const EVP_MD *EVP_sha1(void); const EVP_MD *EVP_sha256(void); const EVP_CIPHER * EVP_aes_128_cbc(void); const EVP_CIPHER * EVP_aes_192_cbc(void); const EVP_CIPHER * EVP_aes_256_cbc(void); -const EVP_CIPHER * EVP_des_cbc(void) HC_DEPRECATED_CRYPTO; +HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_des_cbc(void); const EVP_CIPHER * EVP_des_ede3_cbc(void); const EVP_CIPHER * EVP_enc_null(void); -const EVP_CIPHER * EVP_rc2_40_cbc(void) HC_DEPRECATED_CRYPTO; -const EVP_CIPHER * EVP_rc2_64_cbc(void) HC_DEPRECATED_CRYPTO; -const EVP_CIPHER * EVP_rc2_cbc(void) HC_DEPRECATED_CRYPTO; +HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_rc2_40_cbc(void); +HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_rc2_64_cbc(void); +HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_rc2_cbc(void); const EVP_CIPHER * EVP_rc4(void); -const EVP_CIPHER * EVP_rc4_40(void) HC_DEPRECATED_CRYPTO; +HC_DEPRECATED_CRYPTO const EVP_CIPHER * EVP_rc4_40(void); const EVP_CIPHER * EVP_camellia_128_cbc(void); const EVP_CIPHER * EVP_camellia_192_cbc(void); const EVP_CIPHER * EVP_camellia_256_cbc(void); From ffb0fdb9c62b6fcf9a9479bc1b2b701fd1e2cbea Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:52:27 -0400 Subject: [PATCH 019/134] Better dependencty tracking for hdb/NTMakefile and build tests --- lib/hdb/NTMakefile | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/lib/hdb/NTMakefile b/lib/hdb/NTMakefile index a8d6193aa..fb8d2ab6b 100644 --- a/lib/hdb/NTMakefile +++ b/lib/hdb/NTMakefile @@ -40,6 +40,7 @@ gen_files_hdb = \ $(OBJ)\asn1_HDBFlags.x \ $(OBJ)\asn1_GENERATION.x \ $(OBJ)\asn1_HDB_Ext_PKINIT_acl.x \ + $(OBJ)\asn1_HDB_Ext_PKINIT_cert.x \ $(OBJ)\asn1_HDB_Ext_PKINIT_hash.x \ $(OBJ)\asn1_HDB_Ext_Constrained_delegation_acl.x \ $(OBJ)\asn1_HDB_Ext_Lan_Manager_OWF.x \ @@ -48,9 +49,10 @@ gen_files_hdb = \ $(OBJ)\asn1_HDB_extension.x \ $(OBJ)\asn1_HDB_extensions.x \ $(OBJ)\asn1_hdb_entry.x \ - $(OBJ)\asn1_hdb_entry_alias.x + $(OBJ)\asn1_hdb_entry_alias.x \ + $(OBJ)\asn1_hdb_keyset.x -$(gen_files_hdb) $(OBJ)\hdb_asn1.h: $(BINDIR)\asn1_compile.exe hdb.asn1 +$(gen_files_hdb) $(OBJ)\hdb_asn1.hx: $(BINDIR)\asn1_compile.exe hdb.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe $(SRCDIR)\hdb.asn1 hdb_asn1 cd $(SRCDIR) @@ -87,8 +89,8 @@ dist_libhdb_la_SOURCES = \ ext.c \ $(ldap_c) \ hdb.c \ + hdb-sqlite.c \ hdb_locl.h \ - hdb-private.h \ keys.c \ keytab.c \ dbinfo.c \ @@ -103,6 +105,7 @@ libhdb_OBJs= \ $(OBJ)\ext.obj \ $(ldap) \ $(OBJ)\hdb.obj \ + $(OBJ)\hdb-sqlite.obj \ $(OBJ)\keys.obj \ $(OBJ)\keytab.obj \ $(OBJ)\dbinfo.obj \ @@ -117,11 +120,11 @@ $(OBJ)\hdb_err.c $(OBJ)\hdb_err.h: hdb_err.et $(BINDIR)\compile_et.exe $(SRCDIR)\hdb_err.et cd $(SRCDIR) -$(OBJ)\hdb-protos.h: +$(OBJ)\hdb-protos.h: $(dist_libhdb_la_SOURCES) $(PERL) ../../cf/make-proto.pl -q -P remove -o $@ $(dist_libhdb_la_SOURCES) \ || $(RM) $@ -$(OBJ)\hdb-private.h: +$(OBJ)\hdb-private.h: $(dist_libhdb_la_SOURCES) $(PERL) ../../cf/make-proto.pl -q -P remote -p $@ $(dist_libhdb_la_SOURCES) \ || $(RM) $@ @@ -143,7 +146,21 @@ clean:: test:: test-binaries test-run -test-binaries: $(OBJ)\test_dbinfo.exe +test-binaries: $(OBJ)\test_dbinfo.exe $(OBJ)\test_hdbkeys.exe + +$(OBJ)\test_dbinfo.exe: $(OBJ)\test_dbinfo.obj $(LIBHDB) $(LIBKRB5) $(LIBROKEN) $(LIBVERS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + +$(OBJ)\test_hdbkeys.exe: $(OBJ)\test_hdbkeys.obj $(LIBHDB) $(LIBKRB5) $(LIBROKEN) $(LIBASN1) $(LIBVERS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + +test-run: + cd $(OBJ) + test_dbinfo.exe + test_hdbkeys.exe + cd $(SRCDIR) !ifdef OPENLDAP_INC openldap_inc_flag=-I$(OPENLDAP_INC) @@ -151,7 +168,7 @@ openldap_inc_flag=-I$(OPENLDAP_INC) openldap_inc_flag= !endif -hdb_cflags=-D_HDB_DB_DIR=$(DIR_hdbdir) $(openldap_inc_flag) -I$(OBJ) +hdb_cflags=$(openldap_inc_flag) -I$(OBJ) {}.c{$(OBJ)}.obj: $(C2OBJ) $(hdb_cflags) From dd0963663211dc31060396efabcb008dce98126e Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:53:12 -0400 Subject: [PATCH 020/134] Move variable definitions above code VC still doesn't deal with variable definitions mixed with code. --- lib/hdb/hdb-sqlite.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/hdb/hdb-sqlite.c b/lib/hdb/hdb-sqlite.c index be59ebc40..ee3e88186 100644 --- a/lib/hdb/hdb-sqlite.c +++ b/lib/hdb/hdb-sqlite.c @@ -389,6 +389,8 @@ hdb_sqlite_fetch(krb5_context context, HDB *db, krb5_const_principal principal, krb5_error_code ret; char *principal_string; hdb_sqlite_db *hsdb = (hdb_sqlite_db*)(db->hdb_db); + sqlite3_stmt *fetch = hsdb->fetch; + krb5_data value; ret = krb5_unparse_name(context, principal, &principal_string); if (ret) { @@ -396,7 +398,6 @@ hdb_sqlite_fetch(krb5_context context, HDB *db, krb5_const_principal principal, return ret; } - sqlite3_stmt *fetch = hsdb->fetch; sqlite3_bind_text(fetch, 1, principal_string, -1, SQLITE_STATIC); sqlite_error = hdb_sqlite_step(context, hsdb->db, fetch); @@ -421,7 +422,6 @@ hdb_sqlite_fetch(krb5_context context, HDB *db, krb5_const_principal principal, } } - krb5_data value; value.length = sqlite3_column_bytes(fetch, 0); value.data = (void *) sqlite3_column_blob(fetch, 0); @@ -487,6 +487,8 @@ hdb_sqlite_store(krb5_context context, HDB *db, unsigned flags, const HDB_Ext_Aliases *aliases; hdb_sqlite_db *hsdb = (hdb_sqlite_db *)(db->hdb_db); + krb5_data value; + sqlite3_stmt *get_ids = hsdb->get_ids; ret = hdb_sqlite_exec_stmt(context, hsdb->db, "BEGIN IMMEDIATE TRANSACTION", EINVAL); @@ -507,14 +509,11 @@ hdb_sqlite_store(krb5_context context, HDB *db, unsigned flags, goto rollback; } - krb5_data value; ret = hdb_entry2value(context, &entry->entry, &value); if(ret) { goto rollback; } - sqlite3_stmt *get_ids = hsdb->get_ids; - sqlite3_bind_text(get_ids, 1, principal_string, -1, SQLITE_STATIC); ret = hdb_sqlite_step(context, hsdb->db, get_ids); @@ -664,12 +663,13 @@ static krb5_error_code hdb_sqlite_destroy(krb5_context context, HDB *db) { int ret; + hdb_sqlite_db *hsdb; ret = hdb_clear_master_key(context, db); hdb_sqlite_close_database(context, db); - hdb_sqlite_db *hsdb = (hdb_sqlite_db*)(db->hdb_db); + hsdb = (hdb_sqlite_db*)(db->hdb_db); free(hsdb->db_file); free(db->hdb_db); @@ -786,6 +786,7 @@ hdb_sqlite_remove(krb5_context context, HDB *db, krb5_error_code ret; char *principal_string; hdb_sqlite_db *hsdb = (hdb_sqlite_db*)(db->hdb_db); + sqlite3_stmt *remove = hsdb->remove; ret = krb5_unparse_name(context, principal, &principal_string); if (ret) { @@ -793,8 +794,6 @@ hdb_sqlite_remove(krb5_context context, HDB *db, return ret; } - sqlite3_stmt *remove = hsdb->remove; - sqlite3_bind_text(remove, 1, principal_string, -1, SQLITE_STATIC); ret = hdb_sqlite_step(context, hsdb->db, remove); From 588d1e081f3d39cf074f960568ac9ac422e3dfe5 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:53:41 -0400 Subject: [PATCH 021/134] Update hx509/NTMakefile Better dependency management for generated files. --- lib/hx509/NTMakefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/hx509/NTMakefile b/lib/hx509/NTMakefile index d553e5197..fe6bb59fc 100644 --- a/lib/hx509/NTMakefile +++ b/lib/hx509/NTMakefile @@ -149,7 +149,7 @@ $(gen_files_pkcs10:.x=.c): $$(@R).x $(gen_files_crmf:.x=.c): $$(@R).x -$(gen_files_ocsp) $(OBJ)\ocsp_asn1.h: $(asn1_compile) ocsp.asn1 +$(gen_files_ocsp) $(OBJ)\ocsp_asn1.hx: $(asn1_compile) ocsp.asn1 cd $(OBJ) $(asn1_compile) \ --preserve-binary=OCSPTBSRequest \ @@ -158,7 +158,7 @@ $(gen_files_ocsp) $(OBJ)\ocsp_asn1.h: $(asn1_compile) ocsp.asn1 || ( $(RM) -f $(gen_files_ocsp) $(OBJ)\ocsp_asn1.h ; exit /b 1 ) cd $(SRCDIR) -$(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.h: $(asn1_compile) pkcs10.asn1 +$(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.hx: $(asn1_compile) pkcs10.asn1 cd $(OBJ) $(asn1_compile) \ --preserve-binary=CertificationRequestInfo \ @@ -166,7 +166,7 @@ $(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.h: $(asn1_compile) pkcs10.asn1 || ( $(RM) -f $(gen_files_pkcs10) $(OBJ)\pkcs10_asn1.h ; exit /b 1 ) cd $(SRCDIR) -$(gen_files_crmf) $(OBJ)\crmf_asn1.h: $(asn1_compile) crmf.asn1 +$(gen_files_crmf) $(OBJ)\crmf_asn1.hx: $(asn1_compile) crmf.asn1 cd $(OBJ) $(asn1_compile) $(SRCDIR)\crmf.asn1 crmf_asn1 \ || ( $(RM) -f $(gen_files_crmf) $(OBJ)\crmf_asn1.h ; exit /b 1 ) From 21775167c4cee11a1381a4912f09ac95139fb920 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:54:01 -0400 Subject: [PATCH 022/134] No dirfd() support on Windows --- lib/hx509/ks_dir.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/hx509/ks_dir.c b/lib/hx509/ks_dir.c index 9ce9b5c8e..1ba4cdd10 100644 --- a/lib/hx509/ks_dir.c +++ b/lib/hx509/ks_dir.c @@ -113,7 +113,9 @@ dir_iter_start(hx509_context context, free(d); return errno; } +#ifdef HAVE_DIRFD rk_cloexec(dirfd(d->dir)); +#endif d->certs = NULL; d->iter = NULL; From 246e60891c1936edae78aed61c00ab97513fcc1c Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:54:45 -0400 Subject: [PATCH 023/134] NTMakefile for kadm5 port --- lib/kadm5/NTMakefile | 227 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) diff --git a/lib/kadm5/NTMakefile b/lib/kadm5/NTMakefile index b7c65b98a..a6bd87884 100644 --- a/lib/kadm5/NTMakefile +++ b/lib/kadm5/NTMakefile @@ -33,3 +33,230 @@ RELDIR=lib\kadm5 !include ../../windows/NTMakefile.w32 +dist_libkadm5clnt_la_SOURCES = \ + ad.c \ + chpass_c.c \ + client_glue.c \ + common_glue.c \ + create_c.c \ + delete_c.c \ + destroy_c.c \ + flush_c.c \ + free.c \ + get_c.c \ + get_princs_c.c \ + init_c.c \ + kadm5_locl.h \ + marshall.c \ + modify_c.c \ + private.h \ + privs_c.c \ + randkey_c.c \ + rename_c.c \ + send_recv.c \ + kadm5-pwcheck.h \ + admin.h + +dist_libkadm5srv_la_SOURCES = \ + acl.c \ + admin.h \ + bump_pw_expire.c \ + chpass_s.c \ + common_glue.c \ + context_s.c \ + create_s.c \ + delete_s.c \ + destroy_s.c \ + ent_setup.c \ + error.c \ + flush_s.c \ + free.c \ + get_princs_s.c \ + get_s.c \ + init_s.c \ + kadm5_locl.h \ + keys.c \ + log.c \ + marshall.c \ + modify_s.c \ + password_quality.c \ + private.h \ + privs_s.c \ + randkey_s.c \ + rename_s.c \ + server_glue.c \ + set_keys.c \ + set_modifier.c \ + kadm5-pwcheck.h \ + admin.h + +LIBKADM5CLNT_OBJs= \ + $(OBJ)\ad.obj \ + $(OBJ)\chpass_c.obj \ + $(OBJ)\client_glue.obj \ + $(OBJ)\common_glue.obj \ + $(OBJ)\create_c.obj \ + $(OBJ)\delete_c.obj \ + $(OBJ)\destroy_c.obj \ + $(OBJ)\flush_c.obj \ + $(OBJ)\free.obj \ + $(OBJ)\get_c.obj \ + $(OBJ)\get_princs_c.obj \ + $(OBJ)\init_c.obj \ + $(OBJ)\marshall.obj \ + $(OBJ)\modify_c.obj \ + $(OBJ)\privs_c.obj \ + $(OBJ)\randkey_c.obj \ + $(OBJ)\rename_c.obj \ + $(OBJ)\send_recv.obj \ + $(OBJ)\kadm5_err.obj + +LIBKADM5SRV_OBJS= \ + $(OBJ)\acl.obj \ + $(OBJ)\bump_pw_expire.obj \ + $(OBJ)\chpass_s.obj \ + $(OBJ)\common_glue.obj \ + $(OBJ)\context_s.obj \ + $(OBJ)\create_s.obj \ + $(OBJ)\delete_s.obj \ + $(OBJ)\destroy_s.obj \ + $(OBJ)\ent_setup.obj \ + $(OBJ)\error.obj \ + $(OBJ)\flush_s.obj \ + $(OBJ)\free.obj \ + $(OBJ)\get_princs_s.obj \ + $(OBJ)\get_s.obj \ + $(OBJ)\init_s.obj \ + $(OBJ)\keys.obj \ + $(OBJ)\log.obj \ + $(OBJ)\marshall.obj \ + $(OBJ)\modify_s.obj \ + $(OBJ)\password_quality.obj \ + $(OBJ)\privs_s.obj \ + $(OBJ)\randkey_s.obj \ + $(OBJ)\rename_s.obj \ + $(OBJ)\server_glue.obj \ + $(OBJ)\set_keys.obj \ + $(OBJ)\set_modifier.obj \ + $(OBJ)\kadm5_err.obj + + +proto_opts = -q -R "^(_|kadm5_c_|kadm5_s_|kadm5_log)" -P remove + +$(OBJ)\kadm5-protos.h: $(dist_libkadm5srv_la_SOURCES) $(dist_libkadm5clnt_la_SOURCES) + $(PERL) ..\..\cf\make-proto.pl $(proto_opts) \ + -o $@ \ + $(dist_libkadm5srv_la_SOURCES) \ + $(dist_libkadm5clnt_la_SOURCES) \ + || $(RM) $@ + +$(OBJ)\kadm5-private.h: $(dist_libkadm5srv_la_SOURCES) $(dist_libkadm5clnt_la_SOURCES) + $(PERL) ..\..\cf\make-proto.pl $(proto_opts) \ + -p $@ \ + $(dist_libkadm5srv_la_SOURCES) \ + $(dist_libkadm5clnt_la_SOURCES) \ + || $(RM) $@ + +$(OBJ)\iprop-commands.c $(OBJ)\iprop-commands.h: iprop-commands.in + cd $(OBJ) + $(BINDIR)\slc.exe $(SRCDIR)\iprop-commands.in + cd $(SRCDIR) + +$(OBJ)\kadm5_err.h $(OBJ)kadm5_err.c: kadm5_err.et + cd $(OBJ) + $(BINDIR)\compile_et.exe $(SRCDIR)\kadm5_err.et + cd $(SRCDIR) + +$(KADM5INCDIR)\kadm5_err.h: $(OBJ)\kadm5_err.h + +KADM5INCDIR=$(INCDIR)\kadm5 + +INCFILES=\ + $(KADM5INCDIR)\kadm5_err.h \ + $(KADM5INCDIR)\admin.h \ + $(KADM5INCDIR)\private.h \ + $(KADM5INCDIR)\kadm5-protos.h \ + $(KADM5INCDIR)\kadm5-private.h \ + $(OBJ)\iprop-commands.h + +SBINPROGRAMS=$(SBINDIR)\iprop-log.exe + +LIBEXECPROGRAMS=$(LIBEXECDIR)\ipropd-master.exe $(LIBEXECDIR)\ipropd-slave.exe + +EXELIBDEPS= \ + $(LIBKADM5SRV) \ + $(LIBROKEN) \ + $(LIBKRB5) \ + $(LIBHDB) \ + $(LIBASN1) \ + $(LIBSQLITE) \ + $(LIBSL) \ + $(LIBCOMERR) \ + $(LIBVERS) + +$(SBINDIR)\iprop-log.exe: $(OBJ)\iprop-log.obj $(OBJ)\iprop-commands.obj $(EXELIBDEPS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(LIBEXECDIR)\ipropd-master.exe: $(OBJ)\ipropd_master.obj $(OBJ)\ipropd_common.obj $(EXELIBDEPS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(LIBEXECDIR)\ipropd-slave.exe: $(OBJ)\ipropd_slave.obj $(OBJ)\ipropd_common.obj $(EXELIBDEPS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(LIBKADM5CLNT): $(LIBKADM5CLNT_OBJS) + $(LIBCON) + +$(LIBKADM5SRV): $(BINDIR)\libkadm5srv.dll + +$(BINDIR)\libkadm5srv.dll: $(LIBKADM5SRV_OBJS) $(LIBKRB5) $(LIBROKEN) $(LIBHDB) $(LIBCOMERR) $(LIBASN1) $(LIBSQLITE) + $(DLLGUILINK_C) -out:$@ -implib:$(LIBKADM5SRV) -def:libkadm5srv-exports.def $** + $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +all:: $(INCFILES) $(LIBKADM5SRV) $(LIBKADM5CLNT) $(SBINPROGRAMS) $(LIBEXECPROGRAMS) + +clean:: + -$(RM) $(INCFILES) + -$(RM) $(LIBKADM5CLNT) + -$(RM) $(LIBKADM5SRV) + -$(RM) $(BINDIR)\libkadm5srv.dll + -$(RM) $(SBINPROGRAMS) + -$(RM) $(LIBEXECPROGRAMS) + +test:: test-binaries test-run + +test-binaries: \ + $(OBJ)\default_keys.exe \ + $(OBJ)\test_pw_quality.exe \ + $(OBJ)\sample_passwd_check.dll + +$(OBJ)\default_keys.exe: $(OBJ)\default_keys.obj + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + +$(OBJ)\sample_passwd_check.dll: $(OBJ)\sample_passwd_check.obj + $(DLLGUILINK) + $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) + +test-run: + +{$(OBJ)}.h{$(KADM5INCDIR)}.h: + $(CP) $< $@ + +{}.h{$(KADM5INCDIR)}.h: + $(CP) $< $@ + +{}.c{$(OBJ)}.obj: + $(C2OBJ) -I$(OBJ) -I$(KADM5INCDIR) \ No newline at end of file From d84119813e014d5c27fa05df0c46804957d1b031 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:57:15 -0400 Subject: [PATCH 024/134] No AF_UNIX on Windows and no SIGPIPE and SIGXCPU --- lib/kadm5/context_s.c | 16 ++++++++++ lib/kadm5/destroy_s.c | 8 ++++- lib/kadm5/init_s.c | 10 ++++++ lib/kadm5/ipropd_common.c | 4 +++ lib/kadm5/ipropd_master.c | 56 +++++++++++++++++++++++----------- lib/kadm5/ipropd_slave.c | 5 ++- lib/kadm5/log.c | 64 +++++++++++++++++++++++++++++++++++++++ lib/kadm5/private.h | 6 +++- 8 files changed, 149 insertions(+), 20 deletions(-) diff --git a/lib/kadm5/context_s.c b/lib/kadm5/context_s.c index b9459dd70..811921d96 100644 --- a/lib/kadm5/context_s.c +++ b/lib/kadm5/context_s.c @@ -53,6 +53,8 @@ set_funcs(kadm5_server_context *c) SET(c, rename_principal); } +#ifndef NO_UNIX_SOCKETS + static void set_socket_name(krb5_context context, struct sockaddr_un *un) { @@ -61,7 +63,17 @@ set_socket_name(krb5_context context, struct sockaddr_un *un) memset(un, 0, sizeof(*un)); un->sun_family = AF_UNIX; strlcpy (un->sun_path, fn, sizeof(un->sun_path)); + } +#else + +static void +set_socket_info(krb5_context context, struct addrinfo **info) +{ + kadm5_log_signal_socket_info(context, 0, info); +} + +#endif static kadm5_ret_t find_db_spec(kadm5_server_context *ctx) @@ -115,7 +127,11 @@ find_db_spec(kadm5_server_context *ctx) if (ctx->log_context.log_file == NULL) asprintf(&ctx->log_context.log_file, "%s/log", hdb_db_dir(context)); +#ifndef NO_UNIX_SOCKETS set_socket_name(context, &ctx->log_context.socket_name); +#else + set_socket_info(context, &ctx->log_context.socket_info); +#endif return 0; } diff --git a/lib/kadm5/destroy_s.c b/lib/kadm5/destroy_s.c index 8ddf7d06f..393ffb914 100644 --- a/lib/kadm5/destroy_s.c +++ b/lib/kadm5/destroy_s.c @@ -56,7 +56,13 @@ static void destroy_kadm5_log_context (kadm5_log_context *c) { free (c->log_file); - close (c->socket_fd); + closesocket (c->socket_fd); +#ifndef NO_UNIX_SOCKETS + if (c->socket_info) { + freeaddrinfo(c->socket_info); + c->socket_info = NULL; + } +#endif } /* diff --git a/lib/kadm5/init_s.c b/lib/kadm5/init_s.c index 967f0e9c3..1001fce6d 100644 --- a/lib/kadm5/init_s.c +++ b/lib/kadm5/init_s.c @@ -55,7 +55,11 @@ kadm5_s_init_with_context(krb5_context context, assert(ctx->config.stash_file != NULL); assert(ctx->config.acl_file != NULL); assert(ctx->log_context.log_file != NULL); +#ifndef NO_UNIX_SOCKETS assert(ctx->log_context.socket_name.sun_path[0] != '\0'); +#else + assert(ctx->log_context.socket_info != NULL); +#endif ret = hdb_create(ctx->context, &ctx->db, ctx->config.dbname); if(ret) @@ -67,7 +71,13 @@ kadm5_s_init_with_context(krb5_context context, ctx->log_context.log_fd = -1; +#ifndef NO_UNIX_SOCKETS ctx->log_context.socket_fd = socket (AF_UNIX, SOCK_DGRAM, 0); +#else + ctx->log_context.socket_fd = socket (ctx->log_context.socket_info->ai_family, + ctx->log_context.socket_info->ai_socktype, + ctx->log_context.socket_info->ai_protocol); +#endif ret = krb5_parse_name(ctx->context, client_name, &ctx->caller); if(ret) diff --git a/lib/kadm5/ipropd_common.c b/lib/kadm5/ipropd_common.c index e0df0f87a..2e3d94107 100644 --- a/lib/kadm5/ipropd_common.c +++ b/lib/kadm5/ipropd_common.c @@ -63,7 +63,11 @@ setup_signal(void) #else signal(SIGINT, sigterm); signal(SIGTERM, sigterm); +#ifndef NO_SIGXCPU signal(SIGXCPU, sigterm); +#endif +#ifndef NO_SIGPIPE signal(SIGPIPE, SIG_IGN); #endif +#endif } diff --git a/lib/kadm5/ipropd_master.c b/lib/kadm5/ipropd_master.c index 1e843338a..749040b18 100644 --- a/lib/kadm5/ipropd_master.c +++ b/lib/kadm5/ipropd_master.c @@ -45,12 +45,13 @@ static int time_before_gone; const char *master_hostname; -static int +static SOCKET make_signal_socket (krb5_context context) { +#ifndef NO_UNIX_SOCKETS struct sockaddr_un addr; const char *fn; - int fd; + SOCKET fd; fn = kadm5_log_signal_socket(context); @@ -64,18 +65,32 @@ make_signal_socket (krb5_context context) if (bind (fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) krb5_err (context, 1, errno, "bind %s", addr.sun_path); return fd; +#else + struct addrinfo *ai = NULL; + SOCKET fd; + + kadm5_log_signal_socket_info(context, 1, &ai); + + fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + if (IS_BAD_SOCKET(fd)) + krb5_err (context, 1, SOCK_ERRNO, "socket AF=%d", ai->ai_family); + + if (IS_SOCKET_ERROR( bind (fd, ai->ai_addr, ai->ai_addrlen) )) + krb5_err (context, 1, SOCK_ERRNO, "bind"); + return fd; +#endif } -static int +static SOCKET make_listen_socket (krb5_context context, const char *port_str) { - int fd; + SOCKET fd; int one = 1; struct sockaddr_in addr; fd = socket (AF_INET, SOCK_STREAM, 0); - if (fd < 0) - krb5_err (context, 1, errno, "socket AF_INET"); + if (IS_BAD_SOCKET(fd)) + krb5_err (context, 1, SOCK_ERRNO, "socket AF_INET"); setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)); memset (&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; @@ -105,7 +120,7 @@ make_listen_socket (krb5_context context, const char *port_str) } struct slave { - int fd; + SOCKET fd; struct sockaddr_in addr; char *name; krb5_auth_context ac; @@ -180,9 +195,9 @@ slave_dead(krb5_context context, slave *s) { krb5_warnx(context, "slave %s dead", s->name); - if (s->fd >= 0) { - close (s->fd); - s->fd = -1; + if (!IS_BAD_SOCKET(s->fd)) { + closesocket (s->fd); + s->fd = INVALID_SOCKET; } s->flags |= SLAVE_F_DEAD; slave_seen(s); @@ -193,8 +208,8 @@ remove_slave (krb5_context context, slave *s, slave **root) { slave **p; - if (s->fd >= 0) - close (s->fd); + if (!IS_BAD_SOCKET(s->fd)) + closesocket (s->fd); if (s->name) free (s->name); if (s->ac) @@ -209,7 +224,7 @@ remove_slave (krb5_context context, slave *s, slave **root) } static void -add_slave (krb5_context context, krb5_keytab keytab, slave **root, int fd) +add_slave (krb5_context context, krb5_keytab keytab, slave **root, SOCKET fd) { krb5_principal server; krb5_error_code ret; @@ -228,7 +243,7 @@ add_slave (krb5_context context, krb5_keytab keytab, slave **root, int fd) addr_len = sizeof(s->addr); s->fd = accept (fd, (struct sockaddr *)&s->addr, &addr_len); - if (s->fd < 0) { + if (IS_BAD_SOCKET(s->fd)) { krb5_warn (context, errno, "accept"); goto error; } @@ -294,7 +309,7 @@ error: struct prop_context { krb5_auth_context auth_context; - int fd; + SOCKET fd; }; static int @@ -744,7 +759,7 @@ main(int argc, char **argv) void *kadm_handle; kadm5_server_context *server_context; kadm5_config_params conf; - int signal_fd, listen_fd; + SOCKET signal_fd, listen_fd; int log_fd; slave *slaves = NULL; uint32_t current_version = 0, old_version = 0; @@ -880,7 +895,11 @@ main(int argc, char **argv) } if (ret && FD_ISSET(signal_fd, &readset)) { +#ifndef NO_UNIX_SOCKETS struct sockaddr_un peer_addr; +#else + struct sockaddr_storage peer_addr; +#endif socklen_t peer_len = sizeof(peer_addr); if(recvfrom(signal_fd, (void *)&vers, sizeof(vers), 0, @@ -931,8 +950,11 @@ main(int argc, char **argv) write_stats(context, slaves, current_version); } - if(exit_flag == SIGXCPU) + if (0) ; +#ifndef NO_SIGXCPU + else if(exit_flag == SIGXCPU) krb5_warnx(context, "%s CPU time limit exceeded", getprogname()); +#endif else if(exit_flag == SIGINT || exit_flag == SIGTERM) krb5_warnx(context, "%s terminated", getprogname()); else diff --git a/lib/kadm5/ipropd_slave.c b/lib/kadm5/ipropd_slave.c index c6309612a..8a5658c04 100644 --- a/lib/kadm5/ipropd_slave.c +++ b/lib/kadm5/ipropd_slave.c @@ -730,8 +730,11 @@ main(int argc, char **argv) reconnect = reconnect_max; } - if(exit_flag == SIGXCPU) + if (0); +#ifndef NO_SIGXCPU + else if(exit_flag == SIGXCPU) krb5_warnx(context, "%s CPU time limit exceeded", getprogname()); +#endif else if(exit_flag == SIGINT || exit_flag == SIGTERM) krb5_warnx(context, "%s terminated", getprogname()); else diff --git a/lib/kadm5/log.c b/lib/kadm5/log.c index 51d091280..8a307023c 100644 --- a/lib/kadm5/log.c +++ b/lib/kadm5/log.c @@ -206,15 +206,25 @@ kadm5_log_flush (kadm5_log_context *log_context, krb5_data_free(&data); return errno; } + /* * Try to send a signal to any running `ipropd-master' */ +#ifndef NO_UNIX_SOCKETS sendto (log_context->socket_fd, (void *)&log_context->version, sizeof(log_context->version), 0, (struct sockaddr *)&log_context->socket_name, sizeof(log_context->socket_name)); +#else + sendto (log_context->socket_fd, + (void *)&log_context->version, + sizeof(log_context->version), + 0, + log_context->socket_info->ai_addr, + log_context->socket_info->ai_addrlen); +#endif krb5_data_free(&data); return 0; @@ -970,6 +980,8 @@ kadm5_log_truncate (kadm5_server_context *server_context) } +#ifndef NO_UNIX_SOCKETS + static char *default_signal = NULL; static HEIMDAL_MUTEX signal_mutex = HEIMDAL_MUTEX_INITIALIZER; @@ -988,3 +1000,55 @@ kadm5_log_signal_socket(krb5_context context) "signal_socket", NULL); } + +#else /* NO_UNIX_SOCKETS */ + +#define SIGNAL_SOCKET_HOST "127.0.0.1" +#define SIGNAL_SOCKET_PORT "12701" + +kadm5_ret_t +kadm5_log_signal_socket_info(krb5_context context, + int server_end, + struct addrinfo **ret_addrs) +{ + struct addrinfo hints; + struct addrinfo *addrs = NULL; + kadm5_ret_t ret = KADM5_FAILURE; + int wsret; + + memset(&hints, 0, sizeof(hints)); + + hints.ai_flags = AI_NUMERICHOST; + if (server_end) + hints.ai_flags |= AI_PASSIVE; + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + + wsret = getaddrinfo(SIGNAL_SOCKET_HOST, + SIGNAL_SOCKET_PORT, + &hints, &addrs); + + if (wsret != 0) { + krb5_set_error_message(context, KADM5_FAILURE, + "%s", gai_strerror(wsret)); + goto done; + } + + if (addrs == NULL) { + krb5_set_error_message(context, KADM5_FAILURE, + "getaddrinfo() failed to return address list"); + goto done; + } + + *ret_addrs = addrs; + addrs = NULL; + ret = 0; + + done: + if (addrs) + freeaddrinfo(addrs); + return ret; +} + +#endif diff --git a/lib/kadm5/private.h b/lib/kadm5/private.h index 294694af9..c1fec6feb 100644 --- a/lib/kadm5/private.h +++ b/lib/kadm5/private.h @@ -74,8 +74,12 @@ typedef struct kadm5_log_context { char *log_file; int log_fd; uint32_t version; +#ifndef NO_UNIX_SOCKETS struct sockaddr_un socket_name; - int socket_fd; +#else + struct addrinfo *socket_info; +#endif + SOCKET socket_fd; } kadm5_log_context; typedef struct kadm5_server_context { From bf5b934b06b0104ef34bfdbb95f5b2d8691dc28c Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:58:01 -0400 Subject: [PATCH 025/134] Include roken.h before including other Heimdal headers --- lib/kadm5/kadm5_locl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kadm5/kadm5_locl.h b/lib/kadm5/kadm5_locl.h index 13b644e18..68b6a5ebf 100644 --- a/lib/kadm5/kadm5_locl.h +++ b/lib/kadm5/kadm5_locl.h @@ -37,6 +37,7 @@ #define __KADM5_LOCL_H__ #include +#include #include #include @@ -76,7 +77,6 @@ #include "kadm5_err.h" #include #include -#include #include #include "private.h" From 6a88c16dea6cec7e3d3b2ba5ff5adccb05fd6a30 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:58:42 -0400 Subject: [PATCH 026/134] Use wait_for_process() to wait for processes created with simple_exec* --- lib/kadm5/password_quality.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/kadm5/password_quality.c b/lib/kadm5/password_quality.c index ecfadde9d..9e1229631 100644 --- a/lib/kadm5/password_quality.c +++ b/lib/kadm5/password_quality.c @@ -199,7 +199,7 @@ external_passwd_quality (krb5_context context, fclose(out); fclose(error); - waitpid(child, &status, 0); + wait_for_process(child); return 1; } reply[strcspn(reply, "\n")] = '\0'; @@ -207,12 +207,9 @@ external_passwd_quality (krb5_context context, fclose(out); fclose(error); - if (waitpid(child, &status, 0) < 0) { - snprintf(message, length, "external program failed: %s", reply); - free(p); - return 1; - } - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { + status = wait_for_process(child); + + if (SE_IS_ERROR(status) || SE_PROCSTATUS(status) != 0) { snprintf(message, length, "external program failed: %s", reply); free(p); return 1; From 1bfde928382e7c21225cf5f32efc94a933d5a025 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:59:03 -0400 Subject: [PATCH 027/134] Update krb5/NTMakefile --- lib/krb5/NTMakefile | 227 +++++++++++++++++++++----------------------- 1 file changed, 110 insertions(+), 117 deletions(-) diff --git a/lib/krb5/NTMakefile b/lib/krb5/NTMakefile index 777f59c29..dad05afa1 100644 --- a/lib/krb5/NTMakefile +++ b/lib/krb5/NTMakefile @@ -48,7 +48,6 @@ libkrb5_OBJS = \ $(OBJ)\changepw.obj \ $(OBJ)\codec.obj \ $(OBJ)\config_file.obj \ - $(OBJ)\config_file_netinfo.obj \ $(OBJ)\convert_creds.obj \ $(OBJ)\constants.obj \ $(OBJ)\context.obj \ @@ -57,6 +56,7 @@ libkrb5_OBJS = \ $(OBJ)\creds.obj \ $(OBJ)\crypto.obj \ $(OBJ)\data.obj \ + $(OBJ)\deprecated.obj \ $(OBJ)\digest.obj \ $(OBJ)\eai_to_heim_errno.obj \ $(OBJ)\error_string.obj \ @@ -74,9 +74,6 @@ libkrb5_OBJS = \ $(OBJ)\get_for_creds.obj \ $(OBJ)\get_host_realm.obj \ $(OBJ)\get_in_tkt.obj \ - $(OBJ)\get_in_tkt_pw.obj \ - $(OBJ)\get_in_tkt_with_keytab.obj \ - $(OBJ)\get_in_tkt_with_skey.obj \ $(OBJ)\get_port.obj \ $(OBJ)\init_creds.obj \ $(OBJ)\init_creds_pw.obj \ @@ -86,7 +83,6 @@ libkrb5_OBJS = \ $(OBJ)\keytab_any.obj \ $(OBJ)\keytab_file.obj \ $(OBJ)\keytab_keyfile.obj \ - $(OBJ)\keytab_krb4.obj \ $(OBJ)\keytab_memory.obj \ $(OBJ)\krbhst.obj \ $(OBJ)\kuserok.obj \ @@ -146,7 +142,6 @@ libkrb5_gen_OBJS= \ INCFILES= \ $(INCDIR)\heim_err.h \ - $(INCDIR)\heim_threads.h \ $(INCDIR)\k524_err.h \ $(INCDIR)\krb_err.h \ $(INCDIR)\krb5.h \ @@ -161,115 +156,110 @@ all:: $(INCFILES) clean:: -$(RM) $(INCFILES) -dist_libkrb5_la_SOURCES = \ - acache.c \ - acl.c \ - add_et_list.c \ - addr_families.c \ - aname_to_localname.c \ - appdefault.c \ - asn1_glue.c \ - auth_context.c \ - build_ap_req.c \ - build_auth.c \ - cache.c \ - changepw.c \ - codec.c \ - config_file.c \ - config_file_netinfo.c \ - convert_creds.c \ - constants.c \ - context.c \ - copy_host_realm.c \ - crc.c \ - creds.c \ - crypto.c \ - doxygen.c \ - data.c \ - digest.c \ - eai_to_heim_errno.c \ - error_string.c \ - expand_hostname.c \ - expand_path_w32.c \ - fcache.c \ - free.c \ - free_host_realm.c \ - generate_seq_number.c \ - generate_subkey.c \ - get_addrs.c \ - get_cred.c \ - get_default_principal.c \ - get_default_realm.c \ - get_for_creds.c \ - get_host_realm.c \ - get_in_tkt.c \ - get_in_tkt_pw.c \ - get_in_tkt_with_keytab.c \ - get_in_tkt_with_skey.c \ - get_port.c \ - heim_threads.h \ - init_creds.c \ - init_creds_pw.c \ - kcm.c \ - kcm.h \ - keyblock.c \ - keytab.c \ - keytab_any.c \ - keytab_file.c \ - keytab_keyfile.c \ - keytab_krb4.c \ - keytab_memory.c \ - krb5_locl.h \ - krb5-v4compat.h \ - krbhst.c \ - kuserok.c \ - log.c \ - mcache.c \ - misc.c \ - mk_error.c \ - mk_priv.c \ - mk_rep.c \ - mk_req.c \ - mk_req_ext.c \ - mk_safe.c \ - mit_glue.c \ - net_read.c \ - net_write.c \ - n-fold.c \ - pac.c \ - padata.c \ - pkinit.c \ - principal.c \ - prog_setup.c \ - prompter_posix.c \ - rd_cred.c \ - rd_error.c \ - rd_priv.c \ - rd_rep.c \ - rd_req.c \ - rd_safe.c \ - read_message.c \ - recvauth.c \ - replay.c \ - scache.c \ - send_to_kdc.c \ - sendauth.c \ - set_default_realm.c \ - sock_principal.c \ - store.c \ - store-int.h \ - store_emem.c \ - store_fd.c \ - store_mem.c \ - plugin.c \ - ticket.c \ - time.c \ - transited.c \ - v4_glue.c \ - verify_init.c \ - verify_user.c \ - version.c \ - warn.c \ +dist_libkrb5_la_SOURCES = \ + acache.c \ + acl.c \ + add_et_list.c \ + addr_families.c \ + aname_to_localname.c \ + appdefault.c \ + asn1_glue.c \ + auth_context.c \ + build_ap_req.c \ + build_auth.c \ + cache.c \ + changepw.c \ + codec.c \ + config_file.c \ + convert_creds.c \ + constants.c \ + context.c \ + copy_host_realm.c \ + crc.c \ + creds.c \ + crypto.c \ + doxygen.c \ + data.c \ + deprecated.c \ + digest.c \ + eai_to_heim_errno.c \ + error_string.c \ + expand_hostname.c \ + expand_path_w32.c \ + fcache.c \ + free.c \ + free_host_realm.c \ + generate_seq_number.c \ + generate_subkey.c \ + get_addrs.c \ + get_cred.c \ + get_default_principal.c \ + get_default_realm.c \ + get_for_creds.c \ + get_host_realm.c \ + get_in_tkt.c \ + get_port.c \ + init_creds.c \ + init_creds_pw.c \ + kcm.c \ + kcm.h \ + keyblock.c \ + keytab.c \ + keytab_any.c \ + keytab_file.c \ + keytab_keyfile.c \ + keytab_memory.c \ + krb5_locl.h \ + krb5-v4compat.h \ + krbhst.c \ + kuserok.c \ + log.c \ + mcache.c \ + misc.c \ + mk_error.c \ + mk_priv.c \ + mk_rep.c \ + mk_req.c \ + mk_req_ext.c \ + mk_safe.c \ + mit_glue.c \ + net_read.c \ + net_write.c \ + n-fold.c \ + pac.c \ + padata.c \ + pkinit.c \ + principal.c \ + prog_setup.c \ + prompter_posix.c \ + rd_cred.c \ + rd_error.c \ + rd_priv.c \ + rd_rep.c \ + rd_req.c \ + rd_safe.c \ + read_message.c \ + recvauth.c \ + replay.c \ + scache.c \ + send_to_kdc.c \ + sendauth.c \ + set_default_realm.c \ + sock_principal.c \ + store.c \ + store-int.h \ + store_emem.c \ + store_fd.c \ + store_mem.c \ + plugin.c \ + ticket.c \ + time.c \ + transited.c \ + v4_glue.c \ + verify_init.c \ + verify_user.c \ + version.c \ + warn.c \ write_message.c $(OBJ)\krb5-protos.h: $(dist_libkrb5_la_SOURCES) @@ -329,9 +319,12 @@ DLLSDKDEPS= \ $(LIBKRB5): $(BINDIR)\libkrb5.dll -$(BINDIR)\libkrb5.dll: $(libkrb5_OBJS) $(libkrb5_gen_OBJS) $(DLLDEPS) +$(OBJ)\libkrb5-exports.def: libkrb5-exports.def.in $(INCDIR)\config.h + $(CPREPROCESSOUT) libkrb5-exports.def.in > $@ || $(RM) $@ + +$(BINDIR)\libkrb5.dll: $(libkrb5_OBJS) $(libkrb5_gen_OBJS) $(DLLDEPS) $(OBJ)\libkrb5-exports.def $(DLLGUILINK_C) -out:$(BINDIR)\libkrb5.dll -implib:$(LIBKRB5) \ - $(DLLDEPS) $(DLLSDKDEPS) -def:libkrb5-exports.def @<< + $(DLLDEPS) $(DLLSDKDEPS) -def:$(OBJ)\libkrb5-exports.def @<< $(libkrb5_OBJS: = ) $(libkrb5_gen_OBJS: = From c2f634d9ad7ecabf50c1fe74c34c5d29506ab097 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 12:59:39 -0400 Subject: [PATCH 028/134] KRB5_DEPRECATED is a storage class specifier --- lib/krb5/changepw.c | 2 +- lib/krb5/codec.c | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/krb5/changepw.c b/lib/krb5/changepw.c index 6772c1cce..5b7868ff2 100644 --- a/lib/krb5/changepw.c +++ b/lib/krb5/changepw.c @@ -684,6 +684,7 @@ find_chpw_proto(const char *name) * @ingroup @krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_change_password (krb5_context context, krb5_creds *creds, @@ -691,7 +692,6 @@ krb5_change_password (krb5_context context, int *result_code, krb5_data *result_code_string, krb5_data *result_string) - KRB5_DEPRECATED { struct kpwd_proc *p = find_chpw_proto("change password"); diff --git a/lib/krb5/codec.c b/lib/krb5/codec.c index e57403b90..d73a71910 100644 --- a/lib/krb5/codec.c +++ b/lib/krb5/codec.c @@ -37,178 +37,178 @@ #ifndef HEIMDAL_SMALLER +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncTicketPart (krb5_context context, const void *data, size_t length, EncTicketPart *t, size_t *len) - KRB5_DEPRECATED { return decode_EncTicketPart(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncTicketPart (krb5_context context, void *data, size_t length, EncTicketPart *t, size_t *len) - KRB5_DEPRECATED { return encode_EncTicketPart(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncASRepPart (krb5_context context, const void *data, size_t length, EncASRepPart *t, size_t *len) - KRB5_DEPRECATED { return decode_EncASRepPart(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncASRepPart (krb5_context context, void *data, size_t length, EncASRepPart *t, size_t *len) - KRB5_DEPRECATED { return encode_EncASRepPart(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncTGSRepPart (krb5_context context, const void *data, size_t length, EncTGSRepPart *t, size_t *len) - KRB5_DEPRECATED { return decode_EncTGSRepPart(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncTGSRepPart (krb5_context context, void *data, size_t length, EncTGSRepPart *t, size_t *len) - KRB5_DEPRECATED { return encode_EncTGSRepPart(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncAPRepPart (krb5_context context, const void *data, size_t length, EncAPRepPart *t, size_t *len) - KRB5_DEPRECATED { return decode_EncAPRepPart(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncAPRepPart (krb5_context context, void *data, size_t length, EncAPRepPart *t, size_t *len) - KRB5_DEPRECATED { return encode_EncAPRepPart(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_Authenticator (krb5_context context, const void *data, size_t length, Authenticator *t, size_t *len) - KRB5_DEPRECATED { return decode_Authenticator(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_Authenticator (krb5_context context, void *data, size_t length, Authenticator *t, size_t *len) - KRB5_DEPRECATED { return encode_Authenticator(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_EncKrbCredPart (krb5_context context, const void *data, size_t length, EncKrbCredPart *t, size_t *len) - KRB5_DEPRECATED { return decode_EncKrbCredPart(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_EncKrbCredPart (krb5_context context, void *data, size_t length, EncKrbCredPart *t, size_t *len) - KRB5_DEPRECATED { return encode_EncKrbCredPart (data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_ETYPE_INFO (krb5_context context, const void *data, size_t length, ETYPE_INFO *t, size_t *len) - KRB5_DEPRECATED { return decode_ETYPE_INFO(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_ETYPE_INFO (krb5_context context, void *data, size_t length, ETYPE_INFO *t, size_t *len) - KRB5_DEPRECATED { return encode_ETYPE_INFO (data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_decode_ETYPE_INFO2 (krb5_context context, const void *data, size_t length, ETYPE_INFO2 *t, size_t *len) - KRB5_DEPRECATED { return decode_ETYPE_INFO2(data, length, t, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_encode_ETYPE_INFO2 (krb5_context context, void *data, size_t length, ETYPE_INFO2 *t, size_t *len) - KRB5_DEPRECATED { return encode_ETYPE_INFO2 (data, length, t, len); } From c53686e69b38a3c85b6edb5b3549aab7cc0dcd25 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 13:00:37 -0400 Subject: [PATCH 029/134] More KRB5_DEPRECATED fixes --- lib/krb5/crypto.c | 4 ++-- lib/krb5/deprecated.c | 54 +++++++++++++++++++++++++------------------ lib/krb5/get_in_tkt.c | 4 ++-- lib/krb5/init_creds.c | 4 ++-- lib/krb5/mit_glue.c | 2 +- 5 files changed, 38 insertions(+), 30 deletions(-) diff --git a/lib/krb5/crypto.c b/lib/krb5/crypto.c index d9d9483a2..c641ddc60 100644 --- a/lib/krb5/crypto.c +++ b/lib/krb5/crypto.c @@ -5030,12 +5030,12 @@ krb5_crypto_fx_cf2(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_keytype_to_enctypes (krb5_context context, krb5_keytype keytype, unsigned *len, krb5_enctype **val) - KRB5_DEPRECATED { int i; unsigned n = 0; @@ -5077,11 +5077,11 @@ krb5_keytype_to_enctypes (krb5_context context, */ /* if two enctypes have compatible keys */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_boolean KRB5_LIB_CALL krb5_enctypes_compatible_keys(krb5_context context, krb5_enctype etype1, krb5_enctype etype2) - KRB5_DEPRECATED { struct encryption_type *e1 = _find_enctype(etype1); struct encryption_type *e2 = _find_enctype(etype2); diff --git a/lib/krb5/deprecated.c b/lib/krb5/deprecated.c index 90e8f5e1a..ce755cdb8 100644 --- a/lib/krb5/deprecated.c +++ b/lib/krb5/deprecated.c @@ -51,9 +51,9 @@ * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_data_contents(krb5_context context, krb5_data *data) - KRB5_DEPRECATED { krb5_data_free(data); } @@ -64,12 +64,12 @@ krb5_free_data_contents(krb5_context context, krb5_data *data) * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_keytype_to_enctypes_default (krb5_context context, krb5_keytype keytype, unsigned *len, krb5_enctype **val) - KRB5_DEPRECATED { unsigned int i, n; krb5_enctype *ret; @@ -114,11 +114,11 @@ static int num_keys = sizeof(keys) / sizeof(keys[0]); * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_keytype_to_string(krb5_context context, krb5_keytype keytype, char **string) - KRB5_DEPRECATED { const char *name; int i; @@ -151,11 +151,11 @@ krb5_keytype_to_string(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_string_to_keytype(krb5_context context, const char *string, krb5_keytype *keytype) - KRB5_DEPRECATED { char *end; int i; @@ -184,13 +184,13 @@ krb5_string_to_keytype(krb5_context context, * @ingroup krb5_deprecated */ -KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL +KRB5_DEPRECATED +KRB5_LIB_FUNCTION krb5_error_code krb5_password_key_proc (krb5_context context, krb5_enctype type, krb5_salt salt, krb5_const_pointer keyseed, krb5_keyblock **key) - KRB5_DEPRECATED { krb5_error_code ret; const char *password = (const char *)keyseed; @@ -220,6 +220,7 @@ krb5_password_key_proc (krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_tkt_with_password (krb5_context context, krb5_flags options, @@ -230,7 +231,6 @@ krb5_get_in_tkt_with_password (krb5_context context, krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep *ret_as_reply) - KRB5_DEPRECATED { return krb5_get_in_tkt (context, options, @@ -262,6 +262,7 @@ krb5_skey_key_proc (krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_tkt_with_skey (krb5_context context, krb5_flags options, @@ -272,7 +273,6 @@ krb5_get_in_tkt_with_skey (krb5_context context, krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep *ret_as_reply) - KRB5_DEPRECATED { if(key == NULL) return krb5_get_in_tkt_with_keytab (context, @@ -305,13 +305,13 @@ krb5_get_in_tkt_with_skey (krb5_context context, * @ingroup krb5_deprecated */ -KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL +KRB5_DEPRECATED +KRB5_LIB_FUNCTION krb5_error_code krb5_keytab_key_proc (krb5_context context, krb5_enctype enctype, krb5_salt salt, krb5_const_pointer keyseed, krb5_keyblock **key) - KRB5_DEPRECATED { krb5_keytab_key_proc_args *args = rk_UNCONST(keyseed); krb5_keytab keytab = args->keytab; @@ -345,6 +345,7 @@ krb5_keytab_key_proc (krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_tkt_with_keytab (krb5_context context, krb5_flags options, @@ -355,7 +356,6 @@ krb5_get_in_tkt_with_keytab (krb5_context context, krb5_ccache ccache, krb5_creds *creds, krb5_kdc_rep *ret_as_reply) - KRB5_DEPRECATED { krb5_keytab_key_proc_args a; @@ -376,6 +376,8 @@ krb5_get_in_tkt_with_keytab (krb5_context context, ret_as_reply); } +#ifdef KRB4 + static krb5_boolean convert_func(krb5_context conxtext, void *funcctx, krb5_principal principal) { @@ -389,6 +391,7 @@ convert_func(krb5_context conxtext, void *funcctx, krb5_principal principal) * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_425_conv_principal_ext(krb5_context context, const char *name, @@ -397,7 +400,6 @@ krb5_425_conv_principal_ext(krb5_context context, krb5_boolean (*func)(krb5_context, krb5_principal), krb5_boolean resolve, krb5_principal *principal) - KRB5_DEPRECATED { return krb5_425_conv_principal_ext2(context, name, @@ -415,13 +417,13 @@ krb5_425_conv_principal_ext(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_425_conv_principal(krb5_context context, const char *name, const char *instance, const char *realm, krb5_principal *princ) - KRB5_DEPRECATED { krb5_boolean resolve = krb5_config_get_bool(context, NULL, @@ -433,6 +435,8 @@ krb5_425_conv_principal(krb5_context context, NULL, resolve, princ); } +#endif + /** * Generate a new ccache of type `ops' in `id'. * @@ -444,11 +448,11 @@ krb5_425_conv_principal(krb5_context context, */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_cc_gen_new(krb5_context context, const krb5_cc_ops *ops, krb5_ccache *id) - KRB5_DEPRECATED { return krb5_cc_new_unique(context, ops->prefix, NULL, id); } @@ -459,10 +463,10 @@ krb5_cc_gen_new(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_realm * KRB5_LIB_CALL krb5_princ_realm(krb5_context context, krb5_principal principal) - KRB5_DEPRECATED { return &principal->realm; } @@ -474,11 +478,11 @@ krb5_princ_realm(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_princ_set_realm(krb5_context context, krb5_principal principal, krb5_realm *realm) - KRB5_DEPRECATED { principal->realm = *realm; } @@ -490,9 +494,9 @@ krb5_princ_set_realm(krb5_context context, */ /* keep this for compatibility with older code */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_free_creds_contents (krb5_context context, krb5_creds *c) - KRB5_DEPRECATED { return krb5_free_cred_contents (context, c); } @@ -508,9 +512,9 @@ krb5_free_creds_contents (krb5_context context, krb5_creds *c) * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_free_error_string(krb5_context context, char *str) - KRB5_DEPRECATED { krb5_free_error_message(context, str); } @@ -528,9 +532,10 @@ krb5_free_error_string(krb5_context context, char *str) * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_set_error_string(krb5_context context, const char *fmt, ...) - __attribute__((format (printf, 2, 3))) KRB5_DEPRECATED + __attribute__((format (printf, 2, 3))) { va_list ap; @@ -554,9 +559,10 @@ krb5_set_error_string(krb5_context context, const char *fmt, ...) * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_vset_error_string(krb5_context context, const char *fmt, va_list args) - __attribute__ ((format (printf, 2, 0))) KRB5_DEPRECATED + __attribute__ ((format (printf, 2, 0))) { krb5_vset_error_message(context, 0, fmt, args); return 0; @@ -572,9 +578,9 @@ krb5_vset_error_string(krb5_context context, const char *fmt, va_list args) * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_clear_error_string(krb5_context context) - KRB5_DEPRECATED { krb5_clear_error_message(context); } @@ -585,13 +591,14 @@ krb5_clear_error_string(krb5_context context) * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_cred_from_kdc_opt(krb5_context context, krb5_ccache ccache, krb5_creds *in_creds, krb5_creds **out_creds, krb5_creds ***ret_tgts, - krb5_flags flags) KRB5_DEPRECATED + krb5_flags flags) { krb5_kdc_flags f; f.i = flags; @@ -606,12 +613,13 @@ krb5_get_cred_from_kdc_opt(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_cred_from_kdc(krb5_context context, krb5_ccache ccache, krb5_creds *in_creds, krb5_creds **out_creds, - krb5_creds ***ret_tgts) KRB5_DEPRECATED + krb5_creds ***ret_tgts) { return krb5_get_cred_from_kdc_opt(context, ccache, in_creds, out_creds, ret_tgts, 0); diff --git a/lib/krb5/get_in_tkt.c b/lib/krb5/get_in_tkt.c index 7933d48c5..15cbfba89 100644 --- a/lib/krb5/get_in_tkt.c +++ b/lib/krb5/get_in_tkt.c @@ -361,6 +361,7 @@ set_ptypes(krb5_context context, return(1); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_cred(krb5_context context, krb5_flags options, @@ -374,7 +375,6 @@ krb5_get_in_cred(krb5_context context, krb5_const_pointer decryptarg, krb5_creds *creds, krb5_kdc_rep *ret_as_reply) - KRB5_DEPRECATED { krb5_error_code ret; AS_REQ a; @@ -526,6 +526,7 @@ out: return ret; } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_in_tkt(krb5_context context, krb5_flags options, @@ -539,7 +540,6 @@ krb5_get_in_tkt(krb5_context context, krb5_creds *creds, krb5_ccache ccache, krb5_kdc_rep *ret_as_reply) - KRB5_DEPRECATED { krb5_error_code ret; diff --git a/lib/krb5/init_creds.c b/lib/krb5/init_creds.c index 974a300ef..f555c724e 100644 --- a/lib/krb5/init_creds.c +++ b/lib/krb5/init_creds.c @@ -402,9 +402,9 @@ krb5_get_init_creds_opt_set_process_last_req(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION void KRB5_LIB_CALL krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt) - KRB5_DEPRECATED { memset (opt, 0, sizeof(*opt)); } @@ -416,11 +416,11 @@ krb5_get_init_creds_opt_init(krb5_get_init_creds_opt *opt) * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_get_init_creds_opt_get_error(krb5_context context, krb5_get_init_creds_opt *opt, KRB_ERROR **error) - KRB5_DEPRECATED { *error = calloc(1, sizeof(**error)); if (*error == NULL) { diff --git a/lib/krb5/mit_glue.c b/lib/krb5/mit_glue.c index 504cbc50f..2de98c966 100644 --- a/lib/krb5/mit_glue.c +++ b/lib/krb5/mit_glue.c @@ -317,12 +317,12 @@ krb5_c_encrypt_length(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_c_enctype_compare(krb5_context context, krb5_enctype e1, krb5_enctype e2, krb5_boolean *similar) - KRB5_DEPRECATED { *similar = (e1 == e2); return 0; From 39d89e9fcacfc3dc102bbe7dc31441ba379d2006 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 13:01:18 -0400 Subject: [PATCH 030/134] Export .def for libkadm5srv --- lib/kadm5/libkadm5srv-exports.def | 61 +++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 lib/kadm5/libkadm5srv-exports.def diff --git a/lib/kadm5/libkadm5srv-exports.def b/lib/kadm5/libkadm5srv-exports.def new file mode 100644 index 000000000..ed1fe514a --- /dev/null +++ b/lib/kadm5/libkadm5srv-exports.def @@ -0,0 +1,61 @@ +EXPORTS +; kadm5_ad_init_with_password +; kadm5_ad_init_with_password_ctx + kadm5_add_passwd_quality_verifier + kadm5_check_password_quality + kadm5_chpass_principal + kadm5_chpass_principal_with_key + kadm5_create_principal + kadm5_delete_principal + kadm5_destroy + kadm5_flush + kadm5_free_key_data + kadm5_free_name_list + kadm5_free_principal_ent + kadm5_get_principal + kadm5_get_principals + kadm5_get_privs + kadm5_init_with_creds + kadm5_init_with_creds_ctx + kadm5_init_with_password + kadm5_init_with_password_ctx + kadm5_init_with_skey + kadm5_init_with_skey_ctx + kadm5_modify_principal + kadm5_randkey_principal + kadm5_rename_principal + kadm5_ret_key_data + kadm5_ret_principal_ent + kadm5_ret_principal_ent_mask + kadm5_ret_tl_data + kadm5_setup_passwd_quality_check + kadm5_store_key_data + kadm5_store_principal_ent + kadm5_store_principal_ent_mask + kadm5_store_tl_data + kadm5_s_init_with_password_ctx + kadm5_s_init_with_password + kadm5_s_init_with_skey_ctx + kadm5_s_init_with_skey + kadm5_s_init_with_creds_ctx + kadm5_s_init_with_creds + kadm5_s_chpass_principal_cond + kadm5_log_set_version +; kadm5_log_signal_socket + kadm5_log_signal_socket_info + kadm5_log_previous + kadm5_log_goto_end + kadm5_log_foreach + kadm5_log_get_version_fd + kadm5_log_get_version + kadm5_log_replay + kadm5_log_end + kadm5_log_reinit + kadm5_log_init + kadm5_log_nop + kadm5_log_truncate + kadm5_log_modify + _kadm5_acl_check_permission + _kadm5_unmarshal_params + _kadm5_s_get_db + _kadm5_privs_to_string From 77fee77d0e1ab211bb0eaa53024bfbf3b9178f49 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 13:02:17 -0400 Subject: [PATCH 031/134] Use path tokens in krb5_config_parse_file_multi() --- lib/krb5/config_file.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/krb5/config_file.c b/lib/krb5/config_file.c index 639a55c06..558b82d14 100644 --- a/lib/krb5/config_file.c +++ b/lib/krb5/config_file.c @@ -420,6 +420,7 @@ krb5_config_parse_file_multi (krb5_context context, * enabled by calling krb5_set_home_dir_access(). */ if (fname[0] == '~' && fname[1] == '/') { +#ifndef KRB5_USE_PATH_TOKENS const char *home = NULL; if (!_krb5_homedir_access(context)) { @@ -445,6 +446,15 @@ krb5_config_parse_file_multi (krb5_context context, } fname = newfname; } +#else /* KRB5_USE_PATH_TOKENS */ + asprintf(&newfname, "%%{APPDATA}%s", &fname[1]); + if (newfname == NULL) { + krb5_set_error_message(context, ENOMEM, + N_("malloc: out of memory", "")); + return ENOMEM; + } + fname = newfname; +#endif } if (is_plist_file(fname)) { From d6adaa775f3a6ca07e39c6ddce28daa7782358af Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:38:36 -0400 Subject: [PATCH 032/134] No geteuid() on Windows --- lib/krb5/context.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/krb5/context.c b/lib/krb5/context.c index c6454335a..f3f3d1a72 100644 --- a/lib/krb5/context.c +++ b/lib/krb5/context.c @@ -319,9 +319,8 @@ krb5_init_context(krb5_context *context) goto out; #endif #ifdef NEED_SOCK_INIT - if (SOCK_INIT) { + if (SOCK_INIT) p->flags |= KRB5_CTX_F_SOCKETS_INITIALIZED; - } #endif out: @@ -1297,9 +1296,11 @@ _krb5_homedir_access(krb5_context context) { krb5_boolean allow; +#ifdef HAVE_GETEUID /* is never allowed for root */ if (geteuid() == 0) return FALSE; +#endif if (context && (context->flags & KRB5_CTX_F_HOMEDIR_ACCESS) == 0) return FALSE; From 6ba6a17ebdb17e94efb2cc2be740ec16a10f7799 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:39:38 -0400 Subject: [PATCH 033/134] Do things the WinSock way --- lib/krb5/net_read.c | 4 ++-- lib/krb5/net_write.c | 36 ++++++++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/lib/krb5/net_read.c b/lib/krb5/net_read.c index 59bfe71b2..5a8045988 100644 --- a/lib/krb5/net_read.c +++ b/lib/krb5/net_read.c @@ -39,7 +39,7 @@ krb5_net_read (krb5_context context, void *buf, size_t len) { - int fd = *((int *)p_fd); + SOCKET fd = *((SOCKET *)p_fd); - return net_read (fd, buf, len); + return net_read_s (fd, buf, len); } diff --git a/lib/krb5/net_write.c b/lib/krb5/net_write.c index 9c0d4a5a4..6377957ac 100644 --- a/lib/krb5/net_write.c +++ b/lib/krb5/net_write.c @@ -39,9 +39,9 @@ krb5_net_write (krb5_context context, const void *buf, size_t len) { - int fd = *((int *)p_fd); + SOCKET fd = *((SOCKET *)p_fd); - return net_write (fd, buf, len); + return net_write_s (fd, buf, len); } KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL @@ -51,7 +51,7 @@ krb5_net_write_block(krb5_context context, size_t len, time_t timeout) { - int fd = *((int *)p_fd); + SOCKET fd = *((SOCKET *)p_fd); int ret; struct timeval tv, *tvp; const char *cbuf = (const char *)buf; @@ -71,29 +71,45 @@ krb5_net_write_block(krb5_context context, tvp = NULL; ret = select(fd + 1, NULL, &wfds, NULL, tvp); - if (ret < 0) { - if (errno == EINTR) + if (IS_SOCKET_ERROR(ret)) { + if (SOCK_ERRNO == EINTR) continue; return -1; - } else if (ret == 0) + } + +#ifdef HAVE_WINSOCK + if (ret == 0) { + WSASetLastError( WSAETIMEDOUT ); return 0; + } + + count = send (fd, cbuf, rem, 0); + + if (IS_SOCKET_ERROR(count)) { + return -1; + } + +#else + if (ret == 0) { + return 0; + } if (!FD_ISSET(fd, &wfds)) { errno = ETIMEDOUT; return -1; } -#ifdef WIN32 - count = send (fd, cbuf, rem, 0); -#else count = write (fd, cbuf, rem); -#endif + if (count < 0) { if (errno == EINTR) continue; else return count; } + +#endif + cbuf += count; rem -= count; From 78a237e3cc67dbfb1764789384ee259a01d76671 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:40:06 -0400 Subject: [PATCH 034/134] No dirfd() on Windows --- lib/krb5/plugin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/krb5/plugin.c b/lib/krb5/plugin.c index 027f2a72a..9118ade67 100644 --- a/lib/krb5/plugin.c +++ b/lib/krb5/plugin.c @@ -205,7 +205,9 @@ load_plugins(krb5_context context) d = opendir(*di); if (d == NULL) continue; +#ifdef HAVE_DIRFD rk_cloexec(dirfd(d)); +#endif while ((entry = readdir(d)) != NULL) { char *n = entry->d_name; From 191361fdf5d639eb430f09aa0b942904ea737121 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:40:18 -0400 Subject: [PATCH 035/134] Calling convention change --- lib/krb5/prog_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/krb5/prog_setup.c b/lib/krb5/prog_setup.c index 1e83b4d06..21afbf8d1 100644 --- a/lib/krb5/prog_setup.c +++ b/lib/krb5/prog_setup.c @@ -45,7 +45,7 @@ krb5_std_usage(int code, struct getargs *args, int num_args) KRB5_LIB_FUNCTION int KRB5_LIB_CALL krb5_program_setup(krb5_context *context, int argc, char **argv, struct getargs *args, int num_args, - void (*usage)(int, struct getargs*, int)) + void (KRB5_LIB_CALL *usage)(int, struct getargs*, int)) { krb5_error_code ret; int optidx = 0; From 5dd6355e560b4c2ca21fcb5b5cdd327ba870a05c Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:41:20 -0400 Subject: [PATCH 036/134] libkrb5 .def file --- lib/krb5/libkrb5-exports.def.in | 758 ++++++++++++++++++++++++++++++++ 1 file changed, 758 insertions(+) create mode 100644 lib/krb5/libkrb5-exports.def.in diff --git a/lib/krb5/libkrb5-exports.def.in b/lib/krb5/libkrb5-exports.def.in new file mode 100644 index 000000000..d6056e2db --- /dev/null +++ b/lib/krb5/libkrb5-exports.def.in @@ -0,0 +1,758 @@ +EXPORTS + krb524_convert_creds_kdc + krb524_convert_creds_kdc_ccache +#ifdef KRB4 + krb5_425_conv_principal + krb5_425_conv_principal_ext2 + krb5_425_conv_principal_ext + krb5_524_conv_principal +#endif + krb5_abort + krb5_abortx + krb5_acl_match_file + krb5_acl_match_string + krb5_add_et_list + krb5_add_extra_addresses + krb5_add_ignore_addresses + krb5_addlog_dest + krb5_addlog_func + krb5_addr2sockaddr + krb5_address_compare + krb5_address_order + krb5_address_prefixlen_boundary + krb5_address_search + krb5_aname_to_localname + krb5_anyaddr + krb5_appdefault_boolean + krb5_appdefault_string + krb5_appdefault_time + krb5_append_addresses + krb5_auth_con_addflags + krb5_auth_con_free + krb5_auth_con_genaddrs + krb5_auth_con_generatelocalsubkey + krb5_auth_con_getaddrs + krb5_auth_con_getauthenticator + krb5_auth_con_getcksumtype + krb5_auth_con_getflags + krb5_auth_con_getkey + krb5_auth_con_getkeytype + krb5_auth_con_getlocalseqnumber + krb5_auth_con_getlocalsubkey + krb5_auth_con_getrcache + krb5_auth_con_getremotesubkey + krb5_auth_con_init + krb5_auth_con_removeflags + krb5_auth_con_setaddrs + krb5_auth_con_setaddrs_from_fd + krb5_auth_con_setcksumtype + krb5_auth_con_setflags + krb5_auth_con_setkey + krb5_auth_con_setkeytype + krb5_auth_con_setlocalseqnumber + krb5_auth_con_setlocalsubkey + krb5_auth_con_setrcache + krb5_auth_con_setremoteseqnumber + krb5_auth_con_setremotesubkey + krb5_auth_con_setuserkey + krb5_auth_getremoteseqnumber + krb5_build_ap_req + krb5_build_authenticator + krb5_build_principal + krb5_build_principal_ext + krb5_build_principal_va + krb5_build_principal_va_ext + krb5_c_block_size + krb5_c_checksum_length + krb5_c_decrypt + krb5_c_encrypt + krb5_c_encrypt_length + krb5_c_enctype_compare + krb5_c_get_checksum + krb5_c_is_coll_proof_cksum + krb5_c_is_keyed_cksum + krb5_c_keylengths + krb5_c_make_checksum + krb5_c_make_random_key + krb5_c_prf + krb5_c_prf_length + krb5_c_set_checksum + krb5_c_valid_cksumtype + krb5_c_valid_enctype + krb5_c_verify_checksum + krb5_cc_cache_end_seq_get + krb5_cc_cache_get_first + krb5_cc_cache_match + krb5_cc_cache_next + krb5_cc_clear_mcred + krb5_cc_close + krb5_cc_copy_cache + krb5_cc_copy_match_f + krb5_cc_default + krb5_cc_default_name + krb5_cc_destroy + krb5_cc_end_seq_get + krb5_cc_gen_new + krb5_cc_get_config + krb5_cc_get_friendly_name + krb5_cc_get_full_name + krb5_cc_get_lifetime + krb5_cc_get_name + krb5_cc_get_ops + krb5_cc_get_prefix_ops + krb5_cc_get_principal + krb5_cc_get_type + krb5_cc_get_version + krb5_cc_initialize + krb5_cc_move + krb5_cc_new_unique + krb5_cc_next_cred +; krb5_cc_next_cred_match + krb5_cc_register + krb5_cc_remove_cred + krb5_cc_resolve + krb5_cc_retrieve_cred + krb5_cc_set_config + krb5_cc_set_default_name + krb5_cc_set_flags + krb5_cc_start_seq_get + krb5_cc_store_cred + krb5_cc_switch + krb5_cc_set_friendly_name + krb5_change_password + krb5_check_transited + krb5_check_transited_realms + krb5_checksum_disable + krb5_checksum_free + krb5_checksum_is_collision_proof + krb5_checksum_is_keyed + krb5_checksumsize + krb5_cksumtype_to_enctype + krb5_cksumtype_valid + krb5_clear_error_string + krb5_clear_error_message + krb5_closelog + krb5_compare_creds + krb5_config_file_free + krb5_config_free_strings + krb5_config_get + krb5_config_get_bool + krb5_config_get_bool_default + krb5_config_get_int + krb5_config_get_int_default + krb5_config_get_list + krb5_config_get_next + krb5_config_get_string + krb5_config_get_string_default + krb5_config_get_strings + krb5_config_get_time + krb5_config_get_time_default + krb5_config_parse_file + krb5_config_parse_file_multi + krb5_config_parse_string_multi + krb5_config_vget + krb5_config_vget_bool + krb5_config_vget_bool_default + krb5_config_vget_int + krb5_config_vget_int_default + krb5_config_vget_list + krb5_config_vget_next + krb5_config_vget_string + krb5_config_vget_string_default + krb5_config_vget_strings + krb5_config_vget_time + krb5_config_vget_time_default + krb5_copy_address + krb5_copy_addresses + krb5_copy_checksum + krb5_copy_creds + krb5_copy_creds_contents + krb5_copy_data + krb5_copy_host_realm + krb5_copy_keyblock + krb5_copy_keyblock_contents + krb5_copy_principal + krb5_copy_ticket + krb5_create_checksum + krb5_create_checksum_iov + krb5_crypto_destroy + krb5_crypto_get_checksum_type + krb5_crypto_getblocksize + krb5_crypto_getconfoundersize + krb5_crypto_getenctype + krb5_crypto_getpadsize + krb5_crypto_init + krb5_crypto_overhead + krb5_crypto_prf + krb5_crypto_prf_length + krb5_crypto_length + krb5_crypto_length_iov + krb5_decrypt_iov_ivec + krb5_encrypt_iov_ivec + krb5_data_alloc + krb5_data_cmp + krb5_data_copy + krb5_data_free + krb5_data_realloc + krb5_data_zero + krb5_decode_Authenticator + krb5_decode_ETYPE_INFO2 + krb5_decode_ETYPE_INFO + krb5_decode_EncAPRepPart + krb5_decode_EncASRepPart + krb5_decode_EncKrbCredPart + krb5_decode_EncTGSRepPart + krb5_decode_EncTicketPart + krb5_decode_ap_req + krb5_decrypt + krb5_decrypt_EncryptedData + krb5_decrypt_ivec + krb5_decrypt_ticket + krb5_derive_key + krb5_digest_alloc + krb5_digest_free + krb5_digest_get_client_binding + krb5_digest_get_identifier + krb5_digest_get_opaque + krb5_digest_get_rsp + krb5_digest_get_server_nonce + krb5_digest_get_session_key + krb5_digest_get_tickets + krb5_digest_init_request + krb5_digest_probe + krb5_digest_rep_get_status + krb5_digest_request + krb5_digest_set_authentication_user + krb5_digest_set_authid + krb5_digest_set_client_nonce + krb5_digest_set_digest + krb5_digest_set_hostname + krb5_digest_set_identifier + krb5_digest_set_method + krb5_digest_set_nonceCount + krb5_digest_set_opaque + krb5_digest_set_qop + krb5_digest_set_realm + krb5_digest_set_responseData + krb5_digest_set_server_cb + krb5_digest_set_server_nonce + krb5_digest_set_type + krb5_digest_set_uri + krb5_digest_set_username + krb5_domain_x500_decode + krb5_domain_x500_encode + krb5_eai_to_heim_errno + krb5_encode_Authenticator + krb5_encode_ETYPE_INFO2 + krb5_encode_ETYPE_INFO + krb5_encode_EncAPRepPart + krb5_encode_EncASRepPart + krb5_encode_EncKrbCredPart + krb5_encode_EncTGSRepPart + krb5_encode_EncTicketPart + krb5_encrypt + krb5_encrypt_EncryptedData + krb5_encrypt_ivec + krb5_enctype_enable + krb5_enctype_disable + krb5_enctype_keybits + krb5_enctype_keysize + krb5_enctype_to_keytype + krb5_enctype_to_string + krb5_enctype_valid + krb5_enctypes_compatible_keys + krb5_err + krb5_error_from_rd_error + krb5_errx + krb5_expand_hostname + krb5_expand_hostname_realms + krb5_find_padata + krb5_format_time + krb5_free_address + krb5_free_addresses + krb5_free_ap_rep_enc_part + krb5_free_authenticator + krb5_free_checksum + krb5_free_checksum_contents + krb5_free_config_files + krb5_free_context + krb5_free_cred_contents + krb5_free_creds + krb5_free_creds_contents + krb5_free_data + krb5_free_data_contents + krb5_free_error + krb5_free_error_contents + krb5_free_error_string + krb5_free_error_message + krb5_free_host_realm + krb5_free_kdc_rep + krb5_free_keyblock + krb5_free_keyblock_contents + krb5_free_krbhst + krb5_free_principal + krb5_free_salt + krb5_free_ticket + krb5_fwd_tgt_creds + krb5_generate_random_block + krb5_generate_random_keyblock + krb5_generate_seq_number + krb5_generate_subkey + krb5_generate_subkey_extended + krb5_get_all_client_addrs + krb5_get_all_server_addrs + krb5_get_cred_from_kdc + krb5_get_cred_from_kdc_opt + krb5_get_credentials + krb5_get_credentials_with_flags + krb5_get_creds + krb5_get_creds_opt_add_options + krb5_get_creds_opt_alloc + krb5_get_creds_opt_free + krb5_get_creds_opt_set_enctype + krb5_get_creds_opt_set_impersonate + krb5_get_creds_opt_set_options + krb5_get_creds_opt_set_ticket + krb5_get_default_config_files + krb5_get_default_in_tkt_etypes + krb5_get_default_principal + krb5_get_default_realm + krb5_get_default_realms + krb5_get_dns_canonicalize_hostname + krb5_get_err_text + krb5_get_error_message + krb5_get_error_string + krb5_get_extra_addresses + krb5_get_fcache_version + krb5_get_forwarded_creds + krb5_get_host_realm + krb5_get_ignore_addresses + krb5_get_in_cred + krb5_get_in_tkt + krb5_get_in_tkt_with_keytab + krb5_get_in_tkt_with_password + krb5_get_in_tkt_with_skey +; krb5_get_init_creds + krb5_get_init_creds_keyblock + krb5_get_init_creds_keytab + krb5_get_init_creds_opt_alloc + krb5_get_init_creds_opt_free + krb5_get_init_creds_opt_get_error + krb5_get_init_creds_opt_init + krb5_get_init_creds_opt_set_address_list + krb5_get_init_creds_opt_set_addressless + krb5_get_init_creds_opt_set_anonymous + krb5_get_init_creds_opt_set_canonicalize + krb5_get_init_creds_opt_set_default_flags + krb5_get_init_creds_opt_set_etype_list + krb5_get_init_creds_opt_set_forwardable + krb5_get_init_creds_opt_set_pa_password + krb5_get_init_creds_opt_set_pac_request + krb5_get_init_creds_opt_set_pkinit + krb5_get_init_creds_opt_set_preauth_list + krb5_get_init_creds_opt_set_process_last_req + krb5_get_init_creds_opt_set_proxiable + krb5_get_init_creds_opt_set_renew_life + krb5_get_init_creds_opt_set_salt + krb5_get_init_creds_opt_set_tkt_life + krb5_get_init_creds_opt_set_win2k + krb5_get_init_creds_password + krb5_get_kdc_cred + krb5_get_kdc_sec_offset + krb5_get_krb524hst + krb5_get_krb_admin_hst + krb5_get_krb_changepw_hst + krb5_get_krbhst + krb5_get_max_time_skew + krb5_get_pw_salt + krb5_get_renewed_creds + krb5_get_server_rcache + krb5_get_use_admin_kdc + krb5_get_warn_dest + krb5_get_wrapped_length + krb5_getportbyname + krb5_h_addr2addr + krb5_h_addr2sockaddr + krb5_h_errno_to_heim_errno + krb5_have_error_string + krb5_hmac + krb5_init_context + krb5_init_ets + krb5_init_etype + krb5_initlog + krb5_is_thread_safe + krb5_is_config_principal + krb5_kerberos_enctypes + krb5_keyblock_get_enctype + krb5_keyblock_init + krb5_keyblock_key_proc + krb5_keyblock_zero + krb5_keytab_key_proc + krb5_keytype_to_enctypes + krb5_keytype_to_enctypes_default + krb5_keytype_to_string + krb5_krbhst_format_string + krb5_krbhst_free + krb5_krbhst_get_addrinfo + krb5_krbhst_init + krb5_krbhst_init_flags + krb5_krbhst_next + krb5_krbhst_next_as_string + krb5_krbhst_reset + krb5_kt_add_entry + krb5_kt_close + krb5_kt_compare + krb5_kt_copy_entry_contents + krb5_kt_destroy + krb5_kt_default + krb5_kt_default_modify_name + krb5_kt_default_name + krb5_kt_end_seq_get + krb5_kt_free_entry + krb5_kt_get_entry + krb5_kt_get_full_name + krb5_kt_get_name + krb5_kt_get_type + krb5_kt_next_entry + krb5_kt_read_service_key + krb5_kt_register + krb5_kt_remove_entry + krb5_kt_resolve + krb5_kt_start_seq_get + krb5_kuserok + krb5_log + krb5_log_msg + krb5_make_addrport + krb5_make_principal + krb5_max_sockaddr_size + krb5_mk_error + krb5_mk_priv + krb5_mk_rep + krb5_mk_req + krb5_mk_req_exact + krb5_mk_req_extended + krb5_mk_safe + krb5_net_read + krb5_net_write + krb5_net_write_block + krb5_ntlm_alloc + krb5_ntlm_free + krb5_ntlm_init_get_challange + krb5_ntlm_init_get_flags + krb5_ntlm_init_get_opaque + krb5_ntlm_init_get_targetinfo + krb5_ntlm_init_get_targetname + krb5_ntlm_init_request + krb5_ntlm_rep_get_sessionkey + krb5_ntlm_rep_get_status + krb5_ntlm_req_set_flags + krb5_ntlm_req_set_lm + krb5_ntlm_req_set_ntlm + krb5_ntlm_req_set_opaque + krb5_ntlm_req_set_session + krb5_ntlm_req_set_targetname + krb5_ntlm_req_set_username + krb5_ntlm_request + krb5_openlog + krb5_pac_add_buffer + krb5_pac_free + krb5_pac_get_buffer + krb5_pac_get_types + krb5_pac_init + krb5_pac_parse + krb5_pac_verify + krb5_padata_add + krb5_parse_address + krb5_parse_name + krb5_parse_name_flags + krb5_parse_nametype + krb5_passwd_result_to_string + krb5_password_key_proc + krb5_plugin_register + krb5_prepend_config_files + krb5_prepend_config_files_default + krb5_princ_realm + krb5_princ_set_realm + krb5_principal_compare + krb5_principal_compare_any_realm + krb5_principal_get_comp_string + krb5_principal_get_realm + krb5_principal_get_type + krb5_principal_match + krb5_principal_set_realm + krb5_principal_set_type + krb5_print_address + krb5_program_setup + krb5_prompter_posix + krb5_random_to_key + krb5_rc_close + krb5_rc_default + krb5_rc_default_name + krb5_rc_default_type + krb5_rc_destroy + krb5_rc_expunge + krb5_rc_get_lifespan + krb5_rc_get_name + krb5_rc_get_type + krb5_rc_initialize + krb5_rc_recover + krb5_rc_resolve + krb5_rc_resolve_full + krb5_rc_resolve_type + krb5_rc_store + krb5_rd_cred2 + krb5_rd_cred + krb5_rd_error + krb5_rd_priv + krb5_rd_rep + krb5_rd_req + krb5_rd_req_ctx + krb5_rd_req_in_ctx_alloc + krb5_rd_req_in_ctx_free + krb5_rd_req_in_set_keyblock + krb5_rd_req_in_set_keytab + krb5_rd_req_in_set_pac_check + krb5_rd_req_out_ctx_free + krb5_rd_req_out_get_ap_req_options + krb5_rd_req_out_get_keyblock + krb5_rd_req_out_get_ticket + krb5_rd_req_with_keyblock + krb5_rd_safe + krb5_read_message + krb5_read_priv_message + krb5_read_safe_message + krb5_realm_compare + krb5_recvauth + krb5_recvauth_match_version + krb5_ret_address + krb5_ret_addrs + krb5_ret_authdata + krb5_ret_creds + krb5_ret_creds_tag + krb5_ret_data + krb5_ret_int16 + krb5_ret_int32 + krb5_ret_int8 + krb5_ret_keyblock + krb5_ret_principal + krb5_ret_string + krb5_ret_stringnl + krb5_ret_stringz + krb5_ret_times + krb5_ret_uint16 + krb5_ret_uint32 + krb5_ret_uint8 + krb5_salttype_to_string + krb5_sendauth + krb5_sendto + krb5_sendto_context + krb5_sendto_ctx_add_flags + krb5_sendto_ctx_alloc + krb5_sendto_ctx_free + krb5_sendto_ctx_get_flags + krb5_sendto_ctx_set_func + krb5_sendto_ctx_set_type + krb5_sendto_kdc + krb5_sendto_kdc_flags + krb5_set_home_dir_access + krb5_set_config_files + krb5_set_default_in_tkt_etypes + krb5_set_default_realm + krb5_set_dns_canonicalize_hostname + krb5_set_error_string + krb5_set_error_message + krb5_set_extra_addresses + krb5_set_fcache_version + krb5_set_ignore_addresses + krb5_set_kdc_sec_offset + krb5_set_max_time_skew + krb5_set_password + krb5_set_password_using_ccache + krb5_set_real_time + krb5_set_send_to_kdc_func + krb5_set_use_admin_kdc + krb5_set_warn_dest + krb5_sname_to_principal + krb5_sock_to_principal + krb5_sockaddr2address + krb5_sockaddr2port + krb5_sockaddr_uninteresting + krb5_std_usage + krb5_storage_clear_flags + krb5_storage_emem + krb5_storage_free + krb5_storage_from_data + krb5_storage_from_fd + krb5_storage_from_mem + krb5_storage_from_readonly_mem + krb5_storage_get_byteorder + krb5_storage_get_eof_code + krb5_storage_is_flags + krb5_storage_read + krb5_storage_seek + krb5_storage_set_byteorder + krb5_storage_set_eof_code + krb5_storage_set_flags + krb5_storage_to_data + krb5_storage_truncate + krb5_storage_write + krb5_store_address + krb5_store_addrs + krb5_store_authdata + krb5_store_creds + krb5_store_creds_tag + krb5_store_data + krb5_store_int16 + krb5_store_int32 + krb5_store_int8 + krb5_store_keyblock + krb5_store_principal + krb5_store_string + krb5_store_stringnl + krb5_store_stringz + krb5_store_times + krb5_store_uint16 + krb5_store_uint32 + krb5_store_uint8 + krb5_string_to_deltat + krb5_string_to_enctype + krb5_string_to_key + krb5_string_to_key_data + krb5_string_to_key_data_salt + krb5_string_to_key_data_salt_opaque + krb5_string_to_key_derived + krb5_string_to_key_salt + krb5_string_to_key_salt_opaque + krb5_string_to_keytype + krb5_string_to_salttype + krb5_ticket_get_authorization_data_type + krb5_ticket_get_client + krb5_ticket_get_endtime + krb5_ticket_get_server + krb5_timeofday + krb5_unparse_name + krb5_unparse_name_fixed + krb5_unparse_name_fixed_flags + krb5_unparse_name_fixed_short + krb5_unparse_name_flags + krb5_unparse_name_short + krb5_us_timeofday + krb5_vabort + krb5_vabortx + krb5_verify_ap_req2 + krb5_verify_ap_req + krb5_verify_authenticator_checksum + krb5_verify_checksum + krb5_verify_checksum_iov + krb5_verify_init_creds + krb5_verify_init_creds_opt_init + krb5_verify_init_creds_opt_set_ap_req_nofail + krb5_verify_opt_alloc + krb5_verify_opt_free + krb5_verify_opt_init + krb5_verify_opt_set_ccache + krb5_verify_opt_set_flags + krb5_verify_opt_set_keytab + krb5_verify_opt_set_secure + krb5_verify_opt_set_service + krb5_verify_user + krb5_verify_user_lrealm + krb5_verify_user_opt + krb5_verr + krb5_verrx + krb5_vlog + krb5_vlog_msg + krb5_vset_error_string + krb5_vset_error_message + krb5_vwarn + krb5_vwarnx + krb5_warn + krb5_warnx + krb5_write_message + krb5_write_priv_message + krb5_write_safe_message + krb5_xfree + krb5_cccol_last_change_time + krb5_cccol_cursor_new + krb5_cccol_cursor_next + krb5_cccol_cursor_free + + ; com_err error tables + initialize_krb5_error_table_r + initialize_krb5_error_table + initialize_krb_error_table_r + initialize_krb_error_table + initialize_heim_error_table_r + initialize_heim_error_table + initialize_k524_error_table_r + initialize_k524_error_table + + ; variables + krb5_mcc_ops DATA + krb5_acc_ops DATA + krb5_fcc_ops DATA + krb5_scc_ops DATA +#ifdef HAVE_KCM + krb5_kcm_ops DATA +#endif +#ifdef KRB4 +; krb4_fkt_ops DATA +#endif + krb5_wrfkt_ops DATA + krb5_mkt_ops DATA + krb5_akf_ops DATA + krb5_any_ops DATA + __heimdal_version DATA + __heimdal_long_version DATA + krb5_config_file DATA + krb5_defkeyname DATA + krb5_cc_type_api DATA + krb5_cc_type_file DATA + krb5_cc_type_memory DATA + krb5_cc_type_kcm DATA + krb5_cc_type_scc DATA + + ; Shared with GSSAPI krb5 + _krb5_crc_init_table; + _krb5_crc_update; + + ; V4 compat glue + _krb5_krb_tf_setup + _krb5_krb_dest_tkt + _krb5_krb_life_to_time + _krb5_krb_decomp_ticket + _krb5_krb_decomp_ticket + _krb5_krb_create_ticket + _krb5_krb_create_ciph + _krb5_krb_create_auth_reply + _krb5_krb_rd_req + _krb5_krb_free_auth_data + _krb5_krb_time_to_life + _krb5_krb_cr_err_reply + + ; Shared with libkdc + _krb5_AES_string_to_default_iterator + _krb5_dh_group_ok + _krb5_get_host_realm_int + _krb5_get_int + _krb5_pac_sign + _krb5_parse_moduli + _krb5_pk_enterprise_cert + _krb5_pk_kdf + _krb5_pk_load_id + _krb5_pk_mk_ContentInfo + _krb5_pk_octetstring2key + _krb5_plugin_find + _krb5_plugin_free + _krb5_plugin_get_next + _krb5_plugin_get_symbol + _krb5_principal2principalname + _krb5_principalname2krb5_principal + _krb5_put_int + _krb5_s4u2self_to_checksumdata + _krb5_expand_path_tokens + + ; testing +; _krb5_aes_cts_encrypt + _krb5_n_fold + _krb5_expand_default_cc_name From 7ee1695f12d480204407d8352e1068f77b516161 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:41:58 -0400 Subject: [PATCH 037/134] Add cloexec() and xfree() to libroken --- lib/roken/NTMakefile | 4 +++- lib/roken/cloexec.c | 7 ++++--- lib/roken/xfree.c | 2 -- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile index 107ac0277..28e96c348 100644 --- a/lib/roken/NTMakefile +++ b/lib/roken/NTMakefile @@ -37,6 +37,7 @@ libroken_la_OBJS = \ $(OBJ)\base64.obj \ $(OBJ)\bswap.obj \ $(OBJ)\concat.obj \ + $(OBJ)\cloexec.obj \ $(OBJ)\dirent.obj \ $(OBJ)\dlfcn_w32.obj \ $(OBJ)\dumpdata.obj \ @@ -102,7 +103,8 @@ libroken_la_OBJS = \ $(OBJ)\vwarnx.obj \ $(OBJ)\warn.obj \ $(OBJ)\warnerr.obj \ - $(OBJ)\warnx.obj + $(OBJ)\warnx.obj \ + $(OBJ)\xfree.obj {}.c{$(OBJ)}.obj: $(C2OBJ) -DBUILD_ROKEN_LIB diff --git a/lib/roken/cloexec.c b/lib/roken/cloexec.c index c015b1d8f..901512a9d 100644 --- a/lib/roken/cloexec.c +++ b/lib/roken/cloexec.c @@ -33,14 +33,12 @@ #include -#include -#include - #include "roken.h" void ROKEN_LIB_FUNCTION rk_cloexec(int fd) { +#ifdef HAVE_FCNTL int ret; ret = fcntl(fd, F_GETFD); @@ -48,10 +46,13 @@ rk_cloexec(int fd) return; if (fcntl(fd, F_SETFD, ret | FD_CLOEXEC) == -1) return; +#endif } void ROKEN_LIB_FUNCTION rk_cloexec_file(FILE *f) { +#ifdef HAVE_FCNTL rk_cloexec(fileno(f)); +#endif } diff --git a/lib/roken/xfree.c b/lib/roken/xfree.c index 13366ce13..c7e30daf8 100644 --- a/lib/roken/xfree.c +++ b/lib/roken/xfree.c @@ -33,8 +33,6 @@ #include -#include - #include "roken.h" void ROKEN_LIB_FUNCTION From 49b261efdc8f5ea1e4006f694695f20d034fc47a Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:43:32 -0400 Subject: [PATCH 038/134] Formalize the simple_exec*() API --- lib/roken/roken-common.h | 14 +++++++++++++- lib/roken/simple_exec.c | 26 +++++++++++++------------- lib/roken/simple_exec_w32.c | 26 +++++++++++++------------- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/lib/roken/roken-common.h b/lib/roken/roken-common.h index e83d5049c..11d4a25ce 100644 --- a/lib/roken/roken-common.h +++ b/lib/roken/roken-common.h @@ -288,6 +288,18 @@ SigAction signal(int iSig, SigAction pAction); /* BSD compatible */ #endif #endif +#define SE_E_UNSPECIFIED (-1) +#define SE_E_FORKFAILED (-2) +#define SE_E_WAITPIDFAILED (-3) +#define SE_E_EXECTIMEOUT (-4) +#define SE_E_NOEXEC 126 +#define SE_E_NOTFOUND 127 + +#define SE_PROCSTATUS(st) (((st) >= 0 && (st) < 126)? st: -1) +#define SE_PROCSIGNAL(st) (((st) >= 128)? (st) - 128: -1) +#define SE_IS_ERROR(st) ((st) < 0 || (st) >= 126) + + #define simple_execve rk_simple_execve ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL simple_execve(const char*, char*const[], char*const[]); @@ -475,7 +487,7 @@ rk_cloexec(int); ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_cloexec_file(FILE *); -int ROKEN_LIB_FUNCTION +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL ct_memcmp(const void *, const void *, size_t); ROKEN_CPP_END diff --git a/lib/roken/simple_exec.c b/lib/roken/simple_exec.c index 02d62d770..97679d7e4 100644 --- a/lib/roken/simple_exec.c +++ b/lib/roken/simple_exec.c @@ -52,13 +52,13 @@ #define EX_NOTFOUND 127 /* return values: - -1 on `unspecified' system errors - -2 on fork failures - -3 on waitpid errors - -4 exec timeout + SE_E_UNSPECIFIED on `unspecified' system errors + SE_E_FORKFAILED on fork failures + SE_E_WAITPIDFAILED on waitpid errors + SE_E_EXECTIMEOUT exec timeout 0- is return value from subprocess - 126 if the program couldn't be executed - 127 if the program couldn't be found + SE_E_NOEXEC if the program couldn't be executed + SE_E_NOTFOUND if the program couldn't be found 128- is 128 + signal that killed subprocess possible values `func' can return: @@ -98,7 +98,7 @@ wait_for_process_timed(pid_t pid, time_t (*func)(void *), while(waitpid(pid, &status, 0) < 0) { if (errno != EINTR) { - ret = -3; + ret = SE_E_WAITPIDFAILED; goto out; } if (func == NULL) @@ -110,7 +110,7 @@ wait_for_process_timed(pid_t pid, time_t (*func)(void *), kill(pid, SIGTERM); continue; } else if (timeout == (time_t)-2) { - ret = -4; + ret = SE_E_EXECTIMEOUT; goto out; } alarm(timeout); @@ -211,7 +211,7 @@ pipe_execv(FILE **stdin_fd, FILE **stdout_fd, FILE **stderr_fd, close(err_fd[0]); close(err_fd[1]); } - return -2; + return SE_E_FORKFAILED; default: if(stdin_fd != NULL) { close(in_fd[0]); @@ -236,7 +236,7 @@ simple_execvp_timed(const char *file, char *const args[], pid_t pid = fork(); switch(pid){ case -1: - return -2; + return SE_E_FORKFAILED; case 0: execvp(file, args); exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC); @@ -259,7 +259,7 @@ simple_execve_timed(const char *file, char *const args[], char *const envp[], pid_t pid = fork(); switch(pid){ case -1: - return -2; + return SE_E_FORKFAILED; case 0: execve(file, args, envp); exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC); @@ -285,7 +285,7 @@ simple_execlp(const char *file, ...) argv = vstrcollect(&ap); va_end(ap); if(argv == NULL) - return -1; + return SE_E_UNSPECIFIED; ret = simple_execvp(file, argv); free(argv); return ret; @@ -304,7 +304,7 @@ simple_execle(const char *file, ... /* ,char *const envp[] */) envp = va_arg(ap, char **); va_end(ap); if(argv == NULL) - return -1; + return SE_E_UNSPECIFIED; ret = simple_execve(file, argv, envp); free(argv); return ret; diff --git a/lib/roken/simple_exec_w32.c b/lib/roken/simple_exec_w32.c index 1356018f1..201fd4134 100644 --- a/lib/roken/simple_exec_w32.c +++ b/lib/roken/simple_exec_w32.c @@ -51,7 +51,7 @@ RCSID("$Id$"); * the callback function is called. THe possible return values * from the callback function are: * - * - ((time_t) -2) Exit loop without killing child and return -4. + * - ((time_t) -2) Exit loop without killing child and return SE_E_EXECTIMEOUT. * - ((time_t) -1) Kill child with SIGTERM and wait for child to exit. * - 0 Don't timeout again * - n Seconds to next timeout @@ -60,12 +60,12 @@ RCSID("$Id$"); * * @param[in] timeout Seconds to first timeout. * - * @retval -1 Unspecified system error - * @retval -2 Fork failure (not applicable for _WIN32 targets) - * @retval -3 waitpid errors - * @retval -4 exec timeout - * @retval 0- Return value from subprocess - * @retval 126 The program coudln't be found + * @retval SE_E_UNSPECIFIED Unspecified system error + * @retval SE_E_FORKFAILED Fork failure (not applicable for _WIN32 targets) + * @retval SE_E_WAITPIDFAILED waitpid errors + * @retval SE_E_EXECTIMEOUT exec timeout + * @retval 0 <= Return value from subprocess + * @retval SE_E_NOTFOUND The program coudln't be found * @retval 128- The signal that killed the subprocess +128. */ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL @@ -78,7 +78,7 @@ wait_for_process_timed(pid_t pid, time_t (*func)(void *), int rv = 0; if (hProcess == NULL) - return -4; + return SE_E_WAITPIDFAILED; dtimeout = (DWORD) ((timeout == 0)? INFINITE: timeout * 1000); @@ -106,12 +106,12 @@ wait_for_process_timed(pid_t pid, time_t (*func)(void *), dtimeout = INFINITE; continue; } - rv = -1; + rv = SE_E_UNSPECIFIED; break; } else if (timeout == (time_t) -2) { - rv = -4; + rv = SE_E_EXECTIMEOUT; break; } else { @@ -123,7 +123,7 @@ wait_for_process_timed(pid_t pid, time_t (*func)(void *), } else { - rv = -1; + rv = SE_E_UNSPECIFIED; break; } @@ -403,7 +403,7 @@ simple_execlp(const char *file, ...) argv = vstrcollect(&ap); va_end(ap); if(argv == NULL) - return -1; + return SE_E_UNSPECIFIED; ret = simple_execvp(file, argv); free(argv); return ret; @@ -423,7 +423,7 @@ simple_execle(const char *file, ... /* ,char *const envp[] */) envp = va_arg(ap, char **); va_end(ap); if(argv == NULL) - return -1; + return SE_E_UNSPECIFIED; ret = simple_execve(file, argv, envp); free(argv); return ret; From 418dd986e5d61283ea4faf3b0e297460edc423cd Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:44:13 -0400 Subject: [PATCH 039/134] Add bit-types to roken.h so that we don't need to include krb5-types.h everywhere --- lib/roken/roken.h.in | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 977bb445e..6c74de535 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -95,6 +95,24 @@ typedef int SOCKET; #include +#ifndef __BIT_TYPES_DEFINED__ +#define __BIT_TYPES_DEFINED__ + +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +typedef __int64 int64_t; +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +typedef uint64_t u_int64_t; + +#endif /* __BIT_TYPES_DEFINED__ */ + #define UNREACHABLE(x) x #define UNUSED_ARGUMENT(x) ((void) x) @@ -221,14 +239,16 @@ ROKEN_CPP_START #ifdef _MSC_VER /* Additional macros for Visual C/C++ runtime */ -#define close _close +#define close _close -#define getpid _getpid +#define getpid _getpid -#define open _open +#define open _open #define chdir _chdir +#define fsync _commit + /* The MSVC implementation of snprintf is not C99 compliant. */ #define snprintf rk_snprintf #define vsnprintf rk_vsnprintf @@ -580,9 +600,13 @@ readv(int, const struct iovec *, int); #endif #ifndef HAVE_PIDFILE +#ifdef NO_PIDFILES +#define pidfile(x) ((void) 0) +#else #define pidfile rk_pidfile ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL pidfile (const char*); #endif +#endif #ifndef HAVE_BSWAP32 #define bswap32 rk_bswap32 @@ -788,6 +812,8 @@ ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL gai_strerror(int); #endif +#ifdef HAVE_WINSOCK + /* While we are at it, define WinSock specific scatter gather socket I/O. */ From 68e06566cc90b223a320a23157ee83356f585dad Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:44:36 -0400 Subject: [PATCH 040/134] Use ROKEN_CPP_START and ROKEN_CPP_END instead of __BEGIN_DECLS/__END_DECLS --- lib/roken/vis.hin | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/roken/vis.hin b/lib/roken/vis.hin index 412a191e6..25d662a98 100644 --- a/lib/roken/vis.hin +++ b/lib/roken/vis.hin @@ -104,6 +104,7 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strunvisx(char *, const char *, int); ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_unvis(char *, int, int *, int); + ROKEN_CPP_END #ifndef HAVE_VIS From 475f6ba50904965af1330634a5fab1e737801cfd Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:44:55 -0400 Subject: [PATCH 041/134] Dependency fix for vers/NTMakefile --- lib/vers/NTMakefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/vers/NTMakefile b/lib/vers/NTMakefile index d91d3825e..db885cf5c 100644 --- a/lib/vers/NTMakefile +++ b/lib/vers/NTMakefile @@ -41,9 +41,6 @@ $(LIBVERS): $(OBJ)\print_version.obj $(OBJ)\print_version.obj: print_version.c $(C2OBJ) -I$(OBJ) -$(OBJ)\make-print-version.obj: make-print-version.c - $(C2OBJ) -DKRB5 - $(OBJ)\make-print-version.exe: $(OBJ)\make-print-version.obj $(EXECONLINK) $(_VC_MANIFEST_EMBED_EXE) From 4be30644fb8c35ebe69408d1944c0fbfd8879762 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:45:27 -0400 Subject: [PATCH 042/134] Update for wind/NTMakefile --- lib/wind/NTMakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/wind/NTMakefile b/lib/wind/NTMakefile index d4cdf1004..e4b6af36e 100644 --- a/lib/wind/NTMakefile +++ b/lib/wind/NTMakefile @@ -65,32 +65,32 @@ INCFILES= \ $(OBJ)\map_table.h $(OBJ)\map_table.c: rfc3454.txt gen-map.py stringprep.py cd $(OBJ) - $(PYTHON) $(SRCDIR)\gen-map.py $(SRCDIR)\rfc3454.txt + $(PYTHON) $(SRCDIR)\gen-map.py $(SRCDIR)\rfc3454.txt $(OBJ) cd $(SRCDIR) $(OBJ)\errorlist_table.h $(OBJ)\errorlist_table.c: rfc3454.txt gen-errorlist.py stringprep.py cd $(OBJ) - $(PYTHON) $(SRCDIR)\gen-errorlist.py $(SRCDIR)\rfc3454.txt + $(PYTHON) $(SRCDIR)\gen-errorlist.py $(SRCDIR)\rfc3454.txt $(OBJ) cd $(SRCDIR) $(OBJ)\normalize_table.h $(OBJ)\normalize_table.c: UnicodeData.txt CompositionExclusions-3.2.0.txt gen-normalize.py cd $(OBJ) - $(PYTHON) $(SRCDIR)\gen-normalize.py $(SRCDIR)\UnicodeData.txt $(SRCDIR)\CompositionExclusions-3.2.0.txt + $(PYTHON) $(SRCDIR)\gen-normalize.py $(SRCDIR)\UnicodeData.txt $(SRCDIR)\CompositionExclusions-3.2.0.txt $(OBJ) cd $(SRCDIR) $(OBJ)\combining_table.h $(OBJ)\combining_table.c: UnicodeData.txt gen-combining.py cd $(OBJ) - $(PYTHON) $(SRCDIR)\gen-combining.py $(SRCDIR)\UnicodeData.txt + $(PYTHON) $(SRCDIR)\gen-combining.py $(SRCDIR)\UnicodeData.txt $(OBJ) cd $(SRCDIR) $(OBJ)\bidi_table.h $(OBJ)\bidi_table.c: rfc3454.txt gen-bidi.py cd $(OBJ) - $(PYTHON) $(SRCDIR)\gen-bidi.py $(SRCDIR)\rfc3454.txt + $(PYTHON) $(SRCDIR)\gen-bidi.py $(SRCDIR)\rfc3454.txt $(OBJ) cd $(SRCDIR) $(OBJ)\punycode_examples.h $(OBJ)\punycode_examples.c: gen-punycode-examples.py rfc3492.txt cd $(OBJ) - $(PYTHON) $(SRCDIR)\gen-punycode-examples.py $(SRCDIR)\rfc3492.txt + $(PYTHON) $(SRCDIR)\gen-punycode-examples.py $(SRCDIR)\rfc3492.txt $(OBJ) cd $(SRCDIR) $(OBJ)\wind_err.c $(OBJ)\wind_err.h: wind_err.et From 2df5c26c00b5d60bc62d9d6041768dcb31994a50 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 26 Aug 2009 14:46:13 -0400 Subject: [PATCH 043/134] Build system update --- windows/NTMakefile.config | 7 +++-- windows/NTMakefile.w32 | 54 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 56 insertions(+), 5 deletions(-) diff --git a/windows/NTMakefile.config b/windows/NTMakefile.config index 7f021d808..d7f427958 100644 --- a/windows/NTMakefile.config +++ b/windows/NTMakefile.config @@ -34,9 +34,12 @@ VER_PRERELEASE=1 # For each feature enabled here, a corresponding line must exist in # the inline Perl script in include\NTMakefile. -# Enable Kerberos 5 support in applications +# Enable Kerberos v5 support in applications KRB5=1 +# Enable Kerberos v4 +# KRB4=1 + # Enable PKINIT PKINIT=1 @@ -88,4 +91,4 @@ ENABLE_PTHREAD_SUPPORT=1 # Use the Kerberos Credentials Manager # HAVE_KCM=1 -DIR_hdbdir=$${COMMON_APPDATA}/heimdal/hdb +DIR_hdbdir=%{COMMON_APPDATA}\heimdal\hdb diff --git a/windows/NTMakefile.w32 b/windows/NTMakefile.w32 index b7acaee58..971dcb98f 100644 --- a/windows/NTMakefile.w32 +++ b/windows/NTMakefile.w32 @@ -1,3 +1,33 @@ +######################################################################## +# +# Copyright (c) 2009, Secure Endpoints Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# - Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# - 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. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 +# COPYRIGHT HOLDER 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. +# all:: @@ -32,12 +62,14 @@ SRC=$(MAKEDIR)\..\.. #---------------------------------------------------------------- # Directory macros -DESTDIR=$(SRC)\windows\dest_$(OUTDIR) -OBJDIR =$(SRC)\windows\obj_$(OUTDIR) +DESTDIR=$(SRC)\out32\dest_$(OUTDIR) +OBJDIR =$(SRC)\out32\obj_$(OUTDIR) INCDIR =$(DESTDIR)\inc LIBDIR =$(DESTDIR)\lib BINDIR =$(DESTDIR)\bin +SBINDIR=$(BINDIR) +LIBEXECDIR=$(BINDIR) !ifdef RELDIR SRCDIR =$(SRC)\$(RELDIR) @@ -97,6 +129,14 @@ SED=sed.exe #---------------------------------------------------------------- # External dependencies +# For pthread support to be enabled, both PTHREAD_INC and PTHREAD_LIB +# should be defined. PTHREAD_INC should be the include directory +# where pthread.h is to be found (i.e. $(PTHREAD_INC)\pthread.h should +# exist), and PTHREAD_LIB is the full path to the pthread import +# library. +# +# Note that both paths should not contain any whitespace. + !ifdef PTHREAD_INC pthreadinc= -I$(PTHREAD_INC) !endif @@ -145,6 +185,9 @@ DLLGUILINK = $(DLLGUILINK_C) -OUT:$@ $** LIBGUI = $(LIBGUI_C) /OUT:$@ $** LIBCON = $(LIBCON_C) /OUT:$@ $** +# Preprocess files to stdout using config.h +CPREPROCESSOUT = $(CC) /EP /FI$(INCDIR)\config.h /TC /DCPP_ONLY=1 + # Resources RC2RES_C = $(RC) $(cincdirs) $(AUXRCFLAGS) @@ -231,6 +274,9 @@ prep:: show-cmds {$(OBJ)}.x{$(OBJ)}.c: $(CP) $< $@ +{$(OBJ)}.hx{$(INCDIR)}.h: + $(CP) $< $@ + {}.rc{$(OBJ)}.res: $(RC2RES) @@ -314,7 +360,7 @@ clean:: -$(RM) $(OBJ)\*.* !endif -.SUFFIXES: .c .cpp .hin .h .x +.SUFFIXES: .c .cpp .hin .h .x .hx #---------------------------------------------------------------------- # Manifest handling @@ -373,3 +419,5 @@ LIBKRB5 =$(LIBDIR)\libkrb5.lib LIBHEIMNTLM =$(LIBDIR)\libheimntlm.lib LIBGSSAPI =$(LIBDIR)\libgssapi.lib LIBHDB =$(LIBDIR)\libhdb.lib +LIBKADM5SRV =$(LIBDIR)\libkadm5srv.lib +LIBKADM5CLNT=$(LIBDIR)\libkadm5clnt.lib From 9072a627290130ec8aeb4ccf1c100ae8458358d5 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Sep 2009 16:30:29 -0400 Subject: [PATCH 044/134] Build libasn1 as a DLL In addition to building libasn1 as a DLL also add a build target so that a list of exports can be generated and used to check with the .def file whether any exports are being left out. --- cf/w32-list-externs-from-objs.pl | 77 ++ lib/asn1/NTMakefile | 30 +- lib/asn1/libasn1-exports.def | 1498 ++++++++++++++++++++++++++++++ 3 files changed, 1601 insertions(+), 4 deletions(-) create mode 100644 cf/w32-list-externs-from-objs.pl create mode 100644 lib/asn1/libasn1-exports.def diff --git a/cf/w32-list-externs-from-objs.pl b/cf/w32-list-externs-from-objs.pl new file mode 100644 index 000000000..f72d0ae7e --- /dev/null +++ b/cf/w32-list-externs-from-objs.pl @@ -0,0 +1,77 @@ +my $show_module_name = 1; +my $use_indent = 1; +my $strip_leading_underscore = 0; + +# Dump all symbols for the given object file that are defined and have +# external scope. + +sub dump_symbols_for_file($) +{ + $fn = shift; + + print STDERR "Opening dump of object [$fn]\n"; + + open(SP, '-|', "dumpbin /symbols \"".$fn."\"") or die "Can't open pipe for $fn"; + + LINE: + while () { + # 008 00000000 SECT3 notype () External | _encode_AccessDescription + + /^[[:xdigit:]]{3,}\s[[:xdigit:]]{8,}\s(\w+)\s+\w*\s+\(\)\s+(\w+)\s+\|\s+(\w+)$/ && do { + my ($section, $visibility, $symbol) = ($1, $2, $3); + + if ($section ne "UNDEF" && $visibility eq "External") { + print $fn if $show_module_name; + print "\t" if $use_indent || $show_module_name; + + if ($strip_leading_underscore && $symbol =~ /_(.*)/) { + $symbol = $1; + } + print $symbol; + print "\n"; + } + }; + } + + close SP; +} + +sub use_response_file($) +{ + $fn = shift; + + open (RF, '<', $fn) or die "Can't open response file $fn"; + + while () { + /(\S+)/ && do { + dump_symbols_for_file($1); + } + } + close RF; +} + +for (@ARGV) { + ARG: { + /-q/ && do { + $show_module_name = 0; + last ARG; + }; + + /-1/ && do { + $use_indent = 0; + last ARG; + }; + + /-u/ && do { + $strip_leading_underscore = 1; + last ARG; + }; + + /@(.*)/ && do { + use_response_file($1); + last ARG; + }; + + dump_symbols_for_file($_); + } +} diff --git a/lib/asn1/NTMakefile b/lib/asn1/NTMakefile index a5c5f41d2..8f5df0b15 100644 --- a/lib/asn1/NTMakefile +++ b/lib/asn1/NTMakefile @@ -470,7 +470,7 @@ gen_files_kx509 = \ $(OBJ)\asn1_Kx509Response.x \ $(OBJ)\asn1_Kx509Request.x -asn1_binaries = \ +ASN1_BINARIES = \ $(BINDIR)\asn1_compile.exe \ $(BINDIR)\asn1_print.exe \ $(BINDIR)\asn1_gen.exe @@ -517,7 +517,7 @@ $(BINDIR)\asn1_gen.exe: $(OBJ)\asn1_gen.obj $(LIBASN1) $(_VC_MANIFEST_CLEAN) $(_CODESIGN) -$(LIBASN1): \ +LIBASN1_OBJS= \ $(OBJ)\der.obj \ $(OBJ)\der_get.obj \ $(OBJ)\der_put.obj \ @@ -538,13 +538,35 @@ $(LIBASN1): \ $(gen_files_digest:.x=.obj) \ $(gen_files_kx509:.x=.obj) \ $(OBJ)\asn1_err.obj - $(LIBCON_C) /OUT:$@ @<< + +LIBASN1_LIBS=\ + $(LIBROKEN) \ + $(LIBCOMERR) + +$(LIBASN1): $(BINDIR)\libasn1.dll + +$(BINDIR)\libasn1.dll: $(LIBASN1_OBJS) + $(DLLGUILINK_C) /OUT:$@ /DEF:libasn1-exports.def /IMPLIB:$(LIBASN1) $(LIBASN1_LIBS) @<< $(**: = ) << + $(DLLPREP) clean:: -$(RM) $(LIBASN1) + -$(RM) $(BINDIR)\libasn1.dll + +# +# Generate list of exports +# +# This target is only used during development to generate a list of +# symbols that are exported from all the object files in LIBASN1_OBJS. +# +exports-list.txt: $(LIBASN1_OBJS) + $(PERL) ..\..\cf\w32-list-externs-from-objs.pl -q -u @<< > $@ +$(**: = +) +<< $(gen_files_k5:.x=.c) : $$(@R).x @@ -681,7 +703,7 @@ $(OBJ)\der-protos.h: $(libasn1_SOURCES:der-protos.h=) clean:: -$(RM) $(INCDIR)\der-protos.h -all:: $(INCFILES) $(GENINCFILES) $(LIBASN1) $(asn1_binaries) +all:: $(INCFILES) $(ASN1_BINARIES) $(GENINCFILES) $(LIBASN1) TEST_BINARIES=\ $(OBJ)\check-der.exe \ diff --git a/lib/asn1/libasn1-exports.def b/lib/asn1/libasn1-exports.def new file mode 100644 index 000000000..293961c83 --- /dev/null +++ b/lib/asn1/libasn1-exports.def @@ -0,0 +1,1498 @@ +EXPORTS + der_get_class_name + der_get_class_num + der_get_type_name + der_get_type_num + der_get_tag_name + der_get_tag_num + der_get_unsigned + der_get_integer + der_get_length + der_get_boolean + der_get_general_string + der_get_utf8string + der_get_printable_string + der_get_ia5_string + der_get_bmp_string + der_get_universal_string + der_get_visible_string + der_get_octet_string + der_get_octet_string_ber + der_get_heim_integer + der_get_generalized_time + der_get_utctime + der_get_oid + der_get_tag + der_match_tag + der_match_tag2 + der_match_tag_and_length + _heim_fix_dce + der_get_bit_string + der_put_unsigned + der_put_integer + der_put_length + der_put_boolean + der_put_general_string + der_put_utf8string + der_put_printable_string + der_put_ia5_string + der_put_bmp_string + der_put_universal_string + der_put_visible_string + der_put_octet_string + der_put_heim_integer + der_put_generalized_time + der_put_utctime + der_put_oid + der_put_tag + der_put_length_and_tag + _heim_time2generalizedtime + der_put_bit_string + _heim_der_set_sort + der_free_general_string + der_free_utf8string + der_free_printable_string + der_free_ia5_string + der_free_bmp_string + der_free_universal_string + der_free_visible_string + der_free_octet_string + der_free_heim_integer + der_free_oid + der_free_bit_string + _heim_len_unsigned + _heim_len_int + der_length_len + der_length_integer + der_length_unsigned + der_length_enumerated + der_length_general_string + der_length_utf8string + der_length_printable_string + der_length_ia5_string + der_length_bmp_string + der_length_universal_string + der_length_visible_string + der_length_octet_string + der_length_heim_integer + der_length_oid + der_length_generalized_time + der_length_utctime + der_length_boolean + der_length_bit_string + der_copy_general_string + der_copy_utf8string + der_copy_printable_string + der_copy_ia5_string + der_copy_bmp_string + der_copy_universal_string + der_copy_visible_string + der_copy_octet_string + der_copy_heim_integer + der_copy_oid + der_copy_bit_string + der_heim_oid_cmp + der_heim_octet_string_cmp + der_heim_bit_string_cmp + der_heim_integer_cmp + der_heim_bmp_string_cmp + der_heim_universal_string_cmp + der_parse_hex_heim_integer + der_print_hex_heim_integer + der_print_heim_oid + der_parse_heim_oid + encode_heim_any + decode_heim_any + free_heim_any + length_heim_any + copy_heim_any + encode_heim_any_set + decode_heim_any_set + free_heim_any_set + length_heim_any_set + copy_heim_any_set + heim_any_cmp + _der_timegm + encode_AccessDescription + decode_AccessDescription + free_AccessDescription + length_AccessDescription + copy_AccessDescription + encode_AlgorithmIdentifier + decode_AlgorithmIdentifier + free_AlgorithmIdentifier + length_AlgorithmIdentifier + copy_AlgorithmIdentifier + encode_Attribute + decode_Attribute + free_Attribute + length_Attribute + copy_Attribute + encode_AttributeType + decode_AttributeType + free_AttributeType + length_AttributeType + copy_AttributeType + encode_AttributeTypeAndValue + decode_AttributeTypeAndValue + free_AttributeTypeAndValue + length_AttributeTypeAndValue + copy_AttributeTypeAndValue + encode_AttributeValue + decode_AttributeValue + free_AttributeValue + length_AttributeValue + copy_AttributeValue + encode_AuthorityInfoAccessSyntax + decode_AuthorityInfoAccessSyntax + free_AuthorityInfoAccessSyntax + length_AuthorityInfoAccessSyntax + copy_AuthorityInfoAccessSyntax + encode_AuthorityKeyIdentifier + decode_AuthorityKeyIdentifier + free_AuthorityKeyIdentifier + length_AuthorityKeyIdentifier + copy_AuthorityKeyIdentifier + encode_BaseDistance + decode_BaseDistance + free_BaseDistance + length_BaseDistance + copy_BaseDistance + encode_BasicConstraints + decode_BasicConstraints + free_BasicConstraints + length_BasicConstraints + copy_BasicConstraints + encode_CRLCertificateList + decode_CRLCertificateList + free_CRLCertificateList + length_CRLCertificateList + copy_CRLCertificateList + encode_CRLDistributionPoints + decode_CRLDistributionPoints + free_CRLDistributionPoints + length_CRLDistributionPoints + copy_CRLDistributionPoints + add_CRLDistributionPoints + remove_CRLDistributionPoints + encode_CRLReason + decode_CRLReason + free_CRLReason + length_CRLReason + copy_CRLReason + encode_Certificate + decode_Certificate + free_Certificate + length_Certificate + copy_Certificate + encode_CertificateSerialNumber + decode_CertificateSerialNumber + free_CertificateSerialNumber + length_CertificateSerialNumber + copy_CertificateSerialNumber + encode_Certificates + decode_Certificates + free_Certificates + length_Certificates + copy_Certificates + encode_DHPublicKey + decode_DHPublicKey + free_DHPublicKey + length_DHPublicKey + copy_DHPublicKey + encode_DSAParams + decode_DSAParams + free_DSAParams + length_DSAParams + copy_DSAParams + encode_DSAPublicKey + decode_DSAPublicKey + free_DSAPublicKey + length_DSAPublicKey + copy_DSAPublicKey + encode_DSASigValue + decode_DSASigValue + free_DSASigValue + length_DSASigValue + copy_DSASigValue + encode_DigestInfo + decode_DigestInfo + free_DigestInfo + length_DigestInfo + copy_DigestInfo + encode_DirectoryString + decode_DirectoryString + free_DirectoryString + length_DirectoryString + copy_DirectoryString + encode_DistributionPoint + decode_DistributionPoint + free_DistributionPoint + length_DistributionPoint + copy_DistributionPoint + encode_DistributionPointName + decode_DistributionPointName + free_DistributionPointName + length_DistributionPointName + copy_DistributionPointName + encode_DistributionPointReasonFlags + decode_DistributionPointReasonFlags + free_DistributionPointReasonFlags + length_DistributionPointReasonFlags + copy_DistributionPointReasonFlags + DistributionPointReasonFlags2int + int2DistributionPointReasonFlags + asn1_DistributionPointReasonFlags_units + encode_DomainParameters + decode_DomainParameters + free_DomainParameters + length_DomainParameters + copy_DomainParameters + encode_ECParameters + decode_ECParameters + free_ECParameters + length_ECParameters + copy_ECParameters + encode_ECPoint + decode_ECPoint + free_ECPoint + length_ECPoint + copy_ECPoint + encode_ECDSA_Sig_Value + decode_ECDSA_Sig_Value + free_ECDSA_Sig_Value + length_ECDSA_Sig_Value + copy_ECDSA_Sig_Value + encode_ExtKeyUsage + decode_ExtKeyUsage + free_ExtKeyUsage + length_ExtKeyUsage + copy_ExtKeyUsage + encode_Extension + decode_Extension + free_Extension + length_Extension + copy_Extension + encode_Extensions + decode_Extensions + free_Extensions + length_Extensions + copy_Extensions + add_Extensions + remove_Extensions + encode_GeneralName + decode_GeneralName + free_GeneralName + length_GeneralName + copy_GeneralName + encode_GeneralNames + decode_GeneralNames + free_GeneralNames + length_GeneralNames + copy_GeneralNames + add_GeneralNames + remove_GeneralNames + encode_GeneralSubtree + decode_GeneralSubtree + free_GeneralSubtree + length_GeneralSubtree + copy_GeneralSubtree + encode_GeneralSubtrees + decode_GeneralSubtrees + free_GeneralSubtrees + length_GeneralSubtrees + copy_GeneralSubtrees + encode_KeyIdentifier + decode_KeyIdentifier + free_KeyIdentifier + length_KeyIdentifier + copy_KeyIdentifier + encode_KeyUsage + decode_KeyUsage + free_KeyUsage + length_KeyUsage + copy_KeyUsage + KeyUsage2int + int2KeyUsage + asn1_KeyUsage_units + encode_Name + decode_Name + free_Name + length_Name + copy_Name + encode_NameConstraints + decode_NameConstraints + free_NameConstraints + length_NameConstraints + copy_NameConstraints + encode_OtherName + decode_OtherName + free_OtherName + length_OtherName + copy_OtherName + encode_PKIXXmppAddr + decode_PKIXXmppAddr + free_PKIXXmppAddr + length_PKIXXmppAddr + copy_PKIXXmppAddr + encode_ProxyCertInfo + decode_ProxyCertInfo + free_ProxyCertInfo + length_ProxyCertInfo + copy_ProxyCertInfo + encode_ProxyPolicy + decode_ProxyPolicy + free_ProxyPolicy + length_ProxyPolicy + copy_ProxyPolicy + encode_RDNSequence + decode_RDNSequence + free_RDNSequence + length_RDNSequence + copy_RDNSequence + encode_RSAPrivateKey + decode_RSAPrivateKey + free_RSAPrivateKey + length_RSAPrivateKey + copy_RSAPrivateKey + encode_RSAPublicKey + decode_RSAPublicKey + free_RSAPublicKey + length_RSAPublicKey + copy_RSAPublicKey + encode_RelativeDistinguishedName + decode_RelativeDistinguishedName + free_RelativeDistinguishedName + length_RelativeDistinguishedName + copy_RelativeDistinguishedName + encode_SubjectKeyIdentifier + decode_SubjectKeyIdentifier + free_SubjectKeyIdentifier + length_SubjectKeyIdentifier + copy_SubjectKeyIdentifier + encode_SubjectPublicKeyInfo + decode_SubjectPublicKeyInfo + free_SubjectPublicKeyInfo + length_SubjectPublicKeyInfo + copy_SubjectPublicKeyInfo + encode_TBSCRLCertList + decode_TBSCRLCertList + free_TBSCRLCertList + length_TBSCRLCertList + copy_TBSCRLCertList + encode_TBSCertificate + decode_TBSCertificate + free_TBSCertificate + length_TBSCertificate + copy_TBSCertificate + encode_TeletexStringx + decode_TeletexStringx + free_TeletexStringx + length_TeletexStringx + copy_TeletexStringx + encode_Time + decode_Time + free_Time + length_Time + copy_Time + encode_UniqueIdentifier + decode_UniqueIdentifier + free_UniqueIdentifier + length_UniqueIdentifier + copy_UniqueIdentifier + encode_ValidationParms + decode_ValidationParms + free_ValidationParms + length_ValidationParms + copy_ValidationParms + encode_Validity + decode_Validity + free_Validity + length_Validity + copy_Validity + encode_Version + decode_Version + free_Version + length_Version + copy_Version + oid_id_Userid + oid_id_aes_128_cbc + oid_id_aes_192_cbc + oid_id_aes_256_cbc + oid_id_at_commonName + oid_id_at_countryName + oid_id_at_generationQualifier + oid_id_at_givenName + oid_id_at_initials + oid_id_at_localityName + oid_id_at_name + oid_id_at_organizationName + oid_id_at_organizationalUnitName + oid_id_at_pseudonym + oid_id_at_serialNumber + oid_id_at_stateOrProvinceName + oid_id_at_streetAddress + oid_id_at_surname + oid_id_dhpublicnumber + oid_id_domainComponent + oid_id_dsa + oid_id_dsa_with_sha1 + oid_id_ecDH + oid_id_ecMQV + oid_id_ecPublicKey + oid_id_ec_group_secp160r1 + oid_id_ec_group_secp160r2 + oid_id_ec_group_secp256r1 + oid_id_ecdsa_with_SHA1 + oid_id_ecdsa_with_SHA256 + oid_id_heim_rsa_pkcs1_x509 + oid_id_ms_cert_enroll_domaincontroller + oid_id_ms_client_authentication + oid_id_netscape + oid_id_netscape_cert_comment + oid_id_nistAlgorithm + oid_id_nist_aes_algs + oid_id_nist_sha_algs + oid_id_pkcs1_md2WithRSAEncryption + oid_id_pkcs1_md5WithRSAEncryption + oid_id_pkcs1_rsaEncryption + oid_id_pkcs1_sha1WithRSAEncryption + oid_id_pkcs1_sha256WithRSAEncryption + oid_id_pkcs1_sha384WithRSAEncryption + oid_id_pkcs1_sha512WithRSAEncryption + oid_id_pkcs2_md2 + oid_id_pkcs2_md4 + oid_id_pkcs2_md5 + oid_id_pkcs3_des_ede3_cbc + oid_id_pkcs3_rc2_cbc + oid_id_pkcs3_rc4 + oid_id_pkcs_1 + oid_id_pkcs_2 + oid_id_pkcs_3 + oid_id_pkix + oid_id_pkix_kp + oid_id_pkix_kp_OCSPSigning + oid_id_pkix_kp_clientAuth + oid_id_pkix_kp_emailProtection + oid_id_pkix_kp_serverAuth + oid_id_pkix_kp_timeStamping + oid_id_pkix_on + oid_id_pkix_on_dnsSRV + oid_id_pkix_on_xmppAddr + oid_id_pkix_pe + oid_id_pkix_pe_authorityInfoAccess + oid_id_pkix_pe_proxyCertInfo + oid_id_pkix_ppl + oid_id_pkix_ppl_anyLanguage + oid_id_pkix_ppl_independent + oid_id_pkix_ppl_inheritAll + oid_id_rsa_digestAlgorithm + oid_id_rsa_digest_md2 + oid_id_rsa_digest_md4 + oid_id_rsa_digest_md5 + oid_id_rsadsi_des_ede3_cbc + oid_id_rsadsi_encalg + oid_id_rsadsi_rc2_cbc + oid_id_secsig_sha_1 + oid_id_sha224 + oid_id_sha256 + oid_id_sha384 + oid_id_sha512 + oid_id_uspkicommon_card_id + oid_id_uspkicommon_piv_interim + oid_id_x509_ce + oid_id_x509_ce_authorityKeyIdentifier + oid_id_x509_ce_basicConstraints + oid_id_x509_ce_cRLDistributionPoints + oid_id_x509_ce_cRLNumber + oid_id_x509_ce_cRLReason + oid_id_x509_ce_certificateIssuer + oid_id_x509_ce_certificatePolicies + oid_id_x509_ce_deltaCRLIndicator + oid_id_x509_ce_extKeyUsage + oid_id_x509_ce_freshestCRL + oid_id_x509_ce_holdInstructionCode + oid_id_x509_ce_inhibitAnyPolicy + oid_id_x509_ce_invalidityDate + oid_id_x509_ce_issuerAltName + oid_id_x509_ce_issuingDistributionPoint + oid_id_x509_ce_keyUsage + oid_id_x509_ce_nameConstraints + oid_id_x509_ce_policyConstraints + oid_id_x509_ce_policyMappings + oid_id_x509_ce_privateKeyUsagePeriod + oid_id_x509_ce_subjectAltName + oid_id_x509_ce_subjectDirectoryAttributes + oid_id_x509_ce_subjectKeyIdentifier + oid_id_x520_at + oid_id_x9_57 + encode_CMSAttributes + decode_CMSAttributes + free_CMSAttributes + length_CMSAttributes + copy_CMSAttributes + encode_CMSCBCParameter + decode_CMSCBCParameter + free_CMSCBCParameter + length_CMSCBCParameter + copy_CMSCBCParameter + encode_CMSEncryptedData + decode_CMSEncryptedData + free_CMSEncryptedData + length_CMSEncryptedData + copy_CMSEncryptedData + encode_CMSIdentifier + decode_CMSIdentifier + free_CMSIdentifier + length_CMSIdentifier + copy_CMSIdentifier + encode_CMSRC2CBCParameter + decode_CMSRC2CBCParameter + free_CMSRC2CBCParameter + length_CMSRC2CBCParameter + copy_CMSRC2CBCParameter + encode_CMSVersion + decode_CMSVersion + free_CMSVersion + length_CMSVersion + copy_CMSVersion + encode_CertificateList + decode_CertificateList + free_CertificateList + length_CertificateList + copy_CertificateList + encode_CertificateRevocationLists + decode_CertificateRevocationLists + free_CertificateRevocationLists + length_CertificateRevocationLists + copy_CertificateRevocationLists + encode_CertificateSet + decode_CertificateSet + free_CertificateSet + length_CertificateSet + copy_CertificateSet + encode_ContentEncryptionAlgorithmIdentifier + decode_ContentEncryptionAlgorithmIdentifier + free_ContentEncryptionAlgorithmIdentifier + length_ContentEncryptionAlgorithmIdentifier + copy_ContentEncryptionAlgorithmIdentifier + encode_ContentInfo + decode_ContentInfo + free_ContentInfo + length_ContentInfo + copy_ContentInfo + encode_ContentType + decode_ContentType + free_ContentType + length_ContentType + copy_ContentType + encode_DigestAlgorithmIdentifier + decode_DigestAlgorithmIdentifier + free_DigestAlgorithmIdentifier + length_DigestAlgorithmIdentifier + copy_DigestAlgorithmIdentifier + encode_DigestAlgorithmIdentifiers + decode_DigestAlgorithmIdentifiers + free_DigestAlgorithmIdentifiers + length_DigestAlgorithmIdentifiers + copy_DigestAlgorithmIdentifiers + encode_EncapsulatedContentInfo + decode_EncapsulatedContentInfo + free_EncapsulatedContentInfo + length_EncapsulatedContentInfo + copy_EncapsulatedContentInfo + encode_EncryptedContent + decode_EncryptedContent + free_EncryptedContent + length_EncryptedContent + copy_EncryptedContent + encode_EncryptedContentInfo + decode_EncryptedContentInfo + free_EncryptedContentInfo + length_EncryptedContentInfo + copy_EncryptedContentInfo + encode_EncryptedKey + decode_EncryptedKey + free_EncryptedKey + length_EncryptedKey + copy_EncryptedKey + encode_EnvelopedData + decode_EnvelopedData + free_EnvelopedData + length_EnvelopedData + copy_EnvelopedData + encode_IssuerAndSerialNumber + decode_IssuerAndSerialNumber + free_IssuerAndSerialNumber + length_IssuerAndSerialNumber + copy_IssuerAndSerialNumber + encode_KeyEncryptionAlgorithmIdentifier + decode_KeyEncryptionAlgorithmIdentifier + free_KeyEncryptionAlgorithmIdentifier + length_KeyEncryptionAlgorithmIdentifier + copy_KeyEncryptionAlgorithmIdentifier + encode_KeyTransRecipientInfo + decode_KeyTransRecipientInfo + free_KeyTransRecipientInfo + length_KeyTransRecipientInfo + copy_KeyTransRecipientInfo + encode_MessageDigest + decode_MessageDigest + free_MessageDigest + length_MessageDigest + copy_MessageDigest + encode_OriginatorInfo + decode_OriginatorInfo + free_OriginatorInfo + length_OriginatorInfo + copy_OriginatorInfo + encode_RecipientIdentifier + decode_RecipientIdentifier + free_RecipientIdentifier + length_RecipientIdentifier + copy_RecipientIdentifier + encode_RecipientInfo + decode_RecipientInfo + free_RecipientInfo + length_RecipientInfo + copy_RecipientInfo + encode_RecipientInfos + decode_RecipientInfos + free_RecipientInfos + length_RecipientInfos + copy_RecipientInfos + encode_SignatureAlgorithmIdentifier + decode_SignatureAlgorithmIdentifier + free_SignatureAlgorithmIdentifier + length_SignatureAlgorithmIdentifier + copy_SignatureAlgorithmIdentifier + encode_SignatureValue + decode_SignatureValue + free_SignatureValue + length_SignatureValue + copy_SignatureValue + encode_SignedData + decode_SignedData + free_SignedData + length_SignedData + copy_SignedData + encode_SignerIdentifier + decode_SignerIdentifier + free_SignerIdentifier + length_SignerIdentifier + copy_SignerIdentifier + encode_SignerInfo + decode_SignerInfo + free_SignerInfo + length_SignerInfo + copy_SignerInfo + encode_SignerInfos + decode_SignerInfos + free_SignerInfos + length_SignerInfos + copy_SignerInfos + oid_id_pkcs7 + oid_id_pkcs7_data + oid_id_pkcs7_digestedData + oid_id_pkcs7_encryptedData + oid_id_pkcs7_envelopedData + oid_id_pkcs7_signedAndEnvelopedData + oid_id_pkcs7_signedData + encode_UnprotectedAttributes + decode_UnprotectedAttributes + free_UnprotectedAttributes + length_UnprotectedAttributes + copy_UnprotectedAttributes + encode_AD_AND_OR + decode_AD_AND_OR + free_AD_AND_OR + length_AD_AND_OR + copy_AD_AND_OR + encode_AD_IF_RELEVANT + decode_AD_IF_RELEVANT + free_AD_IF_RELEVANT + length_AD_IF_RELEVANT + copy_AD_IF_RELEVANT + encode_AD_KDCIssued + decode_AD_KDCIssued + free_AD_KDCIssued + length_AD_KDCIssued + copy_AD_KDCIssued + encode_AD_MANDATORY_FOR_KDC + decode_AD_MANDATORY_FOR_KDC + free_AD_MANDATORY_FOR_KDC + length_AD_MANDATORY_FOR_KDC + copy_AD_MANDATORY_FOR_KDC + encode_AD_LoginAlias + decode_AD_LoginAlias + free_AD_LoginAlias + length_AD_LoginAlias + copy_AD_LoginAlias + encode_APOptions + decode_APOptions + free_APOptions + length_APOptions + copy_APOptions + APOptions2int + int2APOptions + asn1_APOptions_units + encode_AP_REP + decode_AP_REP + free_AP_REP + length_AP_REP + copy_AP_REP + encode_AP_REQ + decode_AP_REQ + free_AP_REQ + length_AP_REQ + copy_AP_REQ + encode_AS_REP + decode_AS_REP + free_AS_REP + length_AS_REP + copy_AS_REP + encode_AS_REQ + decode_AS_REQ + free_AS_REQ + length_AS_REQ + copy_AS_REQ + encode_AUTHDATA_TYPE + decode_AUTHDATA_TYPE + free_AUTHDATA_TYPE + length_AUTHDATA_TYPE + copy_AUTHDATA_TYPE + encode_Authenticator + decode_Authenticator + free_Authenticator + length_Authenticator + copy_Authenticator + encode_AuthorizationData + decode_AuthorizationData + free_AuthorizationData + length_AuthorizationData + copy_AuthorizationData + add_AuthorizationData + remove_AuthorizationData + encode_AuthorizationDataElement + decode_AuthorizationDataElement + free_AuthorizationDataElement + length_AuthorizationDataElement + copy_AuthorizationDataElement + encode_CKSUMTYPE + decode_CKSUMTYPE + free_CKSUMTYPE + length_CKSUMTYPE + copy_CKSUMTYPE + encode_ChangePasswdDataMS + decode_ChangePasswdDataMS + free_ChangePasswdDataMS + length_ChangePasswdDataMS + copy_ChangePasswdDataMS + encode_Checksum + decode_Checksum + free_Checksum + length_Checksum + copy_Checksum + encode_ENCTYPE + decode_ENCTYPE + free_ENCTYPE + length_ENCTYPE + copy_ENCTYPE + encode_ETYPE_INFO + decode_ETYPE_INFO + free_ETYPE_INFO + length_ETYPE_INFO + copy_ETYPE_INFO + add_ETYPE_INFO + remove_ETYPE_INFO + encode_ETYPE_INFO2 + decode_ETYPE_INFO2 + free_ETYPE_INFO2 + length_ETYPE_INFO2 + copy_ETYPE_INFO2 + add_ETYPE_INFO2 + remove_ETYPE_INFO2 + encode_ETYPE_INFO2_ENTRY + decode_ETYPE_INFO2_ENTRY + free_ETYPE_INFO2_ENTRY + length_ETYPE_INFO2_ENTRY + copy_ETYPE_INFO2_ENTRY + encode_ETYPE_INFO_ENTRY + decode_ETYPE_INFO_ENTRY + free_ETYPE_INFO_ENTRY + length_ETYPE_INFO_ENTRY + copy_ETYPE_INFO_ENTRY + encode_EncAPRepPart + decode_EncAPRepPart + free_EncAPRepPart + length_EncAPRepPart + copy_EncAPRepPart + encode_EncASRepPart + decode_EncASRepPart + free_EncASRepPart + length_EncASRepPart + copy_EncASRepPart + encode_EncKDCRepPart + decode_EncKDCRepPart + free_EncKDCRepPart + length_EncKDCRepPart + copy_EncKDCRepPart + encode_EncKrbCredPart + decode_EncKrbCredPart + free_EncKrbCredPart + length_EncKrbCredPart + copy_EncKrbCredPart + encode_EncKrbPrivPart + decode_EncKrbPrivPart + free_EncKrbPrivPart + length_EncKrbPrivPart + copy_EncKrbPrivPart + encode_EncTGSRepPart + decode_EncTGSRepPart + free_EncTGSRepPart + length_EncTGSRepPart + copy_EncTGSRepPart + encode_EncTicketPart + decode_EncTicketPart + free_EncTicketPart + length_EncTicketPart + copy_EncTicketPart + encode_EncryptedData + decode_EncryptedData + free_EncryptedData + length_EncryptedData + copy_EncryptedData + encode_EncryptionKey + decode_EncryptionKey + free_EncryptionKey + length_EncryptionKey + copy_EncryptionKey + encode_EtypeList + decode_EtypeList + free_EtypeList + length_EtypeList + copy_EtypeList + encode_HostAddress + decode_HostAddress + free_HostAddress + length_HostAddress + copy_HostAddress + encode_HostAddresses + decode_HostAddresses + free_HostAddresses + length_HostAddresses + copy_HostAddresses + encode_KDCOptions + decode_KDCOptions + free_KDCOptions + length_KDCOptions + copy_KDCOptions + KDCOptions2int + int2KDCOptions + asn1_KDCOptions_units + encode_KDC_REP + decode_KDC_REP + free_KDC_REP + length_KDC_REP + copy_KDC_REP + encode_KDC_REQ + decode_KDC_REQ + free_KDC_REQ + length_KDC_REQ + copy_KDC_REQ + encode_KDC_REQ_BODY + decode_KDC_REQ_BODY + free_KDC_REQ_BODY + length_KDC_REQ_BODY + copy_KDC_REQ_BODY + encode_KRB_CRED + decode_KRB_CRED + free_KRB_CRED + length_KRB_CRED + copy_KRB_CRED + encode_KRB_ERROR + decode_KRB_ERROR + free_KRB_ERROR + length_KRB_ERROR + copy_KRB_ERROR + encode_KRB_PRIV + decode_KRB_PRIV + free_KRB_PRIV + length_KRB_PRIV + copy_KRB_PRIV + encode_KRB_SAFE + decode_KRB_SAFE + free_KRB_SAFE + length_KRB_SAFE + copy_KRB_SAFE + encode_KRB_SAFE_BODY + decode_KRB_SAFE_BODY + free_KRB_SAFE_BODY + length_KRB_SAFE_BODY + copy_KRB_SAFE_BODY + encode_KerberosString + decode_KerberosString + free_KerberosString + length_KerberosString + copy_KerberosString + encode_KerberosTime + decode_KerberosTime + free_KerberosTime + length_KerberosTime + copy_KerberosTime + encode_KrbCredInfo + decode_KrbCredInfo + free_KrbCredInfo + length_KrbCredInfo + copy_KrbCredInfo + encode_LR_TYPE + decode_LR_TYPE + free_LR_TYPE + length_LR_TYPE + copy_LR_TYPE + encode_LastReq + decode_LastReq + free_LastReq + length_LastReq + copy_LastReq + encode_MESSAGE_TYPE + decode_MESSAGE_TYPE + free_MESSAGE_TYPE + length_MESSAGE_TYPE + copy_MESSAGE_TYPE + encode_METHOD_DATA + decode_METHOD_DATA + free_METHOD_DATA + length_METHOD_DATA + copy_METHOD_DATA + add_METHOD_DATA + remove_METHOD_DATA + encode_NAME_TYPE + decode_NAME_TYPE + free_NAME_TYPE + length_NAME_TYPE + copy_NAME_TYPE + encode_PADATA_TYPE + decode_PADATA_TYPE + free_PADATA_TYPE + length_PADATA_TYPE + copy_PADATA_TYPE + encode_PA_DATA + decode_PA_DATA + free_PA_DATA + length_PA_DATA + copy_PA_DATA + encode_PA_ENC_SAM_RESPONSE_ENC + decode_PA_ENC_SAM_RESPONSE_ENC + free_PA_ENC_SAM_RESPONSE_ENC + length_PA_ENC_SAM_RESPONSE_ENC + copy_PA_ENC_SAM_RESPONSE_ENC + encode_PA_ENC_TS_ENC + decode_PA_ENC_TS_ENC + free_PA_ENC_TS_ENC + length_PA_ENC_TS_ENC + copy_PA_ENC_TS_ENC + encode_PA_PAC_REQUEST + decode_PA_PAC_REQUEST + free_PA_PAC_REQUEST + length_PA_PAC_REQUEST + copy_PA_PAC_REQUEST + encode_PA_S4U2Self + decode_PA_S4U2Self + free_PA_S4U2Self + length_PA_S4U2Self + copy_PA_S4U2Self + encode_PA_SAM_CHALLENGE_2 + decode_PA_SAM_CHALLENGE_2 + free_PA_SAM_CHALLENGE_2 + length_PA_SAM_CHALLENGE_2 + copy_PA_SAM_CHALLENGE_2 + encode_PA_SAM_CHALLENGE_2_BODY + decode_PA_SAM_CHALLENGE_2_BODY + free_PA_SAM_CHALLENGE_2_BODY + length_PA_SAM_CHALLENGE_2_BODY + copy_PA_SAM_CHALLENGE_2_BODY + encode_PA_SAM_REDIRECT + decode_PA_SAM_REDIRECT + free_PA_SAM_REDIRECT + length_PA_SAM_REDIRECT + copy_PA_SAM_REDIRECT + encode_PA_SAM_RESPONSE_2 + decode_PA_SAM_RESPONSE_2 + free_PA_SAM_RESPONSE_2 + length_PA_SAM_RESPONSE_2 + copy_PA_SAM_RESPONSE_2 + encode_PA_SAM_TYPE + decode_PA_SAM_TYPE + free_PA_SAM_TYPE + length_PA_SAM_TYPE + copy_PA_SAM_TYPE + encode_PA_ClientCanonicalized + decode_PA_ClientCanonicalized + free_PA_ClientCanonicalized + length_PA_ClientCanonicalized + copy_PA_ClientCanonicalized + encode_PA_ClientCanonicalizedNames + decode_PA_ClientCanonicalizedNames + free_PA_ClientCanonicalizedNames + length_PA_ClientCanonicalizedNames + copy_PA_ClientCanonicalizedNames + encode_PA_SvrReferralData + decode_PA_SvrReferralData + free_PA_SvrReferralData + length_PA_SvrReferralData + copy_PA_SvrReferralData + encode_PA_ServerReferralData + decode_PA_ServerReferralData + free_PA_ServerReferralData + length_PA_ServerReferralData + copy_PA_ServerReferralData + encode_PA_SERVER_REFERRAL_DATA + decode_PA_SERVER_REFERRAL_DATA + free_PA_SERVER_REFERRAL_DATA + length_PA_SERVER_REFERRAL_DATA + copy_PA_SERVER_REFERRAL_DATA + encode_PROV_SRV_LOCATION + decode_PROV_SRV_LOCATION + free_PROV_SRV_LOCATION + length_PROV_SRV_LOCATION + copy_PROV_SRV_LOCATION + encode_Principal + decode_Principal + free_Principal + length_Principal + copy_Principal + encode_PrincipalName + decode_PrincipalName + free_PrincipalName + length_PrincipalName + copy_PrincipalName + encode_Principals + decode_Principals + free_Principals + length_Principals + copy_Principals + encode_Realm + decode_Realm + free_Realm + length_Realm + copy_Realm + encode_SAMFlags + decode_SAMFlags + free_SAMFlags + length_SAMFlags + copy_SAMFlags + SAMFlags2int + int2SAMFlags + asn1_SAMFlags_units + encode_TGS_REP + decode_TGS_REP + free_TGS_REP + length_TGS_REP + copy_TGS_REP + encode_TGS_REQ + decode_TGS_REQ + free_TGS_REQ + length_TGS_REQ + copy_TGS_REQ + encode_TYPED_DATA + decode_TYPED_DATA + free_TYPED_DATA + length_TYPED_DATA + copy_TYPED_DATA + encode_Ticket + decode_Ticket + free_Ticket + length_Ticket + copy_Ticket + encode_TicketFlags + decode_TicketFlags + free_TicketFlags + length_TicketFlags + copy_TicketFlags + TicketFlags2int + int2TicketFlags + asn1_TicketFlags_units + encode_TransitedEncoding + decode_TransitedEncoding + free_TransitedEncoding + length_TransitedEncoding + copy_TransitedEncoding + encode_TypedData + decode_TypedData + free_TypedData + length_TypedData + copy_TypedData + encode_krb5int32 + decode_krb5int32 + free_krb5int32 + length_krb5int32 + copy_krb5int32 + encode_krb5uint32 + decode_krb5uint32 + free_krb5uint32 + length_krb5uint32 + copy_krb5uint32 + encode_KRB5SignedPathData + decode_KRB5SignedPathData + free_KRB5SignedPathData + length_KRB5SignedPathData + copy_KRB5SignedPathData + encode_KRB5SignedPath + decode_KRB5SignedPath + free_KRB5SignedPath + length_KRB5SignedPath + copy_KRB5SignedPath + oid_id_pkinit + oid_id_pkauthdata + oid_id_pkdhkeydata + oid_id_pkrkeydata + oid_id_pkekuoid + oid_id_pkkdcekuoid + oid_id_pkinit_san + oid_id_pkinit_ms_eku + oid_id_pkinit_ms_san + oid_id_pkinit_kdf + oid_id_pkinit_kdf_ah_sha1 + oid_id_pkinit_kdf_ah_sha256 + oid_id_pkinit_kdf_ah_sha512 + encode_MS_UPN_SAN + decode_MS_UPN_SAN + free_MS_UPN_SAN + length_MS_UPN_SAN + copy_MS_UPN_SAN + encode_DHNonce + decode_DHNonce + free_DHNonce + length_DHNonce + copy_DHNonce + encode_KDFAlgorithmId + decode_KDFAlgorithmId + free_KDFAlgorithmId + length_KDFAlgorithmId + copy_KDFAlgorithmId + encode_TrustedCA + decode_TrustedCA + free_TrustedCA + length_TrustedCA + copy_TrustedCA + encode_ExternalPrincipalIdentifier + decode_ExternalPrincipalIdentifier + free_ExternalPrincipalIdentifier + length_ExternalPrincipalIdentifier + copy_ExternalPrincipalIdentifier + encode_ExternalPrincipalIdentifiers + decode_ExternalPrincipalIdentifiers + free_ExternalPrincipalIdentifiers + length_ExternalPrincipalIdentifiers + copy_ExternalPrincipalIdentifiers + encode_PA_PK_AS_REQ + decode_PA_PK_AS_REQ + free_PA_PK_AS_REQ + length_PA_PK_AS_REQ + copy_PA_PK_AS_REQ + encode_PKAuthenticator + decode_PKAuthenticator + free_PKAuthenticator + length_PKAuthenticator + copy_PKAuthenticator + encode_AuthPack + decode_AuthPack + free_AuthPack + length_AuthPack + copy_AuthPack + encode_TD_TRUSTED_CERTIFIERS + decode_TD_TRUSTED_CERTIFIERS + free_TD_TRUSTED_CERTIFIERS + length_TD_TRUSTED_CERTIFIERS + copy_TD_TRUSTED_CERTIFIERS + encode_TD_INVALID_CERTIFICATES + decode_TD_INVALID_CERTIFICATES + free_TD_INVALID_CERTIFICATES + length_TD_INVALID_CERTIFICATES + copy_TD_INVALID_CERTIFICATES + encode_KRB5PrincipalName + decode_KRB5PrincipalName + free_KRB5PrincipalName + length_KRB5PrincipalName + copy_KRB5PrincipalName + encode_AD_INITIAL_VERIFIED_CAS + decode_AD_INITIAL_VERIFIED_CAS + free_AD_INITIAL_VERIFIED_CAS + length_AD_INITIAL_VERIFIED_CAS + copy_AD_INITIAL_VERIFIED_CAS + encode_DHRepInfo + decode_DHRepInfo + free_DHRepInfo + length_DHRepInfo + copy_DHRepInfo + encode_PA_PK_AS_REP + decode_PA_PK_AS_REP + free_PA_PK_AS_REP + length_PA_PK_AS_REP + copy_PA_PK_AS_REP + encode_KDCDHKeyInfo + decode_KDCDHKeyInfo + free_KDCDHKeyInfo + length_KDCDHKeyInfo + copy_KDCDHKeyInfo + encode_ReplyKeyPack + decode_ReplyKeyPack + free_ReplyKeyPack + length_ReplyKeyPack + copy_ReplyKeyPack + encode_TD_DH_PARAMETERS + decode_TD_DH_PARAMETERS + free_TD_DH_PARAMETERS + length_TD_DH_PARAMETERS + copy_TD_DH_PARAMETERS + encode_PKAuthenticator_Win2k + decode_PKAuthenticator_Win2k + free_PKAuthenticator_Win2k + length_PKAuthenticator_Win2k + copy_PKAuthenticator_Win2k + encode_AuthPack_Win2k + decode_AuthPack_Win2k + free_AuthPack_Win2k + length_AuthPack_Win2k + copy_AuthPack_Win2k + encode_TrustedCA_Win2k + decode_TrustedCA_Win2k + free_TrustedCA_Win2k + length_TrustedCA_Win2k + copy_TrustedCA_Win2k + encode_PA_PK_AS_REQ_Win2k + decode_PA_PK_AS_REQ_Win2k + free_PA_PK_AS_REQ_Win2k + length_PA_PK_AS_REQ_Win2k + copy_PA_PK_AS_REQ_Win2k + encode_PA_PK_AS_REP_Win2k + decode_PA_PK_AS_REP_Win2k + free_PA_PK_AS_REP_Win2k + length_PA_PK_AS_REP_Win2k + copy_PA_PK_AS_REP_Win2k + encode_PA_PK_AS_REP_BTMM + decode_PA_PK_AS_REP_BTMM + free_PA_PK_AS_REP_BTMM + length_PA_PK_AS_REP_BTMM + copy_PA_PK_AS_REP_BTMM + encode_KDCDHKeyInfo_Win2k + decode_KDCDHKeyInfo_Win2k + free_KDCDHKeyInfo_Win2k + length_KDCDHKeyInfo_Win2k + copy_KDCDHKeyInfo_Win2k + encode_ReplyKeyPack_Win2k + decode_ReplyKeyPack_Win2k + free_ReplyKeyPack_Win2k + length_ReplyKeyPack_Win2k + copy_ReplyKeyPack_Win2k + encode_PkinitSP80056AOtherInfo + decode_PkinitSP80056AOtherInfo + free_PkinitSP80056AOtherInfo + length_PkinitSP80056AOtherInfo + copy_PkinitSP80056AOtherInfo + encode_PkinitSuppPubInfo + decode_PkinitSuppPubInfo + free_PkinitSuppPubInfo + length_PkinitSuppPubInfo + copy_PkinitSuppPubInfo + encode_PKCS8PrivateKeyAlgorithmIdentifier + decode_PKCS8PrivateKeyAlgorithmIdentifier + free_PKCS8PrivateKeyAlgorithmIdentifier + length_PKCS8PrivateKeyAlgorithmIdentifier + copy_PKCS8PrivateKeyAlgorithmIdentifier + encode_PKCS8PrivateKey + decode_PKCS8PrivateKey + free_PKCS8PrivateKey + length_PKCS8PrivateKey + copy_PKCS8PrivateKey + encode_PKCS8PrivateKeyInfo + decode_PKCS8PrivateKeyInfo + free_PKCS8PrivateKeyInfo + length_PKCS8PrivateKeyInfo + copy_PKCS8PrivateKeyInfo + encode_PKCS8Attributes + decode_PKCS8Attributes + free_PKCS8Attributes + length_PKCS8Attributes + copy_PKCS8Attributes + encode_PKCS8EncryptedPrivateKeyInfo + decode_PKCS8EncryptedPrivateKeyInfo + free_PKCS8EncryptedPrivateKeyInfo + length_PKCS8EncryptedPrivateKeyInfo + copy_PKCS8EncryptedPrivateKeyInfo + encode_PKCS8EncryptedData + decode_PKCS8EncryptedData + free_PKCS8EncryptedData + length_PKCS8EncryptedData + copy_PKCS8EncryptedData + oid_id_pkcs_9 + oid_id_pkcs9_contentType + oid_id_pkcs9_emailAddress + oid_id_pkcs9_messageDigest + oid_id_pkcs9_signingTime + oid_id_pkcs9_countersignature + oid_id_pkcs_9_at_friendlyName + oid_id_pkcs_9_at_localKeyId + oid_id_pkcs_9_at_certTypes + oid_id_pkcs_9_at_certTypes_x509 + encode_PKCS9_BMPString + decode_PKCS9_BMPString + free_PKCS9_BMPString + length_PKCS9_BMPString + copy_PKCS9_BMPString + encode_PKCS9_friendlyName + decode_PKCS9_friendlyName + free_PKCS9_friendlyName + length_PKCS9_friendlyName + copy_PKCS9_friendlyName + oid_id_pkcs_12 + oid_id_pkcs_12PbeIds + oid_id_pbeWithSHAAnd128BitRC4 + oid_id_pbeWithSHAAnd40BitRC4 + oid_id_pbeWithSHAAnd3_KeyTripleDES_CBC + oid_id_pbeWithSHAAnd2_KeyTripleDES_CBC + oid_id_pbeWithSHAAnd128BitRC2_CBC + oid_id_pbewithSHAAnd40BitRC2_CBC + oid_id_pkcs12_bagtypes + oid_id_pkcs12_keyBag + oid_id_pkcs12_pkcs8ShroudedKeyBag + oid_id_pkcs12_certBag + oid_id_pkcs12_crlBag + oid_id_pkcs12_secretBag + oid_id_pkcs12_safeContentsBag + encode_PKCS12_MacData + decode_PKCS12_MacData + free_PKCS12_MacData + length_PKCS12_MacData + copy_PKCS12_MacData + encode_PKCS12_PFX + decode_PKCS12_PFX + free_PKCS12_PFX + length_PKCS12_PFX + copy_PKCS12_PFX + encode_PKCS12_AuthenticatedSafe + decode_PKCS12_AuthenticatedSafe + free_PKCS12_AuthenticatedSafe + length_PKCS12_AuthenticatedSafe + copy_PKCS12_AuthenticatedSafe + encode_PKCS12_CertBag + decode_PKCS12_CertBag + free_PKCS12_CertBag + length_PKCS12_CertBag + copy_PKCS12_CertBag + encode_PKCS12_Attribute + decode_PKCS12_Attribute + free_PKCS12_Attribute + length_PKCS12_Attribute + copy_PKCS12_Attribute + encode_PKCS12_Attributes + decode_PKCS12_Attributes + free_PKCS12_Attributes + length_PKCS12_Attributes + copy_PKCS12_Attributes + encode_PKCS12_SafeBag + decode_PKCS12_SafeBag + free_PKCS12_SafeBag + length_PKCS12_SafeBag + copy_PKCS12_SafeBag + encode_PKCS12_SafeContents + decode_PKCS12_SafeContents + free_PKCS12_SafeContents + length_PKCS12_SafeContents + copy_PKCS12_SafeContents + encode_PKCS12_OctetString + decode_PKCS12_OctetString + free_PKCS12_OctetString + length_PKCS12_OctetString + copy_PKCS12_OctetString + encode_PKCS12_PBEParams + decode_PKCS12_PBEParams + free_PKCS12_PBEParams + length_PKCS12_PBEParams + copy_PKCS12_PBEParams + encode_DigestError + decode_DigestError + free_DigestError + length_DigestError + copy_DigestError + encode_DigestInit + decode_DigestInit + free_DigestInit + length_DigestInit + copy_DigestInit + encode_DigestInitReply + decode_DigestInitReply + free_DigestInitReply + length_DigestInitReply + copy_DigestInitReply + encode_DigestREP + decode_DigestREP + free_DigestREP + length_DigestREP + copy_DigestREP + encode_DigestREQ + decode_DigestREQ + free_DigestREQ + length_DigestREQ + copy_DigestREQ + encode_DigestRepInner + decode_DigestRepInner + free_DigestRepInner + length_DigestRepInner + copy_DigestRepInner + encode_DigestReqInner + decode_DigestReqInner + free_DigestReqInner + length_DigestReqInner + copy_DigestReqInner + encode_DigestRequest + decode_DigestRequest + free_DigestRequest + length_DigestRequest + copy_DigestRequest + encode_DigestResponse + decode_DigestResponse + free_DigestResponse + length_DigestResponse + copy_DigestResponse + encode_DigestTypes + decode_DigestTypes + free_DigestTypes + length_DigestTypes + copy_DigestTypes + DigestTypes2int + int2DigestTypes + asn1_DigestTypes_units + encode_NTLMInit + decode_NTLMInit + free_NTLMInit + length_NTLMInit + copy_NTLMInit + encode_NTLMInitReply + decode_NTLMInitReply + free_NTLMInitReply + length_NTLMInitReply + copy_NTLMInitReply + encode_NTLMRequest + decode_NTLMRequest + free_NTLMRequest + length_NTLMRequest + copy_NTLMRequest + encode_NTLMResponse + decode_NTLMResponse + free_NTLMResponse + length_NTLMResponse + copy_NTLMResponse + encode_Kx509Response + decode_Kx509Response + free_Kx509Response + length_Kx509Response + copy_Kx509Response + encode_Kx509Request + decode_Kx509Request + free_Kx509Request + length_Kx509Request + copy_Kx509Request + initialize_asn1_error_table_r + initialize_asn1_error_table From 60f2a22e5458a33eb17d28d50a55f65297c3d892 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Sep 2009 16:31:12 -0400 Subject: [PATCH 045/134] Port kuser --- kuser/NTMakefile | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/kuser/NTMakefile b/kuser/NTMakefile index eb0bb5498..425a8b4eb 100644 --- a/kuser/NTMakefile +++ b/kuser/NTMakefile @@ -33,3 +33,90 @@ RELDIR=kuser !include ../windows/NTMakefile.w32 +BINPROGRAMS=\ + $(BINDIR)\kinit.exe \ + $(BINDIR)\klist.exe \ + $(BINDIR)\kdestroy.exe \ + $(BINDIR)\kgetcred.exe \ + $(BINDIR)\kswitch.exe + +LIBEXECPROGRAMS=\ + $(LIBEXECDIR)\kdigest.exe \ + $(LIBEXECDIR)\kimpersonate.exe + +NOINSTPROGRAMS=\ + $(OBJ)\kverify.exe \ + $(OBJ)\kdecode_ticket.exe \ + $(OBJ)\generate-requests.exe \ + $(OBJ)\copy_cred_cache.exe + +BINLIBS=\ + $(LIBKRB5) \ + $(LIBHEIMNTLM) \ + $(LIBHCRYPTO) \ + $(LIBASN1) \ + $(LIBROKEN) \ + $(LIBVERS) + + +all:: $(BINPROGRAMS) $(LIBEXECPROGRAMS) + +clean:: + -$(RM) $(BINPROGRAMS) $(LIBEXECPROGRAMS) + +$(BINDIR)\kinit.exe: $(OBJ)\kinit.obj $(BINLIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(BINDIR)\klist.exe: $(OBJ)\klist.obj $(BINLIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + + +$(BINDIR)\kdestroy.exe: $(OBJ)\kdestroy.obj $(BINLIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + + +$(BINDIR)\kgetcred.exe: $(OBJ)\kgetcred.obj $(BINLIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + + +$(BINDIR)\kswitch.exe: $(OBJ)\kswitch.obj $(BINLIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + + +$(LIBEXECDIR)\kdigest.exe: $(OBJ)\kdigest-commands.obj $(OBJ)\kdigest.obj $(BINLIBS) $(LIBSL) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(OBJ)\kdigest.obj: kdigest.c + $(C2OBJ) -I$(OBJ) + +$(OBJ)\kdigest-commands.c $(OBJ)\kdigest-commands.h: kdigest-commands.in + cd $(OBJ) + $(CP) $(SRCDIR)\kdigest-commands.in $(OBJ) + $(BINDIR)\slc.exe kdigest-commands.in + cd $(SRCDIR) + + +$(LIBEXECDIR)\kimpersonate.exe: $(OBJ)\kimpersonate.obj $(BINLIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + From 649a929a545d2bb3dd7683b9c44a52634546c23f Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Sep 2009 16:31:52 -0400 Subject: [PATCH 046/134] LIBKDC and binary prep macros --- windows/NTMakefile.w32 | 48 +++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/windows/NTMakefile.w32 b/windows/NTMakefile.w32 index 971dcb98f..19e2a6f27 100644 --- a/windows/NTMakefile.w32 +++ b/windows/NTMakefile.w32 @@ -144,7 +144,7 @@ pthreadinc= -I$(PTHREAD_INC) #---------------------------------------------------------------- # Build options -cincdirs=$(cincdirs) -I$(INCDIR) $(pthreadinc) +cincdirs=$(cincdirs) -I$(INCDIR) -I$(INCDIR)\krb5 $(pthreadinc) cdefines=$(cdefines) -DHAVE_CONFIG_H cwarn=$(cwarn) -D_CRT_SECURE_NO_WARNINGS -wd4996 @@ -259,15 +259,15 @@ prep:: show-cmds {$(OBJ)}.cpp{$(OBJ)}.obj: $(C2OBJ) -{}.hin{}.h: - $(CP) $< $@ - {}.hin{$(INCDIR)}.h: $(CP) $< $@ {}.h{$(INCDIR)}.h: $(CP) $< $@ +{}.h{$(INCDIR)\krb5}.h: + $(CP) $< $@ + {$(OBJ)}.h{$(INCDIR)}.h: $(CP) $< $@ @@ -325,7 +325,9 @@ mkdirs: ! if !exist($(INCDIR)\kadm5) $(MKDIR) $(INCDIR)\kadm5 ! endif - +! if !exist($(INCDIR)\krb5) + $(MKDIR) $(INCDIR)\krb5 +! endif #---------------------------------------------------------------------- # If SUBDIRS is defined, we should recurse into the subdirectories @@ -368,11 +370,12 @@ clean:: # Starting with Visual Studio 8, the C compiler and the linker # generate manifests so that the applications will link with the # correct side-by-side DLLs at run-time. These are required for -# correct operation under Windows XP. We also have custom manifests -# which need to be merged with the manifests that VS creates. +# correct operation under Windows XP and later. We also have custom +# manifests which need to be merged with the manifests that VS +# creates. # -# The syntax for invoking the _VC_MANIFEST_EMBED_foo macro is: -# $(_VC_MANIFEST_EMBED_???) +# The syntax for invoking the _VC_MANIFEST_EMBED_FOO macro is: +# $(_VC_MANIFEST_EMBED_???) # MT=mt.exe -nologo @@ -388,6 +391,7 @@ if exist $@.manifest $(MT) -outputresource:$@;2 -manifest $@.manifest # This ensures that even if the DLL or EXE is executed in-place, the # embedded manifest will be used. Otherwise the $@.manifest file will # be used. + _VC_MANIFEST_CLEAN= \ if exist $@.manifest $(RM) $@.manifest @@ -400,9 +404,32 @@ _CODESIGN=$(CODESIGN) $@ _CODESIGN= !endif +#---------------------------------------------------------------------- +# Convenience macros for preparing EXEs and DLLs. These are multiline +# macros that deal with manifests and code signing. Unless we need to +# include custom manifests, these are what we should be using to +# prepare binaries. + +EXEPREP=\ +$(_VC_MANIFEST_EMBED_EXE)^ +$(_VC_MANIFEST_CLEAN)^ +$(_CODESIGN) + +EXEPREP_NODIST=\ +$(_VC_MANIFEST_EMBED_EXE)^ +$(_VC_MANIFEST_CLEAN) + +DLLPREP=\ +$(_VC_MANIFEST_EMBED_DLL)^ +$(_VC_MANIFEST_CLEAN)^ +$(_CODESIGN) + +DLLPREP_NODIST=\ +$(_VC_MANIFEST_EMBED_DLL)^ +$(_VC_MANIFEST_CLEAN) #---------------------------------------------------------------------- -# Various libraries +# Convenience macros for import libraries # LIBROKEN =$(LIBDIR)\libroken.lib @@ -421,3 +448,4 @@ LIBGSSAPI =$(LIBDIR)\libgssapi.lib LIBHDB =$(LIBDIR)\libhdb.lib LIBKADM5SRV =$(LIBDIR)\libkadm5srv.lib LIBKADM5CLNT=$(LIBDIR)\libkadm5clnt.lib +LIBKDC =$(LIBDIR)\libkdc.lib From 28023be15ab1670a6166c2070a8234505ccc5e72 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Sep 2009 16:32:10 -0400 Subject: [PATCH 047/134] Add setenv() to libroken --- lib/roken/NTMakefile | 1 + lib/roken/setenv.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile index 28e96c348..2f1ae6b38 100644 --- a/lib/roken/NTMakefile +++ b/lib/roken/NTMakefile @@ -80,6 +80,7 @@ libroken_la_OBJS = \ $(OBJ)\roken_gethostby.obj \ $(OBJ)\rtbl.obj \ $(OBJ)\sendmsg_w32.obj \ + $(OBJ)\setenv.obj \ $(OBJ)\setprogname.obj \ $(OBJ)\simple_exec_w32.obj \ $(OBJ)\sleep.obj \ diff --git a/lib/roken/setenv.c b/lib/roken/setenv.c index bce9bd752..403db67cf 100644 --- a/lib/roken/setenv.c +++ b/lib/roken/setenv.c @@ -47,6 +47,7 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL setenv(const char *var, const char *val, int rewrite) { +#ifndef _WIN32 char *t; if (!rewrite && getenv(var) != 0) @@ -60,4 +61,15 @@ setenv(const char *var, const char *val, int rewrite) return 0; else return -1; +#else /* Win32 */ + char dummy[8]; + + if (!rewrite && GetEnvironmentVariable(var, dummy, sizeof(dummy)/sizeof(char)) != 0) + return 0; + + if (SetEnvironmentVariable(var, val) == 0) + return -1; + else + return 0; +#endif } From 06179e66adcc271e381fc1dcd4924963e3443aa6 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Sep 2009 16:32:30 -0400 Subject: [PATCH 048/134] Additional include files for krb5 --- lib/krb5/NTMakefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/krb5/NTMakefile b/lib/krb5/NTMakefile index dad05afa1..8254c1cd8 100644 --- a/lib/krb5/NTMakefile +++ b/lib/krb5/NTMakefile @@ -149,7 +149,8 @@ INCFILES= \ $(INCDIR)\krb5_err.h \ $(INCDIR)\krb5_locl.h \ $(INCDIR)\krb5-protos.h \ - $(INCDIR)\krb5-private.h + $(INCDIR)\krb5-private.h \ + $(INCDIR)\krb5-v4compat.h all:: $(INCFILES) From 41afd0a13964508b261a42cf265acca03af1e834 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Sep 2009 16:32:48 -0400 Subject: [PATCH 049/134] Locale.h and setenv() --- include/config.h.w32 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/config.h.w32 b/include/config.h.w32 index 1f0f7e966..017d025eb 100644 --- a/include/config.h.w32 +++ b/include/config.h.w32 @@ -566,6 +566,9 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } /* Define if you have the function `localtime_r'. */ /* #define HAVE_LOCALTIME_R 1 */ +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + /* Define to 1 if you have the `logout' function. */ /* #define HAVE_LOGOUT 1 */ @@ -1310,7 +1313,7 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } /* #undef NEED_SECKEYGETCSPHANDLE_PROTO */ /* define if the system is missing a prototype for setenv() */ -/* #undef NEED_SETENV_PROTO */ +#define NEED_SETENV_PROTO 1 /* define if the system is missing a prototype for snprintf() */ /* #undef NEED_SNPRINTF_PROTO */ From aa058a6a63fcbb08e0d7b53ed85cd4587a4b627a Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Sep 2009 16:33:33 -0400 Subject: [PATCH 050/134] Typos and fixes for init_c.c to not include stuff we don't have --- lib/kadm5/NTMakefile | 5 +++-- lib/kadm5/init_c.c | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/kadm5/NTMakefile b/lib/kadm5/NTMakefile index a6bd87884..6ae003fb7 100644 --- a/lib/kadm5/NTMakefile +++ b/lib/kadm5/NTMakefile @@ -90,7 +90,7 @@ dist_libkadm5srv_la_SOURCES = \ kadm5-pwcheck.h \ admin.h -LIBKADM5CLNT_OBJs= \ +LIBKADM5CLNT_OBJS= \ $(OBJ)\ad.obj \ $(OBJ)\chpass_c.obj \ $(OBJ)\client_glue.obj \ @@ -159,7 +159,8 @@ $(OBJ)\kadm5-private.h: $(dist_libkadm5srv_la_SOURCES) $(dist_libkadm5clnt_la_SO $(OBJ)\iprop-commands.c $(OBJ)\iprop-commands.h: iprop-commands.in cd $(OBJ) - $(BINDIR)\slc.exe $(SRCDIR)\iprop-commands.in + $(CP) $(SRCDIR)\iprop-commands.in $(OBJ) + $(BINDIR)\slc.exe iprop-commands.in cd $(SRCDIR) $(OBJ)\kadm5_err.h $(OBJ)kadm5_err.c: kadm5_err.et diff --git a/lib/kadm5/init_c.c b/lib/kadm5/init_c.c index 9268112f6..ca7efa18a 100644 --- a/lib/kadm5/init_c.c +++ b/lib/kadm5/init_c.c @@ -33,9 +33,15 @@ #include "kadm5_locl.h" #include +#ifdef HAVE_SYS_SOCKET_H #include +#endif +#ifdef HAVE_NETINET_IN_H #include +#endif +#ifdef HAVE_NETDB_H #include +#endif RCSID("$Id$"); From ef1501d081b61cf3921318d1a517139888e137f9 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Sat, 12 Sep 2009 00:41:10 -0400 Subject: [PATCH 051/134] Also include data when listing externals in an .OBJ file --- cf/w32-list-externs-from-objs.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf/w32-list-externs-from-objs.pl b/cf/w32-list-externs-from-objs.pl index f72d0ae7e..ebc776744 100644 --- a/cf/w32-list-externs-from-objs.pl +++ b/cf/w32-list-externs-from-objs.pl @@ -17,7 +17,7 @@ sub dump_symbols_for_file($) while () { # 008 00000000 SECT3 notype () External | _encode_AccessDescription - /^[[:xdigit:]]{3,}\s[[:xdigit:]]{8,}\s(\w+)\s+\w*\s+\(\)\s+(\w+)\s+\|\s+(\w+)$/ && do { + /^[[:xdigit:]]{3,}\s[[:xdigit:]]{8,}\s(\w+)\s+\w*\s+(?:\(\)| )\s+(\w+)\s+\|\s+(\w+)$/ && do { my ($section, $visibility, $symbol) = ($1, $2, $3); if ($section ne "UNDEF" && $visibility eq "External") { From 0b0ad493826e1382d8109748416a2b9896711ccd Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Sat, 12 Sep 2009 00:41:37 -0400 Subject: [PATCH 052/134] Complete NTMakefile for admin --- admin/NTMakefile | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/admin/NTMakefile b/admin/NTMakefile index 943be2e7a..0068c0dae 100644 --- a/admin/NTMakefile +++ b/admin/NTMakefile @@ -30,6 +30,46 @@ # RELDIR=admin - +cincdirs=$(cincdirs) -I$(OBJ) !include ../windows/NTMakefile.w32 +SBINPROGRAMS=$(SBINDIR)\ktutil.exe + +KTUTIL_OBJS= \ + $(OBJ)\add.obj \ + $(OBJ)\change.obj \ + $(OBJ)\copy.obj \ + $(OBJ)\destroy.obj \ + $(OBJ)\get.obj \ + $(OBJ)\ktutil.obj \ + $(OBJ)\ktutil-commands.obj \ + $(OBJ)\list.obj \ + $(OBJ)\purge.obj \ + $(OBJ)\remove.obj \ + $(OBJ)\rename.obj + +KTUTIL_LIBS= \ + $(LIBKRB5) \ + $(LIBKADM5SRV) \ + $(LIBSL) \ + $(LIBROKEN) \ + $(LIBHCRYPTO) \ + $(LIBVERS) + +$(SBINDIR)\ktutil.exe: $(KTUTIL_OBJS) $(KTUTIL_LIBS) + $(EXECONLINK) + $(EXEPREP) + +$(OBJ)\ktutil-commands.c $(OBJ)\ktutil-commands.h: ktutil-commands.in + cd $(OBJ) + $(CP) $(SRCDIR)\ktutil-commands.in $(OBJ) + $(BINDIR)\slc.exe ktutil-commands.in + cd $(SRCDIR) + +INCFILES=\ + $(OBJ)\ktutil-commands.h + +all:: $(INCFILES) $(SBINPROGRAMS) + +clean:: + -$(RM) $(SBINPROGRAMS) From b79445f4e4ef325d0497d833a9bbe98c1d52adfc Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Sat, 12 Sep 2009 00:44:43 -0400 Subject: [PATCH 053/134] Config changes - Use custom implementations for strlcat() and strlcpy() because strcpy_s() and strcat_s() have different behavior. - Define NO_POSIX_LINKS to indicate that link/unlink operations don't quite work the way they should. I.e. in-use files can't be replaced that way. - Change definitions of directory macros to use correct path tokens. - Define NO_INETD to indicate that there's no inetd --- include/config.h.w32 | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/include/config.h.w32 b/include/config.h.w32 index 017d025eb..8b480884f 100644 --- a/include/config.h.w32 +++ b/include/config.h.w32 @@ -95,17 +95,6 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } #endif #endif -#define _STR2(x) #x -#define _STR(x) _STR2(x) - -#ifdef _HOST -#define HOST _STR(_HOST) -#endif - -#ifdef _HDB_DB_DIR -#define HDB_DB_DIR _STR(_HDB_DB_DIR) -#endif - /* Feature macros */ @FEATURE_DEFS@ @@ -856,12 +845,10 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } #define HAVE_STRING_H 1 /* Define if you have the function `strlcat'. */ -#define HAVE_STRLCAT 1 -#define strlcat(d,s,dsz) strcat_s((d),(dsz),(s)) +/* #define HAVE_STRLCAT 1 */ /* Define if you have the function `strlcpy'. */ -#define HAVE_STRLCPY 1 -#define strlcpy(d,s,dsz) strcpy_s((d),(dsz),(s)) +/* #define HAVE_STRLCPY 1 */ /* Define if you have the function `strlwr'. */ #define HAVE_STRLWR 1 @@ -1366,6 +1353,10 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } /* Define if you don't want to use mmap. */ #define NO_MMAP 1 +/* Define to 1 if inetd will never be used to invoke any of the + daemons. */ +#define NO_INETD 1 + #define NO_RAND_EGD_METHOD 1 /* Define if the Unix rand method is not defined */ @@ -1389,6 +1380,12 @@ static const char *const rcsid[] = { (const char *)rcsid, "@(#)" msg } /* Define to 1 if Unix sockets (AF_UNIX) are not available. */ #define NO_UNIX_SOCKETS 1 +/* Define to 1 if POSIX link/unlink operations should be avoided. + This may be because the behavior of links are not not consistent + with POSIX or because the filesystem may not support POSIX + links. */ +#define NO_POSIX_LINKS 1 + /* Define this to enable old environment option in telnet. */ /* #define OLD_ENVIRON 1 */ @@ -1492,17 +1489,21 @@ typedef unsigned short mode_t; /* Paths */ -#define SYSCONFDIR "%{COMMON_APPDATA}\\@PACKAGE@" +#define SYSCONFDIR "%{COMMONCONFIG}" -#define LIBDIR "%{COMMON_APPDATA}\\@PACKAGE@\\lib" +#define LIBDIR "%{LIBDIR}" -#define LIBEXECDIR "%{COMMON_APPDATA}\\@PACKAGE@\\libexec" +#if 0 -#define LOCALSTATEDIR "%{COMMON_APPDATA}\\@PACKAGE@" +#define LIBEXECDIR "%{LIBEXECDIR}" -#define SBINDIR "%{COMMON_APPDATA}\\@PACKAGE@\\sbin" +#define LOCALSTATEDIR "%{COMMONCONFIG}" -#define BINDIR "%{COMMON_APPDATA}\\@PACKAGE@\\bin" +#define SBINDIR "%{SBINDIR}" + +#define BINDIR "%{BINDIR}" + +#endif #endif /* RC_INVOKED */ From 14ae7398209a54af0956f38270967e3db79c8111 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:38:14 -0400 Subject: [PATCH 054/134] Don't rely on Posix links in kadmin/stash.c --- kadmin/stash.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kadmin/stash.c b/kadmin/stash.c index 3d4c51065..987c01bc8 100644 --- a/kadmin/stash.c +++ b/kadmin/stash.c @@ -128,12 +128,18 @@ stash(struct stash_options *opt, int argc, char **argv) unlink(new); else { unlink(old); +#ifndef NO_POSIX_LINKS if(link(opt->key_file_string, old) < 0 && errno != ENOENT) { ret = errno; unlink(new); - } else if(rename(new, opt->key_file_string) < 0) { - ret = errno; + } else { +#endif + if(rename(new, opt->key_file_string) < 0) { + ret = errno; + } +#ifndef NO_POSIX_LINKS } +#endif } out: free(old); From a1942c1bad5be9a944e1b7d82d5c161c16bd5428 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:39:37 -0400 Subject: [PATCH 055/134] Use SOCKET data type instead of ints for sockets in kadmin Also use the new mini_inetd() API --- kadmin/kadm_conn.c | 43 +++++++++++++++++++++++-------------------- kadmin/kadmind.c | 19 +++++++++++++------ kadmin/rpc.c | 6 +++--- kadmin/server.c | 14 +++++++------- 4 files changed, 46 insertions(+), 36 deletions(-) diff --git a/kadmin/kadm_conn.c b/kadmin/kadm_conn.c index 393a6c1eb..1cd023ff0 100644 --- a/kadmin/kadm_conn.c +++ b/kadmin/kadm_conn.c @@ -124,15 +124,15 @@ spawn_child(krb5_context context, int *socks, struct sockaddr_storage __ss; struct sockaddr *sa = (struct sockaddr *)&__ss; socklen_t sa_size = sizeof(__ss); - int s; + SOCKET s; pid_t pid; krb5_address addr; char buf[128]; size_t buf_len; s = accept(socks[this_sock], sa, &sa_size); - if(s < 0) { - krb5_warn(context, errno, "accept"); + if(IS_BAD_SOCKET(s)) { + krb5_warn(context, SOCK_ERRNO, "accept"); return 1; } e = krb5_sockaddr2address(context, sa, &addr); @@ -151,21 +151,21 @@ spawn_child(krb5_context context, int *socks, pid = fork(); if(pid == 0) { for(i = 0; i < num_socks; i++) - close(socks[i]); + closesocket(socks[i]); dup2(s, STDIN_FILENO); dup2(s, STDOUT_FILENO); if(s != STDIN_FILENO && s != STDOUT_FILENO) - close(s); + closesocket(s); return 0; } else { - close(s); + closesocket(s); } return 1; } static int wait_for_connection(krb5_context context, - int *socks, unsigned int num_socks) + SOCKET *socks, unsigned int num_socks) { unsigned int i; int e; @@ -175,8 +175,10 @@ wait_for_connection(krb5_context context, FD_ZERO(&orig_read_set); for(i = 0; i < num_socks; i++) { +#ifndef NO_LIMIT_FD_SETSIZE if (socks[i] >= FD_SETSIZE) errx (1, "fd too large"); +#endif FD_SET(socks[i], &orig_read_set); max_fd = max(max_fd, socks[i]); } @@ -193,9 +195,9 @@ wait_for_connection(krb5_context context, while (term_flag == 0) { read_set = orig_read_set; e = select(max_fd + 1, &read_set, NULL, NULL, NULL); - if(e < 0) { - if(errno != EINTR) - krb5_warn(context, errno, "select"); + if(IS_SOCKET_ERROR(e)) { + if(SOCK_ERRNO != EINTR) + krb5_warn(context, SOCK_ERRNO, "select"); } else if(e == 0) krb5_warnx(context, "select returned 0"); else { @@ -224,7 +226,7 @@ start_server(krb5_context context) int e; struct kadm_port *p; - int *socks = NULL, *tmp; + SOCKET *socks = NULL, *tmp; unsigned int num_socks = 0; int i; @@ -257,23 +259,23 @@ start_server(krb5_context context) } socks = tmp; for(ap = ai; ap; ap = ap->ai_next) { - int s = socket(ap->ai_family, ap->ai_socktype, ap->ai_protocol); - if(s < 0) { - krb5_warn(context, errno, "socket"); + SOCKET s = socket(ap->ai_family, ap->ai_socktype, ap->ai_protocol); + if(IS_BAD_SOCKET(s)) { + krb5_warn(context, SOCK_ERRNO, "socket"); continue; } socket_set_reuseaddr(s, 1); socket_set_ipv6only(s, 1); - if (bind (s, ap->ai_addr, ap->ai_addrlen) < 0) { - krb5_warn(context, errno, "bind"); - close(s); + if (IS_SOCKET_ERROR(bind (s, ap->ai_addr, ap->ai_addrlen))) { + krb5_warn(context, SOCK_ERRNO, "bind"); + closesocket(s); continue; } - if (listen (s, SOMAXCONN) < 0) { - krb5_warn(context, errno, "listen"); - close(s); + if (IS_SOCKET_ERROR(listen (s, SOMAXCONN))) { + krb5_warn(context, SOCK_ERRNO, "listen"); + closesocket(s); continue; } socks[num_socks++] = s; @@ -282,5 +284,6 @@ start_server(krb5_context context) } if(num_socks == 0) krb5_errx(context, 1, "no sockets to listen to - exiting"); + return wait_for_connection(context, socks, num_socks); } diff --git a/kadmin/kadmind.c b/kadmin/kadmind.c index 318989adf..c74ab1661 100644 --- a/kadmin/kadmind.c +++ b/kadmin/kadmind.c @@ -95,6 +95,7 @@ main(int argc, char **argv) int i; krb5_log_facility *logfacility; krb5_keytab keytab; + SOCKET sfd = INVALID_SOCKET; setprogname(argv[0]); @@ -168,8 +169,9 @@ main(int argc, char **argv) "tcp", 749); else debug_port = htons(atoi(port_str)); - mini_inetd(debug_port); + mini_inetd(debug_port, &sfd); } else { +#ifndef NO_INETD struct sockaddr_storage __ss; struct sockaddr *sa = (struct sockaddr *)&__ss; socklen_t sa_size = sizeof(__ss); @@ -178,19 +180,24 @@ main(int argc, char **argv) * Check if we are running inside inetd or not, if not, start * our own server. */ - + if(roken_getsockname(STDIN_FILENO, sa, &sa_size) < 0 && - errno == ENOTSOCK) { + SOCK_ERRNO == ENOTSOCK) { +#endif parse_ports(context, port_str ? port_str : "+"); pidfile(NULL); - start_server(context); + start_server(context, &sfd); +#ifndef NO_INETD + } else { + sfd = STDIN_FILENO; } +#endif } - + if(realm) krb5_set_default_realm(context, realm); /* XXX */ - kadmind_loop(context, keytab, STDIN_FILENO); + kadmind_loop(context, keytab, sfd); return 0; } diff --git a/kadmin/rpc.c b/kadmin/rpc.c index 9170d68ca..de818c0a5 100644 --- a/kadmin/rpc.c +++ b/kadmin/rpc.c @@ -1091,16 +1091,16 @@ process_stream(krb5_context context, int -handle_mit(krb5_context context, void *buf, size_t len, int fd) +handle_mit(krb5_context context, void *buf, size_t len, SOCKET sock) { krb5_storage *sp; dcontext = context; - sp = krb5_storage_from_fd(fd); + sp = krb5_storage_from_fd(sock); INSIST(sp != NULL); process_stream(context, buf, len, sp); - + return 0; } diff --git a/kadmin/server.c b/kadmin/server.c index bdf1f5350..5068b36b6 100644 --- a/kadmin/server.c +++ b/kadmin/server.c @@ -440,7 +440,7 @@ v5_loop (krb5_context context, krb5_auth_context ac, krb5_boolean initial, void *kadm_handle, - int fd) + SOCKET fd) { krb5_error_code ret; krb5_data in, out; @@ -476,7 +476,7 @@ match_appl_version(const void *data, const char *appl_version) static void handle_v5(krb5_context context, krb5_keytab keytab, - int fd) + SOCKET fd) { krb5_error_code ret; krb5_ticket *ticket; @@ -539,13 +539,13 @@ handle_v5(krb5_context context, krb5_error_code kadmind_loop(krb5_context context, krb5_keytab keytab, - int fd) + SOCKET sock) { u_char buf[sizeof(KRB5_SENDAUTH_VERSION) + 4]; ssize_t n; unsigned long len; - n = krb5_net_read(context, &fd, buf, 4); + n = krb5_net_read(context, &sock, buf, 4); if(n == 0) exit(0); if(n < 0) @@ -554,21 +554,21 @@ kadmind_loop(krb5_context context, if (len == sizeof(KRB5_SENDAUTH_VERSION)) { - n = krb5_net_read(context, &fd, buf + 4, len); + n = krb5_net_read(context, &sock, buf + 4, len); if (n < 0) krb5_err (context, 1, errno, "reading sendauth version"); if (n == 0) krb5_errx (context, 1, "EOF reading sendauth version"); if(memcmp(buf + 4, KRB5_SENDAUTH_VERSION, len) == 0) { - handle_v5(context, keytab, fd); + handle_v5(context, keytab, sock); return 0; } len += 4; } else len = 4; - handle_mit(context, buf, len, fd); + handle_mit(context, buf, len, sock); return 0; } From 4583cc514d69e27b9e2c130a19b51371004e94d3 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:39:46 -0400 Subject: [PATCH 056/134] NTMakefile for kadmin --- kadmin/NTMakefile | 97 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/kadmin/NTMakefile b/kadmin/NTMakefile index d1524de9c..8d8c4a395 100644 --- a/kadmin/NTMakefile +++ b/kadmin/NTMakefile @@ -30,6 +30,103 @@ # RELDIR=kadmin +cincdirs=-I$(OBJ) -I$(INCDIR)\gssapi !include ../windows/NTMakefile.w32 +SBIN_PROGRAMS=$(SBINDIR)\kadmin.exe + +LIBEXEC_PROGRAMS=$(LIBEXECDIR)\kadmind.exe + +COMMON_LIBS= \ + $(LIBHDB) \ + $(LIBKRB5) \ + $(LIBHCRYPTO) \ + $(LIBASN1) \ + $(LIBROKEN) + +KADMIN_OBJS= \ + $(OBJ)\ank.obj \ + $(OBJ)\add_enctype.obj \ + $(OBJ)\check.obj \ + $(OBJ)\cpw.obj \ + $(OBJ)\del.obj \ + $(OBJ)\del_enctype.obj \ + $(OBJ)\dump.obj \ + $(OBJ)\ext.obj \ + $(OBJ)\get.obj \ + $(OBJ)\init.obj \ + $(OBJ)\kadmin.obj \ + $(OBJ)\load.obj \ + $(OBJ)\mod.obj \ + $(OBJ)\rename.obj \ + $(OBJ)\stash.obj \ + $(OBJ)\util.obj \ + $(OBJ)\pw_quality.obj \ + $(OBJ)\random_password.obj \ + $(OBJ)\kadmin-commands.obj + +KADMIN_LIBS= \ + $(LIBKADM5CLNT) \ + $(LIBKADM5SRV) \ + $(LIBSL) \ + $(COMMON_LIBS) \ + $(LIBVERS) \ + $(LIBCOMERR) + +INCFILES=$(OBJ)\kadmin-commands.h + +$(OBJ)\kadmin-commands.c $(OBJ)\kadmin-commands.h: kadmin-commands.in + cd $(OBJ) + $(CP) $(SRCDIR)\kadmin-commands.in $(OBJ) + $(BINDIR)\slc.exe kadmin-commands.in + cd $(SRCDIR) + +$(SBINDIR)\kadmin.exe: $(KADMIN_OBJS) $(KADMIN_LIBS) + $(EXECONLINK) + $(EXEPREP) + +KADMIND_OBJS= \ + $(OBJ)\rpc.obj \ + $(OBJ)\server.obj \ + $(OBJ)\kadmind.obj \ + $(OBJ)\kadm_conn.obj + +KADMIND_LIBS=\ + $(LIBKADM5SRV) \ + $(LIBGSSAPI) \ + $(COMMON_LIBS) + +$(LIBEXECDIR)\kadmind.exe: $(KADMIND_OBJS) $(KADMIND_LIBS) + $(EXECONLINK) + $(EXEPREP) + +all:: $(INCFILES) $(SBIN_PROGRAMS) $(LIBEXEC_PROGRAMS) + +clean:: + -$(RM) $(SBIN_PROGRAMS) + -$(RM) $(LIBEXEC_PROGRAMS) + + + + +NOINST_PROGRAMS=$(OBJ)\add_random_users.exe + +$(OBJ)\add_random_users.exe: $(OBJ)\add_random_users.obj $(LIBKADM5SRV) $(LIBKADM5CLNT) $(COMMON_LIBS) + $(EXECONLINK) + $(EXEPREP_NODIST) + +TEST_BINARIES=$(OBJ)\test_util.exe + +$(OBJ)\test_util.exe: $(OBJ)\test_util.obj $(OBJ)\util.obj $(KADMIN_LIBS) + $(EXECONLINK) + $(EXEPREP_NODIST) + +test-binaries: $(TEST_BINARIES) + +test-run: + cd $(OBJ) + test_util.exe + cd $(SRCDIR) + +test:: test-binaries test-run From d47c01083bcab5cfd39afd0ecae10e8d5ccc2d11 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:41:00 -0400 Subject: [PATCH 057/134] Use SOCKET data type instead of ints for sockets in kdc --- kdc/connect.c | 93 +++++++++++++++++++++++++++------------------------ kdc/hpropd.c | 45 +++++++++++++++++-------- 2 files changed, 81 insertions(+), 57 deletions(-) diff --git a/kdc/connect.c b/kdc/connect.c index c9b0ec538..d55415e41 100644 --- a/kdc/connect.c +++ b/kdc/connect.c @@ -217,7 +217,7 @@ parse_ports(krb5_context context, */ struct descr { - int s; + SOCKET s; int type; int port; unsigned char *buf; @@ -235,7 +235,7 @@ init_descr(struct descr *d) { memset(d, 0, sizeof(*d)); d->sa = (struct sockaddr *)&d->__ss; - d->s = -1; + d->s = INVALID_SOCKET; } /* @@ -270,8 +270,8 @@ init_socket(krb5_context context, ret = krb5_addr2sockaddr (context, a, sa, &sa_size, port); if (ret) { krb5_warn(context, ret, "krb5_addr2sockaddr"); - close(d->s); - d->s = -1; + closesocket(d->s); + d->s = INVALID_SOCKET; return; } @@ -279,9 +279,9 @@ init_socket(krb5_context context, return; d->s = socket(family, type, 0); - if(d->s < 0){ + if(IS_BAD_SOCKET(d->s)){ krb5_warn(context, errno, "socket(%d, %d, 0)", family, type); - d->s = -1; + d->s = INVALID_SOCKET; return; } #if defined(HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_REUSEADDR) @@ -293,24 +293,24 @@ init_socket(krb5_context context, d->type = type; d->port = port; - if(bind(d->s, sa, sa_size) < 0){ + if(IS_SOCKET_ERROR(bind(d->s, sa, sa_size))){ char a_str[256]; size_t len; krb5_print_address (a, a_str, sizeof(a_str), &len); krb5_warn(context, errno, "bind %s/%d", a_str, ntohs(port)); - close(d->s); - d->s = -1; + closesocket(d->s); + d->s = INVALID_SOCKET; return; } - if(type == SOCK_STREAM && listen(d->s, SOMAXCONN) < 0){ + if(type == SOCK_STREAM && IS_SOCKET_ERROR(listen(d->s, SOMAXCONN))){ char a_str[256]; size_t len; krb5_print_address (a, a_str, sizeof(a_str), &len); krb5_warn(context, errno, "listen %s/%d", a_str, ntohs(port)); - close(d->s); - d->s = -1; + closesocket(d->s); + d->s = INVALID_SOCKET; return; } } @@ -348,7 +348,7 @@ init_sockets(krb5_context context, for (j = 0; j < addresses.len; ++j) { init_socket(context, config, &d[num], &addresses.val[j], ports[i].family, ports[i].type, ports[i].port); - if(d[num].s != -1){ + if(d[num].s != INVALID_SOCKET){ char a_str[80]; size_t len; @@ -423,15 +423,15 @@ send_reply(krb5_context context, l[1] = (reply->length >> 16) & 0xff; l[2] = (reply->length >> 8) & 0xff; l[3] = reply->length & 0xff; - if(sendto(d->s, l, sizeof(l), 0, d->sa, d->sock_len) < 0) { + if(IS_SOCKET_ERROR(sendto(d->s, l, sizeof(l), 0, d->sa, d->sock_len))) { kdc_log (context, config, - 0, "sendto(%s): %s", d->addr_string, strerror(errno)); + 0, "sendto(%s): %s", d->addr_string, strerror(SOCK_ERRNO)); return; } } - if(sendto(d->s, reply->data, reply->length, 0, d->sa, d->sock_len) < 0) { + if(IS_SOCKET_ERROR(sendto(d->s, reply->data, reply->length, 0, d->sa, d->sock_len))) { kdc_log (context, config, - 0, "sendto(%s): %s", d->addr_string, strerror(errno)); + 0, "sendto(%s): %s", d->addr_string, strerror(SOCK_ERRNO)); return; } } @@ -488,10 +488,10 @@ handle_udp(krb5_context context, } d->sock_len = sizeof(d->__ss); - n = recvfrom(d->s, buf, max_request_udp, 0, d->sa, &d->sock_len); - if(n < 0) { - krb5_warn(context, errno, "recvfrom"); - } else { + n = recvfrom(d->s, buf, max_request, 0, d->sa, &d->sock_len); + if(IS_SOCKET_ERROR(n)) + krb5_warn(context, SOCK_ERRNO, "recvfrom"); + else { addr_to_string (context, d->sa, d->sock_len, d->addr_string, sizeof(d->addr_string)); if (n == max_request_udp) { @@ -523,9 +523,9 @@ clear_descr(struct descr *d) if(d->buf) memset(d->buf, 0, d->size); d->len = 0; - if(d->s != -1) - close(d->s); - d->s = -1; + if(d->s != INVALID_SOCKET) + closesocket(d->s); + d->s = INVALID_SOCKET; } @@ -559,23 +559,25 @@ add_new_tcp (krb5_context context, krb5_kdc_configuration *config, struct descr *d, int parent, int child) { - int s; + SOCKET s; if (child == -1) return; d[child].sock_len = sizeof(d[child].__ss); s = accept(d[parent].s, d[child].sa, &d[child].sock_len); - if(s < 0) { - krb5_warn(context, errno, "accept"); + if(IS_BAD_SOCKET(s)) { + krb5_warn(context, SOCK_ERRNO, "accept"); return; } - + +#ifndef NO_LIMIT_FD_SETSIZE if (s >= FD_SETSIZE) { krb5_warnx(context, "socket FD too large"); - close (s); + closesocket (s); return; } +#endif d[child].s = s; d[child].timeout = time(NULL) + TCP_TIMEOUT; @@ -718,14 +720,14 @@ handle_http_tcp (krb5_context context, kdc_log(context, config, 0, "HTTP request from %s is non KDC request", d->addr_string); kdc_log(context, config, 5, "HTTP request: %s", t); free(data); - if (write(d->s, proto, strlen(proto)) < 0) { + if (IS_SOCKET_ERROR(send(d->s, proto, strlen(proto), 0))) { kdc_log(context, config, 0, "HTTP write failed: %s: %s", - d->addr_string, strerror(errno)); + d->addr_string, strerror(SOCK_ERRNO)); return -1; } - if (write(d->s, msg, strlen(msg)) < 0) { + if (IS_SOCKET_ERROR(send(d->s, msg, strlen(msg), 0))) { kdc_log(context, config, 0, "HTTP write failed: %s: %s", - d->addr_string, strerror(errno)); + d->addr_string, strerror(SOCK_ERRNO)); return -1; } return -1; @@ -738,16 +740,16 @@ handle_http_tcp (krb5_context context, "Pragma: no-cache\r\n" "Content-type: application/octet-stream\r\n" "Content-transfer-encoding: binary\r\n\r\n"; - if (write(d->s, proto, strlen(proto)) < 0) { + if (IS_SOCKET_ERROR(send(d->s, proto, strlen(proto), 0))) { free(data); kdc_log(context, config, 0, "HTTP write failed: %s: %s", - d->addr_string, strerror(errno)); + d->addr_string, strerror(SOCK_ERRNO)); return -1; } - if (write(d->s, msg, strlen(msg)) < 0) { + if (IS_SOCKET_ERROR(send(d->s, msg, strlen(msg), 0))) { free(data); kdc_log(context, config, 0, "HTTP write failed: %s: %s", - d->addr_string, strerror(errno)); + d->addr_string, strerror(SOCK_ERRNO)); return -1; } } @@ -778,8 +780,8 @@ handle_tcp(krb5_context context, } n = recvfrom(d[idx].s, buf, sizeof(buf), 0, NULL, NULL); - if(n < 0){ - krb5_warn(context, errno, "recvfrom failed from %s to %s/%d", + if(IS_SOCKET_ERROR(n)){ + krb5_warn(context, SOCK_ERRNO, "recvfrom failed from %s to %s/%d", d[idx].addr_string, descr_type(d + idx), ntohs(d[idx].port)); return; @@ -865,7 +867,7 @@ loop(krb5_context context, FD_ZERO(&fds); for(i = 0; i < ndescr; i++) { - if(d[i].s >= 0){ + if(!IS_BAD_SOCKET(d[i].s)){ if(d[i].type == SOCK_STREAM && d[i].timeout && d[i].timeout < time(NULL)) { kdc_log(context, config, 1, @@ -874,10 +876,12 @@ loop(krb5_context context, clear_descr(&d[i]); continue; } +#ifndef NO_LIMIT_FD_SETSIZE if(max_fd < d[i].s) max_fd = d[i].s; if (max_fd >= FD_SETSIZE) krb5_errx(context, 1, "fd too large"); +#endif FD_SET(d[i].s, &fds); } else if(min_free < 0 || i < min_free) min_free = i; @@ -905,11 +909,11 @@ loop(krb5_context context, break; case -1: if (errno != EINTR) - krb5_warn(context, errno, "select"); + krb5_warn(context, SOCK_ERRNO, "select"); break; default: for(i = 0; i < ndescr; i++) - if(d[i].s >= 0 && FD_ISSET(d[i].s, &fds)) { + if(!IS_BAD_SOCKET(d[i].s) && FD_ISSET(d[i].s, &fds)) { if(d[i].type == SOCK_DGRAM) handle_udp(context, config, &d[i]); else if(d[i].type == SOCK_STREAM) @@ -917,8 +921,11 @@ loop(krb5_context context, } } } - if(exit_flag == SIGXCPU) + if (0); +#ifndef NO_SIGXCPU + else if(exit_flag == SIGXCPU) kdc_log(context, config, 0, "CPU time limit exceeded"); +#endif else if(exit_flag == SIGINT || exit_flag == SIGTERM) kdc_log(context, config, 0, "Terminated"); else diff --git a/kdc/hpropd.c b/kdc/hpropd.c index 73dc85d18..1f86257db 100644 --- a/kdc/hpropd.c +++ b/kdc/hpropd.c @@ -35,7 +35,9 @@ RCSID("$Id$"); +#ifndef NO_INETD static int inetd_flag = -1; +#endif static int help_flag; static int version_flag; static int print_dump; @@ -48,8 +50,10 @@ struct getargs args[] = { { "database", 'd', arg_string, &database, "database", "file" }, { "stdin", 'n', arg_flag, &from_stdin, "read from stdin" }, { "print", 0, arg_flag, &print_dump, "print dump to stdout" }, +#ifndef NO_INETD { "inetd", 'i', arg_negative_flag, &inetd_flag, "Not started from inetd" }, +#endif { "keytab", 'k', arg_string, &ktname, "keytab to use for authentication", "keytab" }, { "realm", 'r', arg_string, &local_realm, "realm to use" }, { "version", 0, arg_flag, &version_flag, NULL, NULL }, @@ -74,7 +78,8 @@ main(int argc, char **argv) krb5_principal c1, c2; krb5_authenticator authent; krb5_keytab keytab; - int fd; + SOCKET sock = INVALID_SOCKET; + int close_socket = 0; HDB *db = NULL; int optidx = 0; char *tmp_db; @@ -114,9 +119,9 @@ main(int argc, char **argv) if (database == NULL) database = hdb_default_db(context); - if(from_stdin) - fd = STDIN_FILENO; - else { + if(from_stdin) { + sock = STDIN_FILENO; + } else { struct sockaddr_storage ss; struct sockaddr *sa = (struct sockaddr *)&ss; socklen_t sin_len = sizeof(ss); @@ -124,19 +129,27 @@ main(int argc, char **argv) krb5_ticket *ticket; char *server; - fd = STDIN_FILENO; + sock = STDIN_FILENO; +#ifndef NO_INETD if (inetd_flag == -1) { - if (getpeername (fd, sa, &sin_len) < 0) + if (getpeername (sock, sa, &sin_len) < 0) { inetd_flag = 0; - else + close_socket = 0; + } else { inetd_flag = 1; + close_socket = 0; + } } if (!inetd_flag) { +#endif mini_inetd (krb5_getportbyname (context, "hprop", "tcp", - HPROP_PORT)); + HPROP_PORT), &sock); + close_socket = 1; +#ifndef NO_INETD } +#endif sin_len = sizeof(ss); - if(getpeername(fd, sa, &sin_len) < 0) + if(getpeername(sock, sa, &sin_len) < 0) krb5_err(context, 1, errno, "getpeername"); if (inet_ntop(sa->sa_family, @@ -162,7 +175,7 @@ main(int argc, char **argv) krb5_err (context, 1, ret, "krb5_kt_default"); } - ret = krb5_recvauth(context, &ac, &fd, HPROP_VERSION, NULL, + ret = krb5_recvauth(context, &ac, &sock, HPROP_VERSION, NULL, 0, keytab, &ticket); if(ret) krb5_err(context, 1, ret, "krb5_recvauth"); @@ -179,7 +192,7 @@ main(int argc, char **argv) ret = krb5_auth_con_getauthenticator(context, ac, &authent); if(ret) krb5_err(context, 1, ret, "krb5_auth_con_getauthenticator"); - + ret = krb5_make_principal(context, &c1, NULL, "kadmin", "hprop", NULL); if(ret) krb5_err(context, 1, ret, "krb5_make_principal"); @@ -217,11 +230,11 @@ main(int argc, char **argv) hdb_entry_ex entry; if(from_stdin) { - ret = krb5_read_message(context, &fd, &data); + ret = krb5_read_message(context, &sock, &data); if(ret != 0 && ret != HEIM_ERR_EOF) krb5_err(context, 1, ret, "krb5_read_message"); } else { - ret = krb5_read_priv_message(context, ac, &fd, &data); + ret = krb5_read_priv_message(context, ac, &sock, &data); if(ret) krb5_err(context, 1, ret, "krb5_read_priv_message"); } @@ -230,7 +243,7 @@ main(int argc, char **argv) if(!from_stdin) { data.data = NULL; data.length = 0; - krb5_write_priv_message(context, ac, &fd, &data); + krb5_write_priv_message(context, ac, &sock, &data); } if(!print_dump) { ret = db->hdb_rename(context, db, database); @@ -267,5 +280,9 @@ main(int argc, char **argv) } if (!print_dump) krb5_log(context, fac, 0, "Received %d principals", nprincs); + + if (close_socket) + closesocket(sock); + exit(0); } From 8768960156ebc428afde6c924f13f5e16a28207d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:41:17 -0400 Subject: [PATCH 058/134] Don't rely on Posix like links in kdc --- kdc/kstash.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kdc/kstash.c b/kdc/kstash.c index ad504b29c..784525d5e 100644 --- a/kdc/kstash.c +++ b/kdc/kstash.c @@ -144,13 +144,19 @@ main(int argc, char **argv) if(ret) unlink(new); else { +#ifndef NO_POSIX_LINKS unlink(old); if(link(keyfile, old) < 0 && errno != ENOENT) { ret = errno; unlink(new); - } else if(rename(new, keyfile) < 0) { - ret = errno; + } else { +#endif + if(rename(new, keyfile) < 0) { + ret = errno; + } +#ifndef NO_POSIX_LINKS } +#endif } out: free(old); From fa8a92471c6d4c862379e06c6d05e9eb329a6f39 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:41:40 -0400 Subject: [PATCH 059/134] Don't build KRB4 specific code if we aren't supporting KRB4 --- kdc/hprop.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kdc/hprop.c b/kdc/hprop.c index 432c7e28b..eb400e610 100644 --- a/kdc/hprop.c +++ b/kdc/hprop.c @@ -131,6 +131,7 @@ v5_prop(krb5_context context, HDB *db, hdb_entry_ex *entry, void *appdata) return ret; } +#ifdef KRB4 int v4_prop(void *arg, struct v4_principal *p) { @@ -255,6 +256,7 @@ v4_prop(void *arg, struct v4_principal *p) hdb_free_entry(pd->context, &ent); return ret; } +#endif #include "kadb.h" @@ -277,6 +279,8 @@ read_block(krb5_context context, int fd, int32_t pos, void *buf, size_t len) krb5_errx(context, 1, "read(%lu) = %u", (unsigned long)len, ret); } +#ifdef KRB4 + static int ka_convert(struct prop_data *pd, int fd, struct ka_entry *ent) { @@ -405,7 +409,7 @@ ka_dump(struct prop_data *pd, const char *file) } return 0; } - +#endif /* KRB4 */ struct getargs args[] = { @@ -414,13 +418,19 @@ struct getargs args[] = { { "source", 0, arg_string, &source_type, "type of database to read", "heimdal" "|mit-dump" +#ifdef KRB4 "|krb4-dump" "|kaserver" +#endif }, +#ifdef KRB4 { "v4-realm", 'r', arg_string, &v4_realm, "v4 realm to use" }, +#endif { "cell", 'c', arg_string, &afs_cell, "name of AFS cell" }, +#ifdef KRB4 { "kaspecials", 'S', arg_flag, &kaspecials_flag, "dump KASPECIAL keys"}, +#endif { "keytab", 'k', arg_string, &ktname, "keytab to use for authentication", "keytab" }, { "v5-realm", 'R', arg_string, &local_realm, "v5 realm to use" }, { "decrypt", 'D', arg_flag, &decrypt_flag, "decrypt keys" }, @@ -526,6 +536,7 @@ iterate (krb5_context context, int ret; switch(type) { +#ifdef KRB4 case HPROP_KRB4_DUMP: ret = v4_prop_dump(pd, database_name); if(ret) @@ -536,6 +547,7 @@ iterate (krb5_context context, if(ret) krb5_warn(context, ret, "ka_dump"); break; +#endif case HPROP_MIT_DUMP: ret = mit_prop_dump(pd, database_name); if (ret) From 6aa28bcc916303de02e69be9ed6a60d24e717601 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:42:09 -0400 Subject: [PATCH 060/134] Don't use SIGPIPE, SIGXCPU or geteuid() if they aren't available in kdc/main.c --- kdc/main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kdc/main.c b/kdc/main.c index b40bd11ef..16df408f4 100644 --- a/kdc/main.c +++ b/kdc/main.c @@ -64,6 +64,7 @@ sigterm(int sig) static void switch_environment(void) { +#ifdef HAVE_GETEUID if ((runas_string || chroot_string) && geteuid() != 0) errx(1, "no running as root, can't switch user/chroot"); @@ -86,6 +87,7 @@ switch_environment(void) if (setuid(pw->pw_uid) < 0) err(1, "setuid(%s)", runas_string); } +#endif } @@ -128,9 +130,13 @@ main(int argc, char **argv) #else signal(SIGINT, sigterm); signal(SIGTERM, sigterm); +#ifndef NO_SIGXCPU signal(SIGXCPU, sigterm); +#endif +#ifndef NO_SIGPIPE signal(SIGPIPE, SIG_IGN); #endif +#endif #ifdef SUPPORT_DETACH if (detach_from_console) daemon(0, 0); From 19185e136f891c314e3513939ea3913d6a4e7233 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:42:32 -0400 Subject: [PATCH 061/134] NTMakefile for kdc and exports.def for libkdc --- kdc/NTMakefile | 132 +++++++++++++++++++++++++++++++++++++++++ kdc/libkdc-exports.def | 12 ++++ 2 files changed, 144 insertions(+) create mode 100644 kdc/libkdc-exports.def diff --git a/kdc/NTMakefile b/kdc/NTMakefile index b17e24cea..c1636d719 100644 --- a/kdc/NTMakefile +++ b/kdc/NTMakefile @@ -33,3 +33,135 @@ RELDIR=kdc !include ../windows/NTMakefile.w32 +BINPROGRAMS=$(BINDIR)\string2key.exe + +SBINPROGRAMS=$(SBINDIR)\kstash.exe + +LIBEXECPROGRAMS=$(LIBEXECDIR)\hprop.exe $(LIBEXECDIR)\hpropd.exe $(LIBEXECDIR)\kdc.exe + +NOINST_PROGRAMS=$(OBJ)\kdc-replay.exe + +INCFILES=\ + $(INCDIR)\kdc.h \ + $(INCDIR)\kdc-protos.h \ + $(INCDIR)\kdc-private.h \ + $(INCDIR)\krb5\windc_plugin.h + +all:: $(INCFILES) $(LIBKDC) $(BINPROGRAMS) $(SBINPROGRAMS) $(LIBEXECPROGRAMS) + +clean:: + -$(RM) $(LIBKDC) + -$(RM) $(BINPROGRAMS) $(SBINPROGRAMS) $(LIBEXECPROGRAMS) + +BIN_LIBS=\ + $(LIBHDB) \ + $(LIBKRB5) \ + $(LIBHCRYPTO) \ + $(LIBASN1) \ + $(LIBROKEN) \ + $(LIBVERS) + +$(LIBEXECDIR)\hprop.exe: $(OBJ)\hprop.obj $(OBJ)\mit_dump.obj $(BIN_LIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +!ifdef KRB4 +$(LIBEXECDIR)\hprop.exe: $(OBJ)\v4_dump.obj +!endif + + +$(LIBEXECDIR)\hpropd.exe: $(OBJ)\hpropd.obj $(BIN_LIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(SBINDIR)\kstash.exe: $(OBJ)\kstash.obj $(BIN_LIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(BINDIR)\string2key.exe: $(OBJ)\string2key.obj $(BIN_LIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(LIBEXECDIR)\kdc.exe: $(OBJ)\connect.obj $(OBJ)\config.obj $(OBJ)\main.obj $(LIBKDC) $(BIN_LIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +LIBKDC_OBJS=\ + $(OBJ)\default_config.obj \ + $(OBJ)\set_dbinfo.obj \ + $(OBJ)\digest.obj \ + $(OBJ)\kerberos5.obj \ + $(OBJ)\krb5tgs.obj \ + $(OBJ)\pkinit.obj \ + $(OBJ)\log.obj \ + $(OBJ)\misc.obj \ + $(OBJ)\kaserver.obj \ + $(OBJ)\kx509.obj \ + $(OBJ)\process.obj \ + $(OBJ)\windc.obj + +!ifdef KRB4 +LIBKDC_OBJS=$(LIBKDC_OBJS) \ + $(OBJ)\524.obj \ + $(OBJ)\kerberos4.obj +!endif + +LIBKDC_LIBS=\ + $(LIBHDB) \ + $(LIBKRB5) \ + $(LIBHEIMNTLM) \ + $(LIBHCRYPTO) \ + $(LIBASN1) \ + $(LIBROKEN) + +!ifdef PKINIT +LIBKDC_LIBS=$(LIBKDC_LIBS) $(LIBHX509) +!endif + +$(LIBEXECDIR)\libkdc.dll: $(LIBKDC_OBJS) $(LIBKDC_LIBS) + $(DLLGUILINK) -implib:$(LIBKDC) -def:libkdc-exports.def + $(_VC_MANIFEST_EMBED_DLL) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(LIBKDC): $(LIBEXECDIR)\libkdc.dll + +libkdc_la_SOURCES = \ + default_config.c \ + set_dbinfo.c \ + digest.c \ + kdc_locl.h \ + kerberos5.c \ + krb5tgs.c \ + pkinit.c \ + log.c \ + misc.c \ + kaserver.c \ + kx509.c \ + process.c \ + windc.c \ + rx.h + +!ifdef KRB4 +libkdc_la_SOURCES=$(libkdc_la_SOURCES) \ + 524.c \ + kerberos4.c +!endif + +$(OBJ)\kdc-protos.h: $(libkdc_la_SOURCES) + $(PERL) ..\cf\make-proto.pl -q -P remove -o $@ $(libkdc_la_SOURCES) \ + || $(RM) $@ + +$(OBJ)\kdc-private.h: $(libkdc_la_SOURCES) + $(PERL) ..\cf\make-proto.pl -q -P remove -p $@ $(libkdc_la_SOURCES) \ + || $(RM) $@ diff --git a/kdc/libkdc-exports.def b/kdc/libkdc-exports.def new file mode 100644 index 000000000..b3ace1c1a --- /dev/null +++ b/kdc/libkdc-exports.def @@ -0,0 +1,12 @@ +EXPORTS + kdc_log + kdc_log_msg + kdc_log_msg_va + kdc_openlog + krb5_kdc_windc_init + krb5_kdc_get_config + krb5_kdc_set_dbinfo + krb5_kdc_process_krb5_request + krb5_kdc_process_request + krb5_kdc_save_request + krb5_kdc_update_time From a70de39e9c4c41cd234251b1b717f7626aeef46d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:44:05 -0400 Subject: [PATCH 062/134] Update exports.def and build rules for lib/asn1 The previous rules didn't export all the symbols we needed. --- lib/asn1/NTMakefile | 39 +++++---- lib/asn1/libasn1-exports.def | 158 +++++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+), 14 deletions(-) diff --git a/lib/asn1/NTMakefile b/lib/asn1/NTMakefile index 8f5df0b15..a26316be7 100644 --- a/lib/asn1/NTMakefile +++ b/lib/asn1/NTMakefile @@ -543,19 +543,33 @@ LIBASN1_LIBS=\ $(LIBROKEN) \ $(LIBCOMERR) +!ifndef STATICLIBS + $(LIBASN1): $(BINDIR)\libasn1.dll -$(BINDIR)\libasn1.dll: $(LIBASN1_OBJS) - $(DLLGUILINK_C) /OUT:$@ /DEF:libasn1-exports.def /IMPLIB:$(LIBASN1) $(LIBASN1_LIBS) @<< +$(BINDIR)\libasn1.dll: $(LIBASN1_OBJS) $(LIBASN1_LIBS) + $(DLLGUILINK_C) -out:$@ -def:libasn1-exports.def -implib:$(LIBASN1) @<< $(**: = ) << $(DLLPREP) clean:: - -$(RM) $(LIBASN1) -$(RM) $(BINDIR)\libasn1.dll +!else + +$(LIBASN1): $(LIBASN1_OBJS) + $(LIBCON_C) -out:$@ @<< +$(**: = +) +<< + +!endif + +clean:: + -$(RM) $(LIBASN1) + # # Generate list of exports # @@ -588,15 +602,10 @@ $(gen_files_cms:.x=.c) : $$(@R).x $(gen_files_test:.x=.c) : $$(@R).x -$(gen_files_k5) $(OBJ)\krb5_asn1.hx: $(BINDIR)\asn1_compile.exe krb5.asn1 +$(gen_files_k5) $(OBJ)\krb5_asn1.hx: $(BINDIR)\asn1_compile.exe krb5.asn1 krb5.opt cd $(OBJ) $(BINDIR)\asn1_compile.exe \ - --encode-rfc1510-bit-string \ - --sequence=KRB5SignedPathPrincipals \ - --sequence=AuthorizationData \ - --sequence=METHOD-DATA \ - --sequence=ETYPE-INFO \ - --sequence=ETYPE-INFO2 \ + --option-file=$(SRCDIR)\krb5.opt \ $(SRCDIR)\krb5.asn1 krb5_asn1 \ || ($(RM) $(OBJ)\krb5_asn1.h ; exit /b 1) cd $(SRCDIR) @@ -647,12 +656,14 @@ $(gen_files_rfc2459) $(OBJ)\rfc2459_asn1.hx: $(BINDIR)\asn1_compile.exe rfc2459. --sequence=Extensions \ --sequence=CRLDistributionPoints \ $(SRCDIR)\rfc2459.asn1 rfc2459_asn1 \ - || ($(RM) $(OBJ)\krb5_asn1.h ; exit /b 1) + || ($(RM) $(OBJ)\rfc2459_asn1.h ; exit /b 1) cd $(SRCDIR) -$(gen_files_cms) $(OBJ)\cms_asn1.hx: $(BINDIR)\asn1_compile.exe cms.asn1 +$(gen_files_cms) $(OBJ)\cms_asn1.hx: $(BINDIR)\asn1_compile.exe cms.asn1 cms.opt cd $(OBJ) - $(BINDIR)\asn1_compile.exe $(SRCDIR)\CMS.asn1 cms_asn1 \ + $(BINDIR)\asn1_compile.exe \ + --option-file=$(SRCDIR)\cms.opt \ + $(SRCDIR)\cms.asn1 cms_asn1 \ || ($(RM) $(OBJ)\cms_asn1.h ; exit /b 1) cd $(SRCDIR) @@ -703,7 +714,7 @@ $(OBJ)\der-protos.h: $(libasn1_SOURCES:der-protos.h=) clean:: -$(RM) $(INCDIR)\der-protos.h -all:: $(INCFILES) $(ASN1_BINARIES) $(GENINCFILES) $(LIBASN1) +all:: $(INCFILES) $(GENINCFILES) $(ASN1_BINARIES) $(LIBASN1) TEST_BINARIES=\ $(OBJ)\check-der.exe \ diff --git a/lib/asn1/libasn1-exports.def b/lib/asn1/libasn1-exports.def index 293961c83..6f753be54 100644 --- a/lib/asn1/libasn1-exports.def +++ b/lib/asn1/libasn1-exports.def @@ -415,116 +415,227 @@ EXPORTS free_Version length_Version copy_Version + asn1_oid_id_Userid oid_id_Userid + asn1_oid_id_aes_128_cbc oid_id_aes_128_cbc + asn1_oid_id_aes_192_cbc oid_id_aes_192_cbc + asn1_oid_id_aes_256_cbc oid_id_aes_256_cbc + asn1_oid_id_at_commonName oid_id_at_commonName + asn1_oid_id_at_countryName oid_id_at_countryName + asn1_oid_id_at_generationQualifier oid_id_at_generationQualifier + asn1_oid_id_at_givenName oid_id_at_givenName + asn1_oid_id_at_initials oid_id_at_initials + asn1_oid_id_at_localityName oid_id_at_localityName + asn1_oid_id_at_name oid_id_at_name + asn1_oid_id_at_organizationName oid_id_at_organizationName + asn1_oid_id_at_organizationalUnitName oid_id_at_organizationalUnitName + asn1_oid_id_at_pseudonym oid_id_at_pseudonym + asn1_oid_id_at_serialNumber oid_id_at_serialNumber + asn1_oid_id_at_stateOrProvinceName oid_id_at_stateOrProvinceName + asn1_oid_id_at_streetAddress oid_id_at_streetAddress + asn1_oid_id_at_surname oid_id_at_surname + asn1_oid_id_dhpublicnumber oid_id_dhpublicnumber + asn1_oid_id_domainComponent oid_id_domainComponent + asn1_oid_id_dsa oid_id_dsa + asn1_oid_id_dsa_with_sha1 oid_id_dsa_with_sha1 + asn1_oid_id_ecDH oid_id_ecDH + asn1_oid_id_ecMQV oid_id_ecMQV + asn1_oid_id_ecPublicKey oid_id_ecPublicKey + asn1_oid_id_ec_group_secp160r1 oid_id_ec_group_secp160r1 + asn1_oid_id_ec_group_secp160r2 oid_id_ec_group_secp160r2 + asn1_oid_id_ec_group_secp256r1 oid_id_ec_group_secp256r1 + asn1_oid_id_ecdsa_with_SHA1 oid_id_ecdsa_with_SHA1 + asn1_oid_id_ecdsa_with_SHA256 oid_id_ecdsa_with_SHA256 + asn1_oid_id_heim_rsa_pkcs1_x509 oid_id_heim_rsa_pkcs1_x509 + asn1_oid_id_ms_cert_enroll_domaincontroller oid_id_ms_cert_enroll_domaincontroller + asn1_oid_id_ms_client_authentication oid_id_ms_client_authentication + asn1_oid_id_netscape oid_id_netscape + asn1_oid_id_netscape_cert_comment oid_id_netscape_cert_comment + asn1_oid_id_nistAlgorithm oid_id_nistAlgorithm + asn1_oid_id_nist_aes_algs oid_id_nist_aes_algs + asn1_oid_id_nist_sha_algs oid_id_nist_sha_algs + asn1_oid_id_pkcs1_md2WithRSAEncryption oid_id_pkcs1_md2WithRSAEncryption + asn1_oid_id_pkcs1_md5WithRSAEncryption oid_id_pkcs1_md5WithRSAEncryption + asn1_oid_id_pkcs1_rsaEncryption oid_id_pkcs1_rsaEncryption + asn1_oid_id_pkcs1_sha1WithRSAEncryption oid_id_pkcs1_sha1WithRSAEncryption + asn1_oid_id_pkcs1_sha256WithRSAEncryption oid_id_pkcs1_sha256WithRSAEncryption + asn1_oid_id_pkcs1_sha384WithRSAEncryption oid_id_pkcs1_sha384WithRSAEncryption + asn1_oid_id_pkcs1_sha512WithRSAEncryption oid_id_pkcs1_sha512WithRSAEncryption + asn1_oid_id_pkcs2_md2 oid_id_pkcs2_md2 + asn1_oid_id_pkcs2_md4 oid_id_pkcs2_md4 + asn1_oid_id_pkcs2_md5 oid_id_pkcs2_md5 + asn1_oid_id_pkcs3_des_ede3_cbc oid_id_pkcs3_des_ede3_cbc + asn1_oid_id_pkcs3_rc2_cbc oid_id_pkcs3_rc2_cbc + asn1_oid_id_pkcs3_rc4 oid_id_pkcs3_rc4 + asn1_oid_id_pkcs_1 oid_id_pkcs_1 + asn1_oid_id_pkcs_2 oid_id_pkcs_2 + asn1_oid_id_pkcs_3 oid_id_pkcs_3 + asn1_oid_id_pkix oid_id_pkix + asn1_oid_id_pkix_kp oid_id_pkix_kp + asn1_oid_id_pkix_kp_OCSPSigning oid_id_pkix_kp_OCSPSigning + asn1_oid_id_pkix_kp_clientAuth oid_id_pkix_kp_clientAuth + asn1_oid_id_pkix_kp_emailProtection oid_id_pkix_kp_emailProtection + asn1_oid_id_pkix_kp_serverAuth oid_id_pkix_kp_serverAuth + asn1_oid_id_pkix_kp_timeStamping oid_id_pkix_kp_timeStamping + asn1_oid_id_pkix_on oid_id_pkix_on + asn1_oid_id_pkix_on_dnsSRV oid_id_pkix_on_dnsSRV + asn1_oid_id_pkix_on_xmppAddr oid_id_pkix_on_xmppAddr + asn1_oid_id_pkix_pe oid_id_pkix_pe + asn1_oid_id_pkix_pe_authorityInfoAccess oid_id_pkix_pe_authorityInfoAccess + asn1_oid_id_pkix_pe_proxyCertInfo oid_id_pkix_pe_proxyCertInfo + asn1_oid_id_pkix_ppl oid_id_pkix_ppl + asn1_oid_id_pkix_ppl_anyLanguage oid_id_pkix_ppl_anyLanguage + asn1_oid_id_pkix_ppl_independent oid_id_pkix_ppl_independent + asn1_oid_id_pkix_ppl_inheritAll oid_id_pkix_ppl_inheritAll + asn1_oid_id_rsa_digestAlgorithm oid_id_rsa_digestAlgorithm + asn1_oid_id_rsa_digest_md2 oid_id_rsa_digest_md2 + asn1_oid_id_rsa_digest_md4 oid_id_rsa_digest_md4 + asn1_oid_id_rsa_digest_md5 oid_id_rsa_digest_md5 + asn1_oid_id_rsadsi_des_ede3_cbc oid_id_rsadsi_des_ede3_cbc + asn1_oid_id_rsadsi_encalg oid_id_rsadsi_encalg + asn1_oid_id_rsadsi_rc2_cbc oid_id_rsadsi_rc2_cbc + asn1_oid_id_secsig_sha_1 oid_id_secsig_sha_1 + asn1_oid_id_sha224 oid_id_sha224 + asn1_oid_id_sha256 oid_id_sha256 + asn1_oid_id_sha384 oid_id_sha384 + asn1_oid_id_sha512 oid_id_sha512 + asn1_oid_id_uspkicommon_card_id oid_id_uspkicommon_card_id + asn1_oid_id_uspkicommon_piv_interim oid_id_uspkicommon_piv_interim + asn1_oid_id_x509_ce oid_id_x509_ce + asn1_oid_id_x509_ce_authorityKeyIdentifier oid_id_x509_ce_authorityKeyIdentifier + asn1_oid_id_x509_ce_basicConstraints oid_id_x509_ce_basicConstraints + asn1_oid_id_x509_ce_cRLDistributionPoints oid_id_x509_ce_cRLDistributionPoints + asn1_oid_id_x509_ce_cRLNumber oid_id_x509_ce_cRLNumber + asn1_oid_id_x509_ce_cRLReason oid_id_x509_ce_cRLReason + asn1_oid_id_x509_ce_certificateIssuer oid_id_x509_ce_certificateIssuer + asn1_oid_id_x509_ce_certificatePolicies oid_id_x509_ce_certificatePolicies + asn1_oid_id_x509_ce_deltaCRLIndicator oid_id_x509_ce_deltaCRLIndicator + asn1_oid_id_x509_ce_extKeyUsage oid_id_x509_ce_extKeyUsage + asn1_oid_id_x509_ce_freshestCRL oid_id_x509_ce_freshestCRL + asn1_oid_id_x509_ce_holdInstructionCode oid_id_x509_ce_holdInstructionCode + asn1_oid_id_x509_ce_inhibitAnyPolicy oid_id_x509_ce_inhibitAnyPolicy + asn1_oid_id_x509_ce_invalidityDate oid_id_x509_ce_invalidityDate + asn1_oid_id_x509_ce_issuerAltName oid_id_x509_ce_issuerAltName + asn1_oid_id_x509_ce_issuingDistributionPoint oid_id_x509_ce_issuingDistributionPoint + asn1_oid_id_x509_ce_keyUsage oid_id_x509_ce_keyUsage + asn1_oid_id_x509_ce_nameConstraints oid_id_x509_ce_nameConstraints + asn1_oid_id_x509_ce_policyConstraints oid_id_x509_ce_policyConstraints + asn1_oid_id_x509_ce_policyMappings oid_id_x509_ce_policyMappings + asn1_oid_id_x509_ce_privateKeyUsagePeriod oid_id_x509_ce_privateKeyUsagePeriod + asn1_oid_id_x509_ce_subjectAltName oid_id_x509_ce_subjectAltName + asn1_oid_id_x509_ce_subjectDirectoryAttributes oid_id_x509_ce_subjectDirectoryAttributes + asn1_oid_id_x509_ce_subjectKeyIdentifier oid_id_x509_ce_subjectKeyIdentifier + asn1_oid_id_x520_at oid_id_x520_at + asn1_oid_id_x9_57 oid_id_x9_57 encode_CMSAttributes decode_CMSAttributes @@ -691,12 +802,19 @@ EXPORTS free_SignerInfos length_SignerInfos copy_SignerInfos + asn1_oid_id_pkcs7 oid_id_pkcs7 + asn1_oid_id_pkcs7_data oid_id_pkcs7_data + asn1_oid_id_pkcs7_digestedData oid_id_pkcs7_digestedData + asn1_oid_id_pkcs7_encryptedData oid_id_pkcs7_encryptedData + asn1_oid_id_pkcs7_envelopedData oid_id_pkcs7_envelopedData + asn1_oid_id_pkcs7_signedAndEnvelopedData oid_id_pkcs7_signedAndEnvelopedData + asn1_oid_id_pkcs7_signedData oid_id_pkcs7_signedData encode_UnprotectedAttributes decode_UnprotectedAttributes @@ -1072,6 +1190,8 @@ EXPORTS free_Principals length_Principals copy_Principals + add_Principals + remove_Principals encode_Realm decode_Realm free_Realm @@ -1143,18 +1263,31 @@ EXPORTS free_KRB5SignedPath length_KRB5SignedPath copy_KRB5SignedPath + asn1_oid_id_pkinit oid_id_pkinit + asn1_oid_id_pkauthdata oid_id_pkauthdata + asn1_oid_id_pkdhkeydata oid_id_pkdhkeydata + asn1_oid_id_pkrkeydata oid_id_pkrkeydata + asn1_oid_id_pkekuoid oid_id_pkekuoid + asn1_oid_id_pkkdcekuoid oid_id_pkkdcekuoid + asn1_oid_id_pkinit_san oid_id_pkinit_san + asn1_oid_id_pkinit_ms_eku oid_id_pkinit_ms_eku + asn1_oid_id_pkinit_ms_san oid_id_pkinit_ms_san + asn1_oid_id_pkinit_kdf oid_id_pkinit_kdf + asn1_oid_id_pkinit_kdf_ah_sha1 oid_id_pkinit_kdf_ah_sha1 + asn1_oid_id_pkinit_kdf_ah_sha256 oid_id_pkinit_kdf_ah_sha256 + asn1_oid_id_pkinit_kdf_ah_sha512 oid_id_pkinit_kdf_ah_sha512 encode_MS_UPN_SAN decode_MS_UPN_SAN @@ -1326,15 +1459,25 @@ EXPORTS free_PKCS8EncryptedData length_PKCS8EncryptedData copy_PKCS8EncryptedData + asn1_oid_id_pkcs_9 oid_id_pkcs_9 + asn1_oid_id_pkcs9_contentType oid_id_pkcs9_contentType + asn1_oid_id_pkcs9_emailAddress oid_id_pkcs9_emailAddress + asn1_oid_id_pkcs9_messageDigest oid_id_pkcs9_messageDigest + asn1_oid_id_pkcs9_signingTime oid_id_pkcs9_signingTime + asn1_oid_id_pkcs9_countersignature oid_id_pkcs9_countersignature + asn1_oid_id_pkcs_9_at_friendlyName oid_id_pkcs_9_at_friendlyName + asn1_oid_id_pkcs_9_at_localKeyId oid_id_pkcs_9_at_localKeyId + asn1_oid_id_pkcs_9_at_certTypes oid_id_pkcs_9_at_certTypes + asn1_oid_id_pkcs_9_at_certTypes_x509 oid_id_pkcs_9_at_certTypes_x509 encode_PKCS9_BMPString decode_PKCS9_BMPString @@ -1346,20 +1489,35 @@ EXPORTS free_PKCS9_friendlyName length_PKCS9_friendlyName copy_PKCS9_friendlyName + asn1_oid_id_pkcs_12 oid_id_pkcs_12 + asn1_oid_id_pkcs_12PbeIds oid_id_pkcs_12PbeIds + asn1_oid_id_pbeWithSHAAnd128BitRC4 oid_id_pbeWithSHAAnd128BitRC4 + asn1_oid_id_pbeWithSHAAnd40BitRC4 oid_id_pbeWithSHAAnd40BitRC4 + asn1_oid_id_pbeWithSHAAnd3_KeyTripleDES_CBC oid_id_pbeWithSHAAnd3_KeyTripleDES_CBC + asn1_oid_id_pbeWithSHAAnd2_KeyTripleDES_CBC oid_id_pbeWithSHAAnd2_KeyTripleDES_CBC + asn1_oid_id_pbeWithSHAAnd128BitRC2_CBC oid_id_pbeWithSHAAnd128BitRC2_CBC + asn1_oid_id_pbewithSHAAnd40BitRC2_CBC oid_id_pbewithSHAAnd40BitRC2_CBC + asn1_oid_id_pkcs12_bagtypes oid_id_pkcs12_bagtypes + asn1_oid_id_pkcs12_keyBag oid_id_pkcs12_keyBag + asn1_oid_id_pkcs12_pkcs8ShroudedKeyBag oid_id_pkcs12_pkcs8ShroudedKeyBag + asn1_oid_id_pkcs12_certBag oid_id_pkcs12_certBag + asn1_oid_id_pkcs12_crlBag oid_id_pkcs12_crlBag + asn1_oid_id_pkcs12_secretBag oid_id_pkcs12_secretBag + asn1_oid_id_pkcs12_safeContentsBag oid_id_pkcs12_safeContentsBag encode_PKCS12_MacData decode_PKCS12_MacData From 59ae14e8147e9393b6914fab68bfba19c77591fc Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:44:32 -0400 Subject: [PATCH 063/134] Consistency fixes for lib/com_err --- lib/com_err/NTMakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/com_err/NTMakefile b/lib/com_err/NTMakefile index fe8adb151..686b583af 100644 --- a/lib/com_err/NTMakefile +++ b/lib/com_err/NTMakefile @@ -49,9 +49,9 @@ $(LIBCOMERR): $(libcomerr_OBJs) $(LIBCOMERR): $(COMERRDLL) $(COMERRDLL): $(libcomerr_OBJs) $(OBJ)\libcom_err-version.res - $(DLLGUILINK_C) -OUT:$(COMERRDLL) -IMPLIB:$(LIBCOMERR) $** \ + $(DLLGUILINK_C) -out:$(COMERRDLL) -implib:$(LIBCOMERR) $** \ $(LIBROKEN) \ - -DEF:libcom_err-exports.def + -def:libcom_err-exports.def $(_VC_MANIFEST_EMBED_DLL) $(_VC_MANIFEST_CLEAN) $(_CODESIGN) From 988792b3f70ba4f9a94e28b28f6e0b69c02f86ab Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:45:10 -0400 Subject: [PATCH 064/134] Build system update for lib/gssapi and new exports.def --- lib/gssapi/NTMakefile | 21 ++++--- lib/gssapi/libgssapi-exports.def | 100 +++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+), 8 deletions(-) create mode 100644 lib/gssapi/libgssapi-exports.def diff --git a/lib/gssapi/NTMakefile b/lib/gssapi/NTMakefile index 4fdc275ee..61eb31ab8 100644 --- a/lib/gssapi/NTMakefile +++ b/lib/gssapi/NTMakefile @@ -244,6 +244,10 @@ $(OBJ)\gkrb5_err.c $(OBJ)\gkrb5_err.h: krb5\gkrb5_err.et INCFILES= \ $(INCDIR)\gssapi.h \ + $(INCDIR)\gssapi\gssapi.h \ + $(INCDIR)\gssapi\gssapi_krb5.h \ + $(INCDIR)\gssapi\gssapi_ntlm.h \ + $(INCDIR)\gssapi\gssapi_spnego.h \ $(OBJ)\ntlm\ntlm-private.h \ $(OBJ)\spnego\spnego-private.h \ $(OBJ)\krb5\gsskrb5-private.h \ @@ -439,6 +443,9 @@ GCOPTS=-I$(SRCDIR) -I$(OBJ) -Igssapi -DBUILD_GSSAPI_LIB {$(OBJ)\gssapi}.x{$(OBJ)\gssapi}.c: $(CP) $** $@ +{gssapi}.h{$(INCDIR)\gssapi}.h: + $(CP) $** $@ + LIBGSSAPI_LIBS=\ $(LIBROKEN) \ $(LIBASN1) \ @@ -452,11 +459,10 @@ LIBGSSAPI_SDKLIBS=\ !ifndef STATICLIBS -$(LIBGSSAPI): $(BINDIR)\libgssapi.dll - $(BINDIR)\libgssapi.dll: $(libgssapi_OBJs) - $(DLLGUILINK_C) -IMPLIB:$(LIBGSSAPI) \ - -OUT:$(BINDIR)\libgssapi.dll \ + $(DLLGUILINK_C) -implib:$(LIBGSSAPI) \ + -out:$(BINDIR)\libgssapi.dll \ + -def:libgssapi-exports.def \ $(LIBGSSAPI_LIBS) $(LIBGSSAPI_SDKLIBS) @<< $(libgssapi_OBJs: = ) @@ -465,11 +471,10 @@ $(libgssapi_OBJs: = $(_VC_MANIFEST_CLEAN) $(_CODESIGN) -all:: $(BINDIR)\libgssapi.dll +$(LIBGSSAPI): $(BINDIR)\libgssapi.dll clean:: -$(RM) $(BINDIR)\libgssapi.dll - -$(RM) $(LIBGSSAPI) !else @@ -479,13 +484,13 @@ $(libgssapi_OBJs: = ) << +!endif + all:: $(LIBGSSAPI) clean:: -$(RM) $(LIBGSSAPI) -!endif - prep:: mkdirs-gss mkdirs-gss: diff --git a/lib/gssapi/libgssapi-exports.def b/lib/gssapi/libgssapi-exports.def new file mode 100644 index 000000000..0ba34c861 --- /dev/null +++ b/lib/gssapi/libgssapi-exports.def @@ -0,0 +1,100 @@ +EXPORTS + GSS_KRB5_MECHANISM + GSS_NTLM_MECHANISM + GSS_SPNEGO_MECHANISM + GSS_SASL_DIGEST_MD5_MECHANISM + GSS_C_NT_ANONYMOUS + GSS_C_NT_EXPORT_NAME + GSS_C_NT_HOSTBASED_SERVICE + GSS_C_NT_HOSTBASED_SERVICE_X + GSS_C_NT_MACHINE_UID_NAME + GSS_C_NT_STRING_UID_NAME + GSS_C_NT_USER_NAME + GSS_KRB5_NT_PRINCIPAL_NAME + GSS_KRB5_NT_USER_NAME + GSS_KRB5_NT_MACHINE_UID_NAME + GSS_KRB5_NT_STRING_UID_NAME + gss_accept_sec_context + gss_acquire_cred + gss_add_buffer_set_member + gss_add_cred + gss_add_oid_set_member + gss_canonicalize_name + gss_compare_name + gss_context_query_attributes + gss_context_time + gss_create_empty_buffer_set + gss_create_empty_oid_set + gss_decapsulate_token + gss_delete_sec_context + gss_display_name + gss_display_status + gss_duplicate_name + gss_duplicate_oid + gss_encapsulate_token + gss_export_name + gss_export_sec_context + gss_get_mic + gss_import_name + gss_import_sec_context + gss_indicate_mechs + gss_init_sec_context + gss_inquire_context + gss_inquire_cred + gss_inquire_cred_by_mech + gss_inquire_cred_by_oid + gss_inquire_mechs_for_name + gss_inquire_names_for_mech + gss_inquire_sec_context_by_oid + gss_inquire_sec_context_by_oid + gss_krb5_ccache_name + gss_krb5_copy_ccache + gss_krb5_export_lucid_sec_context + gss_krb5_free_lucid_sec_context + gss_krb5_get_tkt_flags + gss_krb5_import_cred + gss_krb5_set_allowable_enctypes + gss_mg_collect_error + gss_oid_equal + gss_oid_to_str + gss_process_context_token + gss_pseudo_random + gss_release_buffer + gss_release_buffer_set + gss_release_cred + gss_release_iov_buffer + gss_release_name + gss_release_oid + gss_release_oid_set + gss_seal + gss_set_cred_option + gss_set_sec_context_option + gss_sign + gss_test_oid_set_member + gss_unseal + gss_unwrap + gss_unwrap_iov + gss_verify + gss_verify_mic + gss_wrap + gss_wrap_iov + gss_wrap_iov_length + gss_wrap_size_limit + gsskrb5_extract_authtime_from_sec_context + gsskrb5_extract_authz_data_from_sec_context + gsskrb5_extract_service_keyblock + gsskrb5_get_initiator_subkey + gsskrb5_get_subkey + gsskrb5_get_time_offset + gsskrb5_register_acceptor_identity + gsskrb5_set_default_realm + gsskrb5_set_dns_canonicalize + gsskrb5_set_send_to_kdc + gsskrb5_set_time_offset + krb5_gss_register_acceptor_identity + +; _gsskrb5cfx_ are really internal symbols, but export +; then now to make testing easier. + _gsskrb5cfx_wrap_length_cfx + _gssapi_wrap_size_cfx + From 348bd51d0aa1ff3b2a216f98cf191a2c713e3271 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:45:57 -0400 Subject: [PATCH 065/134] Build libhrypto as a .dll by default --- lib/hcrypto/NTMakefile | 12 ++ lib/hcrypto/libhcrypto-exports.def | 246 +++++++++++++++++++++++++++++ 2 files changed, 258 insertions(+) create mode 100644 lib/hcrypto/libhcrypto-exports.def diff --git a/lib/hcrypto/NTMakefile b/lib/hcrypto/NTMakefile index 85aa180f3..de9b9ed84 100644 --- a/lib/hcrypto/NTMakefile +++ b/lib/hcrypto/NTMakefile @@ -109,9 +109,21 @@ libhcrypt_OBJs = \ $(OBJ)\sha256.obj \ $(OBJ)\ui.obj +!ifndef STATICLIBS + +$(LIBHCRYPTO): $(BINDIR)\libhcrypto.dll + +$(BINDIR)\libhcrypto.dll: $(libhcrypt_OBJs) $(LIBROKEN) $(LIBASN1) + $(DLLGUILINK) -def:libhcrypto-exports.def -implib:$(LIBHCRYPTO) + $(DLLPREP) + +!else + $(LIBHCRYPTO): $(libhcrypt_OBJs) $(LIBCON) +!endif + {imath/}.c{$(OBJ)}.obj: $(C2OBJ) diff --git a/lib/hcrypto/libhcrypto-exports.def b/lib/hcrypto/libhcrypto-exports.def new file mode 100644 index 000000000..1e32eace1 --- /dev/null +++ b/lib/hcrypto/libhcrypto-exports.def @@ -0,0 +1,246 @@ +EXPORTS + hc_AES_cbc_encrypt + hc_AES_decrypt + hc_AES_decrypt_key + hc_BN_CTX_end + hc_BN_CTX_free + hc_BN_CTX_get + hc_BN_CTX_new + hc_BN_CTX_start + hc_AES_encrypt + hc_AES_set_encrypt_key + hc_BN_GENCB_call + hc_BN_GENCB_set + hc_BN_bin2bn + hc_BN_bn2bin + hc_BN_bn2hex + hc_BN_clear + hc_BN_clear_bit + hc_BN_clear_free + hc_BN_cmp + hc_BN_dup + hc_BN_free + hc_BN_get_word + hc_BN_hex2bn + hc_BN_is_bit_set + hc_BN_is_negative + hc_BN_new + hc_BN_num_bits + hc_BN_num_bytes + hc_BN_rand + hc_BN_set_bit + hc_BN_set_negative + hc_BN_set_word + hc_BN_uadd + hc_DES_cbc_cksum + hc_DES_cbc_encrypt + hc_DES_cfb64_encrypt + hc_DES_check_key_parity + hc_DES_ecb3_encrypt + hc_DES_ecb_encrypt + hc_DES_ede3_cbc_encrypt + hc_DES_encrypt + hc_DES_generate_random_block + hc_DES_init_random_number_generator + hc_DES_is_weak_key + hc_DES_key_sched +; hc_DES_mem_rand8 + hc_DES_new_random_key + hc_DES_pcbc_encrypt + hc_DES_rand_data + hc_DES_rand_data_key + hc_DES_random_key + hc_DES_read_password + hc_DES_set_key + hc_DES_set_key_checked + hc_DES_set_key_unchecked + hc_DES_set_odd_parity + hc_DES_set_random_generator_seed + hc_DES_set_sequence_number + hc_DES_string_to_key + hc_DH_check_pubkey + hc_DH_compute_key + hc_DH_free + hc_DH_generate_key + hc_DH_generate_parameters_ex + hc_DH_get_default_method + hc_DH_get_ex_data + hc_DH_imath_method +; hc_DH_gmp_method + hc_DH_new + hc_DH_new_method + hc_DH_null_method + hc_DH_set_default_method + hc_DH_set_ex_data + hc_DH_set_method + hc_DH_size + hc_DH_up_ref + hc_DSA_free + hc_DSA_get_default_method + hc_DSA_new + hc_DSA_null_method + hc_DSA_set_default_method + hc_DSA_up_ref + hc_DSA_verify + hc_ENGINE_add_conf_module + hc_ENGINE_by_dso + hc_ENGINE_by_id + hc_ENGINE_finish + hc_ENGINE_get_DH + hc_ENGINE_get_RAND + hc_ENGINE_get_RSA + hc_ENGINE_get_default_DH + hc_ENGINE_get_default_RSA + hc_ENGINE_get_id + hc_ENGINE_get_name + hc_ENGINE_load_builtin_engines + hc_ENGINE_set_DH + hc_ENGINE_set_RSA + hc_ENGINE_set_default_DH + hc_ENGINE_set_default_RSA + hc_ENGINE_set_destroy_function + hc_ENGINE_set_id + hc_ENGINE_set_name + hc_ENGINE_up_ref + hc_EVP_BytesToKey + hc_EVP_CIPHER_CTX_block_size + hc_EVP_CIPHER_CTX_cipher + hc_EVP_CIPHER_CTX_cleanup + hc_EVP_CIPHER_CTX_flags + hc_EVP_CIPHER_CTX_get_app_data + hc_EVP_CIPHER_CTX_init + hc_EVP_CIPHER_CTX_iv_length + hc_EVP_CIPHER_CTX_key_length + hc_EVP_CIPHER_CTX_mode + hc_EVP_CIPHER_CTX_set_app_data + hc_EVP_CIPHER_block_size + hc_EVP_CIPHER_iv_length + hc_EVP_CIPHER_key_length + hc_EVP_Cipher + hc_EVP_CipherInit_ex + hc_EVP_Digest + hc_EVP_DigestFinal_ex + hc_EVP_DigestInit_ex + hc_EVP_DigestUpdate + hc_EVP_MD_CTX_block_size + hc_EVP_MD_CTX_cleanup + hc_EVP_MD_CTX_cleanup + hc_EVP_MD_CTX_create + hc_EVP_MD_CTX_create + hc_EVP_MD_CTX_destroy + hc_EVP_MD_CTX_destroy + hc_EVP_MD_CTX_init + hc_EVP_MD_CTX_init + hc_EVP_MD_CTX_md + hc_EVP_MD_CTX_size + hc_EVP_MD_block_size + hc_EVP_MD_size + hc_EVP_aes_128_cbc + hc_EVP_aes_192_cbc + hc_EVP_aes_256_cbc + hc_EVP_hcrypto_aes_128_cbc + hc_EVP_hcrypto_aes_192_cbc + hc_EVP_hcrypto_aes_256_cbc + hc_EVP_hcrypto_aes_128_cts + hc_EVP_hcrypto_aes_256_cts +; hc_EVP_hcrypto_aes_cts_128_cbc +; hc_EVP_hcrypto_aes_cts_192_cbc +; hc_EVP_hcrypto_aes_cts_256_cbc + hc_EVP_des_cbc + hc_EVP_des_ede3_cbc + hc_EVP_camellia_128_cbc + hc_EVP_camellia_192_cbc + hc_EVP_camellia_256_cbc + hc_EVP_enc_null + hc_EVP_get_cipherbyname + hc_EVP_md2 + hc_EVP_md4 + hc_EVP_md5 + hc_EVP_md_null + hc_EVP_rc2_40_cbc + hc_EVP_rc2_64_cbc + hc_EVP_rc2_cbc + hc_EVP_rc4 + hc_EVP_rc4_40 + hc_EVP_sha + hc_EVP_sha1 + hc_EVP_sha256 + hc_HMAC + hc_HMAC_CTX_cleanup + hc_HMAC_CTX_init + hc_HMAC_Final + hc_HMAC_Init_ex + hc_HMAC_Update + hc_HMAC_size + hc_MD2_Final + hc_MD2_Init + hc_MD2_Update + hc_MD4_Final + hc_MD4_Init + hc_MD4_Update + hc_MD5_Final + hc_MD5_Init + hc_MD5_Update + hc_OpenSSL_add_all_algorithms + hc_OpenSSL_add_all_algorithms_conf + hc_OpenSSL_add_all_algorithms_noconf + hc_PKCS12_key_gen + hc_PKCS5_PBKDF2_HMAC_SHA1 + hc_RAND_add + hc_RAND_bytes + hc_RAND_cleanup +; hc_RAND_egd +; hc_RAND_egd_bytes +; hc_RAND_egd_method + hc_RAND_file_name + hc_RAND_fortuna_method + hc_RAND_get_rand_method + hc_RAND_load_file + hc_RAND_pseudo_bytes + hc_RAND_seed + hc_RAND_set_rand_engine + hc_RAND_set_rand_method + hc_RAND_status +; hc_RAND_unix_method +; hc_RAND_timer_method + hc_RAND_write_file + hc_RC2_cbc_encrypt + hc_RC2_decryptc + hc_RC2_encryptc + hc_RC2_set_key + hc_RC4 + hc_RC4_set_key + hc_RSA_check_key + hc_RSA_free + hc_RSA_generate_key_ex + hc_RSA_get_app_data + hc_RSA_get_default_method + hc_RSA_get_method + hc_RSA_imath_method + hc_RSA_new + hc_RSA_new_method + hc_RSA_null_method + hc_RSA_private_decrypt + hc_RSA_private_encrypt + hc_RSA_public_decrypt + hc_RSA_public_encrypt + hc_RSA_set_app_data + hc_RSA_set_default_method + hc_RSA_set_method + hc_RSA_sign + hc_RSA_size + hc_RSA_up_ref + hc_RSA_verify + hc_SHA1_Final + hc_SHA1_Init + hc_SHA1_Update + hc_SHA256_Final + hc_SHA256_Init + hc_SHA256_Update + hc_UI_UTIL_read_pw_string + hc_UI_UTIL_read_pw_string + hc_d2i_RSAPrivateKey + hc_i2d_RSAPrivateKey + hc_i2d_RSAPublicKey + hc_EVP_CIPHER_CTX_ctrl + hc_EVP_CIPHER_CTX_rand_key From 204789d408cfe801cec0f56abbcfa83ce3caa37d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:46:14 -0400 Subject: [PATCH 066/134] Build libhdb as a .dll by default --- lib/hdb/NTMakefile | 14 +++++- lib/hdb/libhdb-exports.def | 95 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 lib/hdb/libhdb-exports.def diff --git a/lib/hdb/NTMakefile b/lib/hdb/NTMakefile index fb8d2ab6b..963e136c3 100644 --- a/lib/hdb/NTMakefile +++ b/lib/hdb/NTMakefile @@ -66,7 +66,7 @@ ldap_lib = $(LIBDIR)\hdb_ldap.lib ldap_objs = $(OBJ)\hdb-ldap.obj $(ldap_dll): $(ldap_objs) - $(DLLGUILINK) -IMPLIB:$(ldap_lib) + $(DLLGUILINK) -implib:$(ldap_lib) $(_VC_MANIFEST_EMBED_DLL) $(_VC_MANIFEST_CLEAN) $(_CODESIGN) @@ -135,9 +135,21 @@ INCFILES=\ $(INCDIR)\hdb_err.h \ $(INCDIR)\hdb_asn1.h +!ifndef STATICLIBS + +$(LIBHDB): $(BINDIR)\libhdb.dll + +$(BINDIR)\libhdb.dll: $(libhdb_OBJs) $(ldap_lib) $(LIBKRB5) $(LIBASN1) $(LIBSQLITE) $(LIBCOMERR) $(LIBROKEN) + $(DLLGUILINK) -def:libhdb-exports.def -implib:$(LIBHDB) + $(DLLPREP) + +!else + $(LIBHDB): $(libhdb_OBJs) $(ldap_lib) $(LIBCON) +!endif + all:: $(INCFILES) $(LIBHDB) clean:: diff --git a/lib/hdb/libhdb-exports.def b/lib/hdb/libhdb-exports.def new file mode 100644 index 000000000..008088457 --- /dev/null +++ b/lib/hdb/libhdb-exports.def @@ -0,0 +1,95 @@ +EXPORTS + encode_hdb_keyset + hdb_add_master_key + hdb_check_db_format + hdb_clear_extension + hdb_clear_master_key + hdb_create + hdb_db_dir + hdb_dbinfo_get_acl_file + hdb_dbinfo_get_binding + hdb_dbinfo_get_dbname + hdb_dbinfo_get_label + hdb_dbinfo_get_log_file + hdb_dbinfo_get_mkey_file + hdb_dbinfo_get_next + hdb_dbinfo_get_realm + hdb_default_db + hdb_enctype2key + hdb_entry2string + hdb_entry2value + hdb_entry_alias2value + hdb_entry_check_mandatory + hdb_entry_clear_password + hdb_entry_get_ConstrainedDelegACL + hdb_entry_get_aliases + hdb_entry_get_password + hdb_entry_get_pkinit_acl + hdb_entry_get_pkinit_cert + hdb_entry_get_pkinit_hash + hdb_entry_get_pw_change_time + hdb_entry_set_password + hdb_entry_set_pw_change_time + hdb_find_extension + hdb_foreach + hdb_free_dbinfo + hdb_free_entry + hdb_free_key + hdb_free_keys + hdb_free_master_key + hdb_generate_key_set + hdb_generate_key_set_password + hdb_get_dbinfo + hdb_init_db + hdb_key2principal + hdb_list_builtin + hdb_lock + hdb_next_enctype2key + hdb_principal2key + hdb_print_entry + hdb_process_master_key + hdb_read_master_key + hdb_replace_extension + hdb_seal_key + hdb_seal_key_mkey + hdb_seal_keys + hdb_seal_keys_mkey + hdb_set_master_key + hdb_set_master_keyfile + hdb_unlock + hdb_unseal_key + hdb_unseal_key_mkey + hdb_unseal_keys + hdb_unseal_keys_mkey + hdb_value2entry + hdb_value2entry_alias + hdb_write_master_key + length_hdb_keyset + + hdb_kt_ops + +; some random bits needed for libkadm + copy_Event + copy_HDB_extensions + copy_Key + copy_Salt + decode_HDB_extension + encode_HDB_Ext_Aliases + free_Event + free_HDB_extension + free_HDB_extensions + free_Key + free_hdb_entry + asn1_HDBFlags_units + HDBFlags2int + int2HDBFlags + length_HDB_Ext_Aliases + decode_HDB_Ext_PKINIT_acl + free_HDB_Ext_PKINIT_acl + decode_HDB_Ext_Aliases + free_HDB_Ext_Aliases + length_HDB_extension + encode_HDB_extension + length_HDB_Ext_PKINIT_acl + encode_HDB_Ext_PKINIT_acl + From a79bf3464d4534a669c8c881fd34bb1fcf0ad39a Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:46:30 -0400 Subject: [PATCH 067/134] Build libhx509 as a .dll by default --- lib/hx509/NTMakefile | 12 ++ lib/hx509/libhx509-exports.def | 233 +++++++++++++++++++++++++++++++++ 2 files changed, 245 insertions(+) create mode 100644 lib/hx509/libhx509-exports.def diff --git a/lib/hx509/NTMakefile b/lib/hx509/NTMakefile index fe6bb59fc..bed0dacc8 100644 --- a/lib/hx509/NTMakefile +++ b/lib/hx509/NTMakefile @@ -103,9 +103,21 @@ libhx509_la_OBJS = \ $(gen_files_ocsp:.x=.obj) \ $(gen_files_pkcs10:.x=.obj) +!ifndef STATICLIBS + +$(LIBHX509): $(BINDIR)\libhx509.dll + +$(BINDIR)\libhx509.dll: $(libhx509_la_OBJS) $(LIBHCRYPTO) $(LIBASN1) $(LIBWIND) $(LIBROKEN) $(LIBCOMERR) + $(DLLGUILINK) -def:libhx509-exports.def -implib:$(LIBHX509) shell32.lib + $(DLLPREP) + +!else + $(LIBHX509): $(libhx509_la_OBJS) $(LIBCON) +!endif + dist_libhx509_la_SOURCES = \ $(SRCDIR)\ca.c \ $(SRCDIR)\cert.c \ diff --git a/lib/hx509/libhx509-exports.def b/lib/hx509/libhx509-exports.def new file mode 100644 index 000000000..6f32e492c --- /dev/null +++ b/lib/hx509/libhx509-exports.def @@ -0,0 +1,233 @@ +EXPORTS + _hx509_cert_assign_key + _hx509_cert_private_key + _hx509_certs_keys_free + _hx509_certs_keys_get + _hx509_expr_eval + _hx509_expr_free + _hx509_expr_parse + _hx509_generate_private_key + _hx509_generate_private_key_bits + _hx509_generate_private_key_free + _hx509_generate_private_key_init + _hx509_generate_private_key_is_ca + _hx509_map_file_os + _hx509_name_from_Name + _hx509_private_key2SPKI + _hx509_private_key_free + _hx509_private_key_ref + _hx509_request_add_dns_name + _hx509_request_add_email + _hx509_request_free + _hx509_request_get_SubjectPublicKeyInfo + _hx509_request_get_name + _hx509_request_init + _hx509_request_parse + _hx509_request_print + _hx509_request_set_SubjectPublicKeyInfo +; _hx509_request_set_email + _hx509_request_set_name + _hx509_request_to_pkcs10 + _hx509_request_to_pkcs10 + _hx509_unmap_file_os + _hx509_write_file + hx509_bitstring_print + hx509_ca_sign + hx509_ca_sign_self + hx509_ca_tbs_add_crl_dp_uri + hx509_ca_tbs_add_eku + hx509_ca_tbs_add_san_hostname + hx509_ca_tbs_add_san_jid + hx509_ca_tbs_add_san_ms_upn + hx509_ca_tbs_add_san_otherName + hx509_ca_tbs_add_san_pkinit + hx509_ca_tbs_add_san_rfc822name + hx509_ca_tbs_free + hx509_ca_tbs_init + hx509_ca_tbs_set_ca + hx509_ca_tbs_set_domaincontroller + hx509_ca_tbs_set_notAfter + hx509_ca_tbs_set_notAfter_lifetime + hx509_ca_tbs_set_notBefore + hx509_ca_tbs_set_proxy + hx509_ca_tbs_set_serialnumber + hx509_ca_tbs_set_spki + hx509_ca_tbs_set_subject + hx509_ca_tbs_set_template + hx509_ca_tbs_subject_expand + hx509_ca_tbs_template_units +; hx509_cert +; hx509_cert_attribute + hx509_cert_binary + hx509_cert_check_eku + hx509_cert_cmp + hx509_cert_find_subjectAltName_otherName + hx509_cert_free + hx509_cert_get_SPKI + hx509_cert_get_SPKI_AlgorithmIdentifier + hx509_cert_get_attribute + hx509_cert_get_base_subject + hx509_cert_get_friendly_name + hx509_cert_get_issuer + hx509_cert_get_notAfter + hx509_cert_get_notBefore + hx509_cert_get_serialnumber + hx509_cert_get_subject + hx509_cert_init + hx509_cert_init_data + hx509_cert_keyusage_print + hx509_cert_ref + hx509_cert_set_friendly_name + hx509_certs_add + hx509_certs_append + hx509_certs_end_seq + hx509_certs_filter + hx509_certs_find + hx509_certs_free + hx509_certs_info + hx509_certs_init + hx509_certs_iter + hx509_certs_merge + hx509_certs_next_cert + hx509_certs_start_seq + hx509_certs_store + hx509_ci_print_names + hx509_clear_error_string + hx509_cms_create_signed + hx509_cms_create_signed_1 + hx509_cms_decrypt_encrypted + hx509_cms_envelope_1 + hx509_cms_unenvelope + hx509_cms_unwrap_ContentInfo + hx509_cms_verify_signed + hx509_cms_wrap_ContentInfo + hx509_context_free + hx509_context_init + hx509_context_set_missing_revoke + hx509_crl_add_revoked_certs + hx509_crl_alloc + hx509_crl_free + hx509_crl_lifetime + hx509_crl_sign + hx509_crypto_aes128_cbc + hx509_crypto_aes256_cbc + hx509_crypto_allow_weak + hx509_crypto_available + hx509_crypto_decrypt + hx509_crypto_des_rsdi_ede3_cbc + hx509_crypto_destroy + hx509_crypto_encrypt + hx509_crypto_enctype_by_name + hx509_crypto_free_algs + hx509_crypto_get_params + hx509_crypto_init + hx509_crypto_provider + hx509_crypto_select + hx509_crypto_set_key_data + hx509_crypto_set_key_name + hx509_crypto_set_params + hx509_crypto_set_random_key + hx509_env_add + hx509_env_add_binding + hx509_env_find + hx509_env_find_binding + hx509_env_free +; hx509_env_init + hx509_env_lfind + hx509_err + hx509_free_error_string + hx509_free_octet_string_list + hx509_general_name_unparse + hx509_get_error_string + hx509_get_one_cert + hx509_lock_add_cert + hx509_lock_add_certs + hx509_lock_add_password + hx509_lock_command_string + hx509_lock_free + hx509_lock_init + hx509_lock_prompt + hx509_lock_reset_certs + hx509_lock_reset_passwords + hx509_lock_reset_promper + hx509_lock_set_prompter + hx509_name_binary + hx509_name_cmp + hx509_name_copy + hx509_name_expand + hx509_name_free + hx509_name_is_null_p + hx509_name_normalize + hx509_name_to_Name + hx509_name_to_string + hx509_ocsp_request + hx509_ocsp_verify + hx509_oid_print + hx509_oid_sprint + hx509_parse_name + hx509_peer_info_add_cms_alg + hx509_peer_info_alloc + hx509_peer_info_free + hx509_peer_info_set_cert + hx509_peer_info_set_cms_algs + hx509_pem_add_header + hx509_pem_find_header + hx509_pem_free_header + hx509_pem_read + hx509_pem_write + hx509_print_stdout + hx509_prompt_hidden + hx509_query_alloc + hx509_query_free + hx509_query_match_cmp_func + hx509_query_match_eku + hx509_query_match_expr + hx509_query_match_friendly_name + hx509_query_match_issuer_serial + hx509_query_match_option + hx509_query_statistic_file + hx509_query_unparse_stats + hx509_revoke_add_crl + hx509_revoke_add_ocsp + hx509_revoke_free + hx509_revoke_init + hx509_revoke_ocsp_print + hx509_revoke_verify + hx509_set_error_string + hx509_set_error_stringv + hx509_signature_md2 + hx509_signature_md5 + hx509_signature_rsa + hx509_signature_rsa_with_md2 + hx509_signature_rsa_with_md5 + hx509_signature_rsa_with_sha1 + hx509_signature_rsa_with_sha256 + hx509_signature_rsa_with_sha384 + hx509_signature_rsa_with_sha512 + hx509_signature_sha1 + hx509_signature_sha256 + hx509_signature_sha384 + hx509_signature_sha512 + hx509_unparse_der_name + hx509_validate_cert + hx509_validate_ctx_add_flags + hx509_validate_ctx_free + hx509_validate_ctx_init + hx509_validate_ctx_set_print + hx509_verify_attach_anchors + hx509_verify_attach_revoke + hx509_verify_ctx_f_allow_default_trustanchors + hx509_verify_destroy_ctx + hx509_verify_hostname + hx509_verify_init_ctx + hx509_verify_path + hx509_verify_set_max_depth + hx509_verify_set_proxy_certificate + hx509_verify_set_strict_rfc3280_verification + hx509_verify_set_time + hx509_verify_signature + hx509_xfree + initialize_hx_error_table_r + +; pkcs11 symbols + C_GetFunctionList From c6b8fad5dc38e66387d90d79fa3356738368b061 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:47:38 -0400 Subject: [PATCH 068/134] Consistency updates for lib/kadm5 and don't check fd_set size if it's not necessary --- lib/kadm5/NTMakefile | 4 ++-- lib/kadm5/ipropd_master.c | 2 ++ lib/kadm5/ipropd_slave.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/kadm5/NTMakefile b/lib/kadm5/NTMakefile index 6ae003fb7..029893d0d 100644 --- a/lib/kadm5/NTMakefile +++ b/lib/kadm5/NTMakefile @@ -219,7 +219,7 @@ $(LIBKADM5CLNT): $(LIBKADM5CLNT_OBJS) $(LIBKADM5SRV): $(BINDIR)\libkadm5srv.dll $(BINDIR)\libkadm5srv.dll: $(LIBKADM5SRV_OBJS) $(LIBKRB5) $(LIBROKEN) $(LIBHDB) $(LIBCOMERR) $(LIBASN1) $(LIBSQLITE) - $(DLLGUILINK_C) -out:$@ -implib:$(LIBKADM5SRV) -def:libkadm5srv-exports.def $** + $(DLLGUILINK) -implib:$(LIBKADM5SRV) -def:libkadm5srv-exports.def $(_VC_MANIFEST_EMBED_DLL) $(_VC_MANIFEST_CLEAN) $(_CODESIGN) @@ -247,7 +247,7 @@ $(OBJ)\default_keys.exe: $(OBJ)\default_keys.obj $(_VC_MANIFEST_CLEAN) $(OBJ)\sample_passwd_check.dll: $(OBJ)\sample_passwd_check.obj - $(DLLGUILINK) + $(DLLGUILINK) #TODO: Define exports $(_VC_MANIFEST_EMBED_DLL) $(_VC_MANIFEST_CLEAN) diff --git a/lib/kadm5/ipropd_master.c b/lib/kadm5/ipropd_master.c index 749040b18..e3d574d0f 100644 --- a/lib/kadm5/ipropd_master.c +++ b/lib/kadm5/ipropd_master.c @@ -852,8 +852,10 @@ main(int argc, char **argv) struct timeval to = {30, 0}; uint32_t vers; +#ifndef NO_LIMIT_FD_SETSIZE if (signal_fd >= FD_SETSIZE || listen_fd >= FD_SETSIZE) krb5_errx (context, 1, "fd too large"); +#endif FD_ZERO(&readset); FD_SET(signal_fd, &readset); diff --git a/lib/kadm5/ipropd_slave.c b/lib/kadm5/ipropd_slave.c index 8a5658c04..322b928e9 100644 --- a/lib/kadm5/ipropd_slave.c +++ b/lib/kadm5/ipropd_slave.c @@ -657,8 +657,10 @@ main(int argc, char **argv) fd_set readset; struct timeval to; +#ifndef NO_LIMIT_FD_SETSIZE if (master_fd >= FD_SETSIZE) krb5_errx (context, 1, "fd too large"); +#endif FD_ZERO(&readset); FD_SET(master_fd, &readset); From bd669f10eb5f368a5b748a223bc83ceced5b3347 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:48:05 -0400 Subject: [PATCH 069/134] Build dll.obj and don't build KRB4 specific targets if not building KRB4 --- lib/krb5/NTMakefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/krb5/NTMakefile b/lib/krb5/NTMakefile index 8254c1cd8..613029421 100644 --- a/lib/krb5/NTMakefile +++ b/lib/krb5/NTMakefile @@ -58,6 +58,7 @@ libkrb5_OBJS = \ $(OBJ)\data.obj \ $(OBJ)\deprecated.obj \ $(OBJ)\digest.obj \ + $(OBJ)\dll.obj \ $(OBJ)\eai_to_heim_errno.obj \ $(OBJ)\error_string.obj \ $(OBJ)\expand_hostname.obj \ @@ -376,7 +377,9 @@ test_binaries = \ $(OBJ)\aes-test.exe \ $(OBJ)\derived-key-test.exe \ $(OBJ)\n-fold-test.exe \ +!ifdef KRB4 $(OBJ)\name-45-test.exe \ +!endif $(OBJ)\parse-name-test.exe \ $(OBJ)\store-test.exe \ $(OBJ)\string-to-key-test.exe \ @@ -404,7 +407,9 @@ test-run: aes-test.exe derived-key-test.exe n-fold-test.exe +!ifdef KRB4 name-45-test.exe +!endif parse-name-test.exe store-test.exe string-to-key-test.exe From 4634af90783b76110e900d1d92e9ee71b612f1d5 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 13:50:10 -0400 Subject: [PATCH 070/134] Consistent use of SOCKET data type in lib/krb5 --- lib/krb5/auth_context.c | 12 ++++++------ lib/krb5/changepw.c | 4 +++- lib/krb5/send_to_kdc.c | 2 ++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/krb5/auth_context.c b/lib/krb5/auth_context.c index 38f3e3224..610a424b2 100644 --- a/lib/krb5/auth_context.c +++ b/lib/krb5/auth_context.c @@ -157,7 +157,7 @@ krb5_auth_con_setaddrs(krb5_context context, KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_genaddrs(krb5_context context, krb5_auth_context auth_context, - int fd, int flags) + SOCKET fd, int flags) { krb5_error_code ret; krb5_address local_k_address, remote_k_address; @@ -170,9 +170,9 @@ krb5_auth_con_genaddrs(krb5_context context, if(flags & KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR) { if (auth_context->local_address == NULL) { len = sizeof(ss_local); - if(getsockname(fd, local, &len) < 0) { + if(IS_SOCKET_ERROR(getsockname(fd, local, &len))) { char buf[128]; - ret = errno; + ret = SOCK_ERRNO; strerror_r(ret, buf, sizeof(buf)); krb5_set_error_message(context, ret, "getsockname: %s", buf); goto out; @@ -188,9 +188,9 @@ krb5_auth_con_genaddrs(krb5_context context, } if(flags & KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR) { len = sizeof(ss_remote); - if(getpeername(fd, remote, &len) < 0) { + if(IS_SOCKET_ERROR(getpeername(fd, remote, &len))) { char buf[128]; - ret = errno; + ret = SOCK_ERRNO; strerror_r(ret, buf, sizeof(buf)); krb5_set_error_message(context, ret, "getpeername: %s", buf); goto out; @@ -221,7 +221,7 @@ krb5_auth_con_setaddrs_from_fd (krb5_context context, krb5_auth_context auth_context, void *p_fd) { - int fd = *(int*)p_fd; + SOCKET fd = *(SOCKET*)p_fd; int flags = 0; if(auth_context->local_address == NULL) flags |= KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR; diff --git a/lib/krb5/changepw.c b/lib/krb5/changepw.c index 5b7868ff2..7d51c5c1b 100644 --- a/lib/krb5/changepw.c +++ b/lib/krb5/changepw.c @@ -602,7 +602,8 @@ change_password_loop (krb5_context context, goto out; } } - + +#ifndef NO_LIMIT_FD_SETSIZE if (sock >= FD_SETSIZE) { ret = ERANGE; krb5_set_error_message(context, ret, @@ -610,6 +611,7 @@ change_password_loop (krb5_context context, close (sock); goto out; } +#endif FD_ZERO(&fdset); FD_SET(sock, &fdset); diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index 54dec6c34..e184db460 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -58,9 +58,11 @@ recv_loop (SOCKET fd, int ret; int nbytes; +#ifndef NO_LIMIT_FD_SETSIZE if (fd >= FD_SETSIZE) { return -1; } +#endif krb5_data_zero(rep); do { From 93445a8133d0cffa5752c8f7f617343aeb6f51dc Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:01:46 -0400 Subject: [PATCH 071/134] Don't use Windows specific path tokens in lib/krb5/config_file.c --- lib/krb5/config_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/krb5/config_file.c b/lib/krb5/config_file.c index 558b82d14..632917838 100644 --- a/lib/krb5/config_file.c +++ b/lib/krb5/config_file.c @@ -447,7 +447,7 @@ krb5_config_parse_file_multi (krb5_context context, fname = newfname; } #else /* KRB5_USE_PATH_TOKENS */ - asprintf(&newfname, "%%{APPDATA}%s", &fname[1]); + asprintf(&newfname, "%%{USERCONFIG}/%s", &fname[1]); if (newfname == NULL) { krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", "")); From 6073ca9a28bc0dbd3c059ff62dd6cc87488e8f82 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:02:40 -0400 Subject: [PATCH 072/134] Add portable path tokens Add USERCONFIG, COMMONCONFIG, LIBDIR, BINDIR, LIBEXEC, SBINDIR tokens. --- lib/krb5/expand_path_w32.c | 145 ++++++++++++++++++++++++++++++++----- 1 file changed, 126 insertions(+), 19 deletions(-) diff --git a/lib/krb5/expand_path_w32.c b/lib/krb5/expand_path_w32.c index 329ea3602..784ce64fe 100644 --- a/lib/krb5/expand_path_w32.c +++ b/lib/krb5/expand_path_w32.c @@ -33,7 +33,7 @@ #include #include -#define PTYPE int +typedef int PTYPE; /** * Expand a %{TEMP} token @@ -47,7 +47,7 @@ * the returned path may or may not exist. */ static int -_expand_temp_folder(krb5_context context, PTYPE param, char ** ret) +_expand_temp_folder(krb5_context context, PTYPE param, const char * postfix, char ** ret) { TCHAR tpath[MAX_PATH]; size_t len; @@ -56,7 +56,7 @@ _expand_temp_folder(krb5_context context, PTYPE param, char ** ret) if (context) krb5_set_error_string(context, "Failed to get temporary path (GLE=%d)", GetLastError()); - return 1; + return EINVAL; } len = strlen(tpath); @@ -69,12 +69,57 @@ _expand_temp_folder(krb5_context context, PTYPE param, char ** ret) if (*ret == NULL) { if (context) krb5_set_error_string(context, "strdup - Out of memory"); - return 1; + return ENOMEM; } return 0; } +extern HINSTANCE _krb5_hInstance; + +/** + * Expand a %{BINDIR} token + * + * This is also used to expand a few other tokens on Windows, since + * most of the executable binaries end up in the same directory. The + * "bin" directory is considered to be the directory in which the + * krb5.dll is located. + */ +static int +_expand_bin_dir(krb5_context context, PTYPE param, const char * postfix, char ** ret) +{ + TCHAR path[MAX_PATH]; + TCHAR *lastSlash; + DWORD nc; + + nc = GetModuleFileName(_krb5_hInstance, path, sizeof(path)/sizeof(path[0])); + if (nc == 0 || + nc == sizeof(path)/sizeof(path[0])) { + return EINVAL; + } + + lastSlash = strrchr(path, '\\'); + if (lastSlash != NULL) { + TCHAR *fslash = strrchr(lastSlash, '/'); + + if (fslash != NULL) + lastSlash = fslash; + + *lastSlash = '\0'; + } + + if (postfix) { + if (strlcat(path, postfix, sizeof(path)/sizeof(path[0])) >= sizeof(path)/sizeof(path[0])) + return EINVAL; + } + + *ret = strdup(path); + if (*ret == NULL) + return ENOMEM; + + return 0; +} + /** * Expand a %{USERID} token * @@ -91,9 +136,9 @@ _expand_temp_folder(krb5_context context, PTYPE param, char ** ret) * */ static int -_expand_userid(krb5_context context, PTYPE param, char ** ret) +_expand_userid(krb5_context context, PTYPE param, const char * postfix, char ** ret) { - int rv = 1; + int rv = EINVAL; HANDLE hThread = NULL; HANDLE hToken = NULL; PTOKEN_OWNER pOwner = NULL; @@ -181,21 +226,34 @@ _expand_userid(krb5_context context, PTYPE param, char ** ret) return rv; } +/** + * Expand a %{null} token + * + * The expansion of a %{null} token is always the empty string. + */ static int -_expand_null(krb5_context context, PTYPE param, char ** ret) +_expand_null(krb5_context context, PTYPE param, const char * postfix, char ** ret) { *ret = strdup(""); if (*ret == NULL) { if (context) krb5_set_error_string(context, "Out of memory"); - return 1; + return ENOMEM; } return 0; } +/** + * Expand a folder identified by a CSIDL + * + * Parameters: + * + * @param[in] folder A CSIDL value identifying the folder to be + * returned. + */ static int -_expand_csidl(krb5_context context, PTYPE folder, char ** ret) +_expand_csidl(krb5_context context, PTYPE folder, const char * postfix, char ** ret) { TCHAR path[MAX_PATH]; size_t len; @@ -211,11 +269,16 @@ _expand_csidl(krb5_context context, PTYPE folder, char ** ret) if (len > 0 && path[len - 1] == '\\') path[len - 1] = '\0'; + if (postfix && + strlcat(path, postfix, sizeof(path)/sizeof(path[0])) >= sizeof(path)/sizeof(path[0])) { + return ENOMEM; + } + *ret = strdup(path); if (*ret == NULL) { if (context) krb5_set_error_string(context, "Out of memory"); - return 1; + return ENOMEM; } return 0; } @@ -227,14 +290,18 @@ static const struct token { #define FTYPE_SPECIAL 1 PTYPE param; + const char * postfix; - int (*exp_func)(krb5_context, PTYPE, char **); + int (*exp_func)(krb5_context, PTYPE, const char *, char **); -#define CSIDL(C) FTYPE_CSIDL, C, _expand_csidl +#define CSIDLP(C,P) FTYPE_CSIDL, C, P, _expand_csidl +#define CSIDL(C) CSIDLP(C, NULL) -#define SPECIAL(f) FTYPE_SPECIAL, 0, f +#define SPECIALP(f, P) FTYPE_SPECIAL, 0, P, f +#define SPECIAL(f) SPECIALP(f, NULL) } tokens[] = { + /* Windows only -- */ {"APPDATA", CSIDL(CSIDL_APPDATA)}, /* Roaming application data (for current user) */ @@ -249,6 +316,34 @@ static const struct token { {"WINDOWS", CSIDL(CSIDL_WINDOWS)}, /* Windows folder */ + /* -- end Windows only */ + + {"USERCONFIG", CSIDLP(CSIDL_APPDATA, "\\" PACKAGE)}, + /* Per user Heimdal configuration file path */ + + {"COMMONCONFIG", CSIDLP(CSIDL_COMMON_APPDATA, "\\" PACKAGE)}, + /* Common Heimdal configuration file path */ + + {"LIBDIR", SPECIAL(_expand_bin_dir)}, + /* Expands to the "lib" directory. On + Windows this is treated the same as + the "bin" directory. */ + + {"BINDIR", SPECIAL(_expand_bin_dir)}, + /* Expands to the "bin" directory. On + Windows this is treated the same as + the "bin" directory. */ + + {"LIBEXEC", SPECIAL(_expand_bin_dir)}, + /* Expands to the "libexec" + directory. On Windows, this is + treated the same as the "bin" + directory. */ + + {"SBINDIR", SPECIAL(_expand_bin_dir)}, + /* Expands to the "sbin" directory. + On Windows, this is treated the + same as the "bin" directory. */ {"TEMP", SPECIAL(_expand_temp_folder)}, /* Temporary files folder */ @@ -273,20 +368,32 @@ _expand_token(krb5_context context, const char * token, const char * token_end, *ret = NULL; - if (token[0] != '%' || token[1] != '{' || token_end[0] != '}') { + if (token[0] != '%' || token[1] != '{' || token_end[0] != '}' || + token_end - token <= 2) { if (context) krb5_set_error_string(context, "Invalid token."); - return 1; + return EINVAL; } for (i=0; i < sizeof(tokens)/sizeof(tokens[0]); i++) { if (!strncmp(token+2, tokens[i].tok, (token_end - token) - 2)) - return tokens[i].exp_func(context, tokens[i].param, ret); + return tokens[i].exp_func(context, tokens[i].param, tokens[i].postfix, ret); } if (context) krb5_set_error_string(context, "Invalid token."); - return 1; + return EINVAL; +} + +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL +_krb5_free_path(krb5_context context, + char * path) +{ + if (path == NULL) + return EINVAL; + + free(path); + return 0; } KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL @@ -322,14 +429,14 @@ _krb5_expand_path_tokens(krb5_context context, *ppath_out = NULL; if (context) krb5_set_error_string(context, "variable missing }"); - return KRB5_CONFIG_BADFORMAT; + return EINVAL; } if (_expand_token(context, tok_begin, tok_end, &append)) { if (*ppath_out) free(*ppath_out); *ppath_out = NULL; - return KRB5_CONFIG_BADFORMAT; + return EINVAL; } path_left = tok_end + 1; From 67e1aa5109f9fc7fc0b0c618a2063fe3cf09de33 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:03:07 -0400 Subject: [PATCH 073/134] Need a DllMain in libkrb5 for path resolution --- lib/krb5/dll.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 lib/krb5/dll.c diff --git a/lib/krb5/dll.c b/lib/krb5/dll.c new file mode 100644 index 000000000..d6ee48eb9 --- /dev/null +++ b/lib/krb5/dll.c @@ -0,0 +1,58 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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 + +HINSTANCE _krb5_hInstance = NULL; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved) +{ + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + + _krb5_hInstance = hinstDLL; + return TRUE; + + case DLL_PROCESS_DETACH: + return FALSE; + + case DLL_THREAD_ATTACH: + return FALSE; + + case DLL_THREAD_DETACH: + return FALSE; + } + + return FALSE; +} + From 39f6fc00f845e6f98ad51f88d30bd7d5b42ce19f Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:05:13 -0400 Subject: [PATCH 074/134] krb5_net_read(), krb5_net_write() nad krb5_storage_from_fd() should accept both sockets and fds When a socket and a file descriptor aren't interchangeable, these functions should be able to determine whether it has received one or the other and act accordingly. This assumes that a fd can be cast into a SOCKET. --- lib/krb5/net_read.c | 14 ++++++++++++++ lib/krb5/net_write.c | 14 ++++++++++++++ lib/krb5/store_fd.c | 18 ++++++++++++++++-- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/lib/krb5/net_read.c b/lib/krb5/net_read.c index 5a8045988..512a3ccef 100644 --- a/lib/krb5/net_read.c +++ b/lib/krb5/net_read.c @@ -41,5 +41,19 @@ krb5_net_read (krb5_context context, { SOCKET fd = *((SOCKET *)p_fd); +#ifdef SOCKET_IS_NOT_AN_FD +#ifdef _MSC_VER + { + HANDLE h = _get_osfhandle(fd); + + if (h != INVALID_HANDLE_VALUE) { + return net_read (fd, buf, len); + } + } +#else +#error Don't know how to handle socket that may be an fd +#endif +#endif + return net_read_s (fd, buf, len); } diff --git a/lib/krb5/net_write.c b/lib/krb5/net_write.c index 6377957ac..1561a4440 100644 --- a/lib/krb5/net_write.c +++ b/lib/krb5/net_write.c @@ -41,6 +41,20 @@ krb5_net_write (krb5_context context, { SOCKET fd = *((SOCKET *)p_fd); +#ifdef SOCKET_IS_NOT_AN_FD +#ifdef _MSC_VER + { + HANDLE h = _get_osfhandle(fd); + + if (h != INVALID_HANDLE_VALUE) { + return net_write (fd, buf, len); + } + } +#else +#error Don't know how to handle SOCKET that may be an fd +#endif +#endif + return net_write_s (fd, buf, len); } diff --git a/lib/krb5/store_fd.c b/lib/krb5/store_fd.c index 2a3fdaf60..a8974b649 100644 --- a/lib/krb5/store_fd.c +++ b/lib/krb5/store_fd.c @@ -86,11 +86,25 @@ fd_free(krb5_storage * sp) */ KRB5_LIB_FUNCTION krb5_storage * KRB5_LIB_CALL -krb5_storage_from_fd(int fd) +krb5_storage_from_fd(SOCKET fd_in) { krb5_storage *sp; + int fd; + +#ifdef SOCKET_IS_NOT_AN_FD +#ifdef _MSC_VER + if (_get_osfhandle(fd_in) != -1) { + fd = dup(fd_in); + } else { + fd = _open_osfhandle(fd_in, 0); + } +#else +#error Don't know how to deal with fd that may or may not be a socket. +#endif +#else /* SOCKET_IS_NOT_AN_FD */ + fd = dup(fd_in); +#endif - fd = dup(fd); if (fd < 0) return NULL; From 81d091baa882b66e031be45dc87f2f5603d0d57d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:05:33 -0400 Subject: [PATCH 075/134] Add tests for the new path tokens --- lib/krb5/test_cc.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/krb5/test_cc.c b/lib/krb5/test_cc.c index 87e0c89c5..1d0ddef32 100644 --- a/lib/krb5/test_cc.c +++ b/lib/krb5/test_cc.c @@ -85,9 +85,6 @@ test_default_name(krb5_context context) krb5_errx (context, 1, "krb5_cc_set_default_name 1 failed"); #endif - if (strcmp(p3, test_cc_name) != 0) - krb5_errx (context, 1, "krb5_cc_set_default_name 1 failed"); - free(p1); free(p2); free(p3); @@ -292,12 +289,17 @@ struct { char *res; } cc_names[] = { { "foo", 0, "foo" }, + { "foo%}", 0, "foo%}" }, { "%{uid}", 0 }, { "foo%{null}", 0, "foo" }, { "foo%{null}bar", 0, "foobar" }, { "%{", 1 }, { "%{foo %{", 1 }, { "%{{", 1 }, + { "%{{}", 1 }, + { "%{nulll}", 1 }, + { "%{does not exist}", 1 }, + { "%{}", 1 }, #ifdef KRB5_USE_PATH_TOKENS { "%{APPDATA}", 0 }, { "%{COMMON_APPDATA}", 0}, @@ -307,6 +309,12 @@ struct { { "%{TEMP}", 0}, { "%{USERID}", 0}, { "%{uid}", 0}, + { "%{USERCONFIG}", 0}, + { "%{COMMONCONFIG}", 0}, + { "%{LIBDIR}", 0}, + { "%{BINDIR}", 0}, + { "%{LIBEXEC}", 0}, + { "%{SBINDIR}", 0}, #endif }; @@ -717,7 +725,9 @@ main(int argc, char **argv) krb5_free_context(context); +#if 0 sleep(60); +#endif return 0; } From 56afc4da1ac9aa97aaf03d9e54781ea88a9afc9d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:06:11 -0400 Subject: [PATCH 076/134] Build libheimntlm as a .dll by default --- lib/ntlm/NTMakefile | 12 ++++++++++++ lib/ntlm/libheimntlm-exports.def | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 lib/ntlm/libheimntlm-exports.def diff --git a/lib/ntlm/NTMakefile b/lib/ntlm/NTMakefile index 826b3e1cc..029c3ff0c 100644 --- a/lib/ntlm/NTMakefile +++ b/lib/ntlm/NTMakefile @@ -42,9 +42,21 @@ libheimntlm_la_SOURCES = ntlm.c heimntlm.h $(OBJ)\heimntlm-protos.h: $(libheimntlm_la_SOURCES) $(PERL) ../../cf/make-proto.pl -q -P remove -o $(OBJ)\heimntlm-protos.h $(libheimntlm_la_SOURCES) +!ifndef STATICLIBS + +$(LIBHEIMNTLM): $(BINDIR)\libheimntlm.dll + +$(BINDIR)\libheimntlm.dll: $(OBJ)\ntlm.obj $(LIBKRB5) $(LIBHCRYPTO) + $(DLLGUILINK) -def:libheimntlm-exports.def -implib:$(LIBHEIMNTLM) + $(DLLPREP) + +!else + $(LIBHEIMNTLM): $(OBJ)\ntlm.obj $(LIBCON) +!endif + all:: $(INCFILES) $(LIBHEIMNTLM) diff --git a/lib/ntlm/libheimntlm-exports.def b/lib/ntlm/libheimntlm-exports.def new file mode 100644 index 000000000..ce812e0e6 --- /dev/null +++ b/lib/ntlm/libheimntlm-exports.def @@ -0,0 +1,21 @@ +EXPORTS + heim_ntlm_build_ntlm1_master + heim_ntlm_calculate_ntlm1 + heim_ntlm_calculate_ntlm2 + heim_ntlm_calculate_ntlm2_sess + heim_ntlm_decode_targetinfo + heim_ntlm_decode_type1 + heim_ntlm_decode_type2 + heim_ntlm_decode_type3 + heim_ntlm_encode_targetinfo + heim_ntlm_encode_type1 + heim_ntlm_encode_type2 + heim_ntlm_encode_type3 + heim_ntlm_free_buf + heim_ntlm_free_targetinfo + heim_ntlm_free_type1 + heim_ntlm_free_type2 + heim_ntlm_free_type3 + heim_ntlm_nt_key + heim_ntlm_ntlmv2_key + heim_ntlm_verify_ntlm2 From a11386261db75cbbf324b15e156ef1a2b440eb31 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:07:34 -0400 Subject: [PATCH 077/134] Change mini_inetd() to optionally return the connected socket This is to support platforms where a socket is not an FD and can't reliably be bound to the stdin and stdout file descriptors. --- lib/roken/mini_inetd.c | 84 +++++++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 18 deletions(-) diff --git a/lib/roken/mini_inetd.c b/lib/roken/mini_inetd.c index 7d113098c..7f9b61681 100644 --- a/lib/roken/mini_inetd.c +++ b/lib/roken/mini_inetd.c @@ -41,26 +41,56 @@ */ static void -accept_it (SOCKET s) +accept_it (SOCKET s, SOCKET *ret_socket) { - SOCKET s2; + SOCKET as; - s2 = accept(s, NULL, NULL); - if(IS_BAD_SOCKET(s2)) + as = accept(s, NULL, NULL); + if(IS_BAD_SOCKET(as)) err (1, "accept"); - closesocket(s); - dup2(fd_from_socket(s2, _O_RDONLY), STDIN_FILENO); - dup2(fd_from_socket(s2, 0), STDOUT_FILENO); - /* dup2(fd_from_socket(s2, 0), STDERR_FILENO); */ - closesocket(s2); + + if (ret_socket) { + + *ret_socket = as; + + } else { + int fd = fd_from_socket(as, 0); + + /* We would use _O_RDONLY for the fd_from_socket() call for + STDIN, but there are instances where we assume that STDIN + is a r/w socket. */ + + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + +#ifdef SOCKET_IS_NOT_AN_FD + close(fd); +#else + closesocket(as); +#endif + } } -/* - * Listen on a specified port, emulating inetd. +/** + * Listen on a specified addresses + * + * Listens on the specified addresses for incoming connections. If + * the \a ret_socket parameter is \a NULL, on return STDIN and STDOUT + * will be connected to an accepted socket. If the \a ret_socket + * parameter is non-NULL, the accepted socket will be returned in + * *ret_socket. In the latter case, STDIN and STDOUT will be left + * unmodified. + * + * This function does not return if there is an error or if no + * connection is established. + * + * @param[in] ai Addresses to listen on + * @param[out] ret_socket If non-NULL receives the accepted socket. + * + * @see mini_inetd() */ - ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -mini_inetd_addrinfo (struct addrinfo *ai) +mini_inetd_addrinfo (struct addrinfo *ai, SOCKET *ret_socket) { int ret; struct addrinfo *a; @@ -86,13 +116,13 @@ mini_inetd_addrinfo (struct addrinfo *ai) continue; socket_set_reuseaddr (fds[i], 1); socket_set_ipv6only(fds[i], 1); - if (bind (fds[i], a->ai_addr, a->ai_addrlen) < 0) { + if (IS_SOCKET_ERROR(bind (fds[i], a->ai_addr, a->ai_addrlen))) { warn ("bind af = %d", a->ai_family); closesocket(fds[i]); fds[i] = INVALID_SOCKET; continue; } - if (listen (fds[i], SOMAXCONN) < 0) { + if (IS_SOCKET_ERROR(listen (fds[i], SOMAXCONN))) { warn ("listen af = %d", a->ai_family); closesocket(fds[i]); fds[i] = INVALID_SOCKET; @@ -120,7 +150,7 @@ mini_inetd_addrinfo (struct addrinfo *ai) for (i = 0; i < n; ++i) if (FD_ISSET (fds[i], &read_set)) { - accept_it (fds[i]); + accept_it (fds[i], ret_socket); for (i = 0; i < n; ++i) closesocket(fds[i]); free(fds); @@ -129,8 +159,25 @@ mini_inetd_addrinfo (struct addrinfo *ai) abort (); } +/** + * Listen on a specified port + * + * Listens on the specified port for incoming connections. If the \a + * ret_socket parameter is \a NULL, on return STDIN and STDOUT will be + * connected to an accepted socket. If the \a ret_socket parameter is + * non-NULL, the accepted socket will be returned in *ret_socket. In + * the latter case, STDIN and STDOUT will be left unmodified. + * + * This function does not return if there is an error or if no + * connection is established. + * + * @param[in] port Port to listen on + * @param[out] ret_socket If non-NULL receives the accepted socket. + * + * @see mini_inetd_addrinfo() + */ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -mini_inetd (int port) +mini_inetd (int port, SOCKET * ret_socket) { int error; struct addrinfo *ai, hints; @@ -147,7 +194,8 @@ mini_inetd (int port) if (error) errx (1, "getaddrinfo: %s", gai_strerror (error)); - mini_inetd_addrinfo(ai); + mini_inetd_addrinfo(ai, ret_socket); freeaddrinfo(ai); } + From e1932ec0fdb8f7e5003eccced324b893cf994e85 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:09:09 -0400 Subject: [PATCH 078/134] If a recv() return EINTR on Windows, don't retry EINTR (or WSAEINTR) is used to indicate that a blocking call was cancelled using WSACancelBlockingCall(). Retrying wouldn't be the right thing to do in this case. --- lib/roken/net_read.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/roken/net_read.c b/lib/roken/net_read.c index 7741e0256..1010d8b8e 100644 --- a/lib/roken/net_read.c +++ b/lib/roken/net_read.c @@ -74,10 +74,16 @@ net_read_s (SOCKET sock, void *buf, size_t nbytes) while (rem > 0) { count = recv (sock, cbuf, rem, 0); if (count < 0) { - if (errno == EINTR) + + /* With WinSock, the error EINTR (WSAEINTR), is used to + indicate that a blocking call was cancelled using + WSACancelBlockingCall(). */ + +#ifndef HAVE_WINSOCK + if (SOCK_ERRNO == EINTR) continue; - else - return count; +#endif + return count; } else if (count == 0) { return count; } From 8e785a575085ee11c58dea8bcd65ad07ef80d673 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:11:41 -0400 Subject: [PATCH 079/134] Formatting changes and new mini_inetd() function signatures --- lib/roken/roken-common.h | 3 ++- lib/roken/roken.h.in | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/roken/roken-common.h b/lib/roken/roken-common.h index 11d4a25ce..918254158 100644 --- a/lib/roken/roken-common.h +++ b/lib/roken/roken-common.h @@ -334,7 +334,8 @@ wait_for_process(pid_t); #define wait_for_process_timed rk_wait_for_process_timed ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL wait_for_process_timed(pid_t, time_t (*)(void *), - void *, time_t); + void *, time_t); + #define pipe_execv rk_pipe_execv ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL pipe_execv(FILE**, FILE**, FILE**, const char*, ...); diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 6c74de535..5dd6652ac 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -63,6 +63,7 @@ #define ETIMEDOUT WSAETIMEDOUT #define EWOULDBLOCK WSAEWOULDBLOCK +#define ENOTSOCK WSAENOTSOCK #define SOCK_INIT rk_WSAStartup() #define SOCK_EXIT rk_WSACleanup() @@ -933,8 +934,11 @@ ROKEN_LIB_FUNCTION const char * ROKEN_LIB_CALL getprogname(void); extern const char *__progname; #endif -ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL mini_inetd_addrinfo (struct addrinfo*); -ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL mini_inetd (int); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +mini_inetd_addrinfo (struct addrinfo*, SOCKET *); + +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +mini_inetd (int, SOCKET *); #ifndef HAVE_LOCALTIME_R #define localtime_r rk_localtime_r From 6c45d5614a1aa9e9f9dde413e878149d2d9711e3 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:12:03 -0400 Subject: [PATCH 080/134] Minor refactoring in simple_exec_w32.c --- lib/roken/simple_exec_w32.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/roken/simple_exec_w32.c b/lib/roken/simple_exec_w32.c index 201fd4134..ae778ce60 100644 --- a/lib/roken/simple_exec_w32.c +++ b/lib/roken/simple_exec_w32.c @@ -48,7 +48,7 @@ RCSID("$Id$"); * @param[in] pid Process id for the monitored process * @param[in] func Timeout callback function. When the wait times out, - * the callback function is called. THe possible return values + * the callback function is called. The possible return values * from the callback function are: * * - ((time_t) -2) Exit loop without killing child and return SE_E_EXECTIMEOUT. @@ -72,13 +72,17 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL wait_for_process_timed(pid_t pid, time_t (*func)(void *), void *ptr, time_t timeout) { - HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid); + HANDLE hProcess; DWORD wrv = 0; DWORD dtimeout; int rv = 0; - if (hProcess == NULL) + hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid); + + if (hProcess == NULL) { + DWORD dw = GetLastError(); return SE_E_WAITPIDFAILED; + } dtimeout = (DWORD) ((timeout == 0)? INFINITE: timeout * 1000); From 170e8158cbad12fff2f661ed0f09c9c926be23c0 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:13:30 -0400 Subject: [PATCH 081/134] strcpy_s() and strcat_s() aren't drop-in replacements for strlcpy() and strlcat() --- lib/roken/strlcat.c | 1 + lib/roken/strlcpy.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/roken/strlcat.c b/lib/roken/strlcat.c index 5b8945351..0b676ef98 100644 --- a/lib/roken/strlcat.c +++ b/lib/roken/strlcat.c @@ -49,4 +49,5 @@ strlcat (char *dst, const char *src, size_t dst_sz) return len + strlcpy (dst + len, src, dst_sz - len); } + #endif diff --git a/lib/roken/strlcpy.c b/lib/roken/strlcpy.c index f8a0bb766..7c1789bd1 100644 --- a/lib/roken/strlcpy.c +++ b/lib/roken/strlcpy.c @@ -36,6 +36,20 @@ #ifndef HAVE_STRLCPY +#if defined(_MSC_VER) && _MSC_VER >= 1400 + +ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL +strlcpy (char *dst, const char *src, size_t dst_cch) +{ + errno_t e; + + e = strcpy_s(dst, dst_cch, src); + + return strlen (src); +} + +#else + ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL strlcpy (char *dst, const char *src, size_t dst_sz) { @@ -54,3 +68,5 @@ strlcpy (char *dst, const char *src, size_t dst_sz) } #endif + +#endif From c0600f525c0ac17f9aa55ee6cf843305e9a39ff7 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:14:01 -0400 Subject: [PATCH 082/134] Add test for mini_inetd() --- lib/roken/test-mini_inetd.c | 360 ++++++++++++++++++++++++++++++++++++ 1 file changed, 360 insertions(+) create mode 100644 lib/roken/test-mini_inetd.c diff --git a/lib/roken/test-mini_inetd.c b/lib/roken/test-mini_inetd.c new file mode 100644 index 000000000..0aee4933a --- /dev/null +++ b/lib/roken/test-mini_inetd.c @@ -0,0 +1,360 @@ +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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 +#include +#include +#include +#include + +#define PORT 8013 +#define PORT_S "8013" + +char * prog = "Master"; +int is_client = 0; + +static int +get_address(int flags, struct addrinfo ** ret) +{ + struct addrinfo ai; + int rv; + + memset(&ai, 0, sizeof(ai)); + + ai.ai_flags = flags | AI_NUMERICHOST; + ai.ai_family = AF_INET; + ai.ai_socktype = SOCK_STREAM; + ai.ai_protocol = PF_UNSPEC; + + rv = getaddrinfo("127.0.0.1", PORT_S, &ai, ret); + if (rv) { + fprintf(stderr, "[%s] getaddrinfo: %s", prog, gai_strerror(rv)); + } + return rv; +} + +static int +get_connected_socket(SOCKET * s_ret) +{ + struct addrinfo * ai = NULL; + int rv = 0; + SOCKET s = INVALID_SOCKET; + + rv = get_address(0, &ai); + if (rv) + return rv; + + s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); + if (IS_BAD_SOCKET(s)) { + rv = 1; + goto done; + } + + rv = connect(s, ai->ai_addr, ai->ai_addrlen); + if (IS_SOCKET_ERROR(rv)) + goto done; + + *s_ret = s; + s = INVALID_SOCKET; + rv = 0; + + done: + if (!IS_BAD_SOCKET(s)) + closesocket(s); + + if (ai) + freeaddrinfo(ai); + + return (rv)?SOCK_ERRNO: 0; +} + +const char * test_strings[] = { + "Hello", + "01234566789012345689012345678901234567890123456789", + "Another test", + "exit" +}; + +static int +test_simple_echo_client(void) +{ + SOCKET s = INVALID_SOCKET; + int rv; + char buf[81]; + int i; + + fprintf (stderr, "[%s] Getting connected socket...", prog); + rv = get_connected_socket(&s); + if (rv) { + fprintf(stderr, "\n[%s] get_connected_socket() failed (%s)\n", prog, strerror(SOCK_ERRNO)); + return 1; + } + + fprintf (stderr, "[%s] done\n", prog); + + for (i=0; i < sizeof(test_strings)/sizeof(test_strings[0]); i++) { + rv = send(s, test_strings[i], strlen(test_strings[i]), 0); + if (IS_SOCKET_ERROR(rv)) { + fprintf (stderr, "[%s] send() failure (%s)\n", prog, strerror(SOCK_ERRNO)); + closesocket(s); + return 1; + } + + rv = recv(s, buf, sizeof(buf), 0); + if (IS_SOCKET_ERROR(rv)) { + fprintf (stderr, "[%s] recv() failure (%s)\n", prog, strerror(SOCK_ERRNO)); + closesocket(s); + return 1; + } + + if (rv == 0) { + fprintf (stderr, "[%s] No data received\n", prog); + closesocket(s); + return 1; + } + + if (rv != strlen(test_strings[i])) { + fprintf (stderr, "[%s] Data length mismatch %d != %d\n", prog, rv, strlen(test_strings[i])); + closesocket(s); + return 1; + } + } + + fprintf (stderr, "[%s] Done\n", prog); + closesocket(s); + return 0; +} + +static int +test_simple_echo_socket(void) +{ + fprintf (stderr, "[%s] Process ID %d\n", prog, GetCurrentProcessId()); + fprintf (stderr, "[%s] Starting echo test with sockets\n", prog); + + if (is_client) { + return test_simple_echo_client(); + } else { + + SOCKET s = INVALID_SOCKET; + + fprintf (stderr, "[%s] Listening for connections...\n", prog); + mini_inetd(htons(PORT), &s); + if (IS_BAD_SOCKET(s)) { + fprintf (stderr, "[%s] Connect failed (%s)\n", prog, strerror(SOCK_ERRNO)); + } else { + fprintf (stderr, "[%s] Connected\n", prog); + } + + { + char buf[81]; + int rv, srv; + + while ((rv = recv(s, buf, sizeof(buf), 0)) != 0 && !IS_SOCKET_ERROR(rv)) { + buf[rv] = 0; + fprintf(stderr, "[%s] Received [%s]\n", prog, buf); + + /* simple echo */ + srv = send(s, buf, rv, 0); + if (srv != rv) { + if (IS_SOCKET_ERROR(srv)) + fprintf(stderr, "[%s] send() error [%s]\n", prog, strerror(SOCK_ERRNO)); + else + fprintf(stderr, "[%s] send() size mismatch %d != %d", prog, srv, rv); + } + + if (!strcmp(buf, "exit")) { + fprintf(stderr, "[%s] Exiting...\n", prog); + shutdown(s, SD_SEND); + closesocket(s); + return 0; + } + } + + fprintf(stderr, "[%s] recv() failed (%s)\n", prog, strerror(SOCK_ERRNO)); + } + + closesocket(s); + } + + return 1; +} + +static int +test_simple_echo(void) +{ + fprintf (stderr, "[%s] Starting echo test\n", prog); + + if (is_client) { + + return test_simple_echo_client(); + + } else { + + fprintf (stderr, "[%s] Listening for connections...\n", prog); + mini_inetd(htons(PORT), NULL); + fprintf (stderr, "[%s] Connected\n", prog); + + { + char buf[81]; + while (gets(buf)) { + fprintf(stderr, "[%s] Received [%s]\n", prog, buf); + + if (!strcmp(buf, "exit")) + return 0; + + /* simple echo */ + puts(buf); + } + + fprintf(stderr, "[%s] gets() failed (%s)\n", prog, _strerror("gets")); + } + } + + return 1; +} + +static int +do_client(void) +{ + int rv = 0; + + SOCK_INIT; + + prog = "Client"; + is_client = 1; + + fprintf(stderr, "Starting client...\n"); + + rv = test_simple_echo_socket(); + + SOCK_EXIT; + + return rv; +} + +static int +do_server(void) +{ + int rv = 0; + + SOCK_INIT; + + prog = "Server"; + + fprintf(stderr, "Starting server...\n"); + + rv = test_simple_echo_socket(); + + SOCK_EXIT; + + return rv; +} + +static time_t +wait_callback(void *p) +{ + return (time_t)-1; +} + +static int +do_test(char * path) +{ + intptr_t p_server; + intptr_t p_client; + int client_rv; + int server_rv; + + p_server = _spawnl(_P_NOWAIT, path, path, "--server", NULL); + if (p_server <= 0) { + fprintf(stderr, "%s: %s", path, _strerror("Can't start server process")); + return 1; + } +#ifdef _WIN32 + /* On Windows, the _spawn*() functions return a process handle on + success. We need a process ID for use with + wait_for_process_timed(). */ + + p_server = GetProcessId((HANDLE) p_server); +#endif + fprintf(stderr, "Created server process ID %d\n", p_server); + + p_client = _spawnl(_P_NOWAIT, path, path, "--client", NULL); + if (p_client <= 0) { + fprintf(stderr, "%s: %s", path, _strerror("Can't start client process")); + fprintf(stderr, "Waiting for server process to terminate ..."); + wait_for_process_timed(p_server, wait_callback, NULL, 5); + fprintf(stderr, "DONE\n"); + return 1; + } +#ifdef _WIN32 + p_client = GetProcessId((HANDLE) p_client); +#endif + fprintf(stderr, "Created client process ID %d\n", p_client); + + fprintf(stderr, "Waiting for client process to terminate ..."); + client_rv = wait_for_process_timed(p_client, wait_callback, NULL, 5); + if (SE_IS_ERROR(client_rv)) { + fprintf(stderr, "\nwait_for_process_timed() failed for client. rv=%d\n", client_rv); + } else { + fprintf(stderr, "DONE\n"); + } + + fprintf(stderr, "Waiting for server process to terminate ..."); + server_rv = wait_for_process_timed(p_server, wait_callback, NULL, 5); + if (SE_IS_ERROR(server_rv)) { + fprintf(stderr, "\nwait_for_process_timed() failed for server. rv=%d\n", server_rv); + } else { + fprintf(stderr, "DONE\n"); + } + + if (client_rv == 0 && server_rv == 0) { + fprintf(stderr, "PASS\n"); + return 0; + } else { + fprintf(stderr, "FAIL: Client rv=%d, Server rv=%d\n", client_rv, server_rv); + return 1; + } +} + +int main(int argc, char ** argv) +{ + if (argc == 2 && strcmp(argv[1], "--client") == 0) + return do_client(); + else if (argc == 2 && strcmp(argv[1], "--server") == 0) + return do_server(); + else if (argc == 1) + return do_test(argv[0]); + else { + printf ("%s: Test mini_inetd() function. Run with no arguments to start test\n", + argv[0]); + return 1; + } +} From db6994d1f5784f6df17f9fe94bf8ee3783563e8d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:15:18 -0400 Subject: [PATCH 083/134] Header file ordering --- lib/roken/strftime.c | 2 +- lib/roken/strpftime-test.c | 2 +- lib/roken/strptime.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/roken/strftime.c b/lib/roken/strftime.c index 3918cea93..18faa71a4 100644 --- a/lib/roken/strftime.c +++ b/lib/roken/strftime.c @@ -31,10 +31,10 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include "roken.h" #ifdef TEST_STRPFTIME #include "strpftime-test.h" #endif -#include "roken.h" static const char *abb_weekdays[] = { "Sun", diff --git a/lib/roken/strpftime-test.c b/lib/roken/strpftime-test.c index 855216b42..8524ff5ee 100644 --- a/lib/roken/strpftime-test.c +++ b/lib/roken/strpftime-test.c @@ -31,10 +31,10 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include #ifdef TEST_STRPFTIME #include "strpftime-test.h" #endif -#include "roken.h" enum { MAXSIZE = 26 }; diff --git a/lib/roken/strptime.c b/lib/roken/strptime.c index 3d31922e8..75c27a328 100644 --- a/lib/roken/strptime.c +++ b/lib/roken/strptime.c @@ -31,11 +31,11 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include "roken.h" #ifdef TEST_STRPFTIME #include "strpftime-test.h" #endif #include -#include "roken.h" static const char *abb_weekdays[] = { "Sun", From f5b69e17f31215a16c8205780f1c323e56b3e6f5 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:15:48 -0400 Subject: [PATCH 084/134] NTMakefile update for lib/roken to bulid additional modules and additional tests --- lib/roken/NTMakefile | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile index 2f1ae6b38..f6d2e30dc 100644 --- a/lib/roken/NTMakefile +++ b/lib/roken/NTMakefile @@ -88,12 +88,15 @@ libroken_la_OBJS = \ $(OBJ)\socket.obj \ $(OBJ)\sockstartup_w32.obj \ $(OBJ)\strcollect.obj \ + $(OBJ)\strlcat.obj \ + $(OBJ)\strlcpy.obj \ $(OBJ)\strpool.obj \ $(OBJ)\strptime.obj \ $(OBJ)\strsep.obj \ $(OBJ)\strsep_copy.obj \ $(OBJ)\strtok_r.obj \ $(OBJ)\syslogc.obj \ + $(OBJ)\timegm.obj \ $(OBJ)\timeval.obj \ $(OBJ)\tm2time.obj \ $(OBJ)\unvis.obj \ @@ -111,7 +114,10 @@ libroken_la_OBJS = \ $(C2OBJ) -DBUILD_ROKEN_LIB $(LIBROKEN): $(libroken_la_OBJS) - $(LIBCON) + $(LIBCON_C) -out:$@ @<< +$(**: = +) +<< $(OBJ)\make-roken.exe: $(OBJ)\make-roken.obj $(EXECONLINK) @@ -166,7 +172,8 @@ TEST_PROGS = \ $(OBJ)\parse_time-test.exe \ $(OBJ)\snprintf-test.exe \ $(OBJ)\strpftime-test.exe \ - $(OBJ)\dirent-test.exe + $(OBJ)\dirent-test.exe \ + $(OBJ)\test-mini_inetd.exe $(OBJ)\strftime_test.obj: strftime.c $(C2OBJ) -DTEST_SNPRINTF -DTEST_STRPFTIME -DBUILD_ROKEN_LIB @@ -186,10 +193,10 @@ $(OBJ)\parse_reply-test.obj: parse_reply-test.c $(OBJ)\resolve_test.obj: resolve.c $(C2OBJ) -DTEST_RESOLVE -DBUILD_ROKEN_LIB -$(OBJ)\parse_reply-test.exe: $(OBJ)\parse_reply-test.obj $(OBJ)\resolve_test.obj +$(OBJ)\parse_reply-test.exe: $(OBJ)\parse_reply-test.obj $(OBJ)\resolve_test.obj $(LIBROKEN) $(EXECONLINK) -$(OBJ)\test-readenv.exe: $(OBJ)\test-readenv.obj $(OBJ)\test-mem.obj +$(OBJ)\test-readenv.exe: $(OBJ)\test-readenv.obj $(OBJ)\test-mem.obj $(LIBROKEN) $(EXECONLINK) $(OBJ)\parse_time-test.exe: $(OBJ)\parse_time-test.obj $(OBJ)\test-mem.obj $(LIBROKEN) @@ -205,29 +212,37 @@ $(OBJ)\snprintf-test.obj: snprintf-test.c $(C2OBJ) -DTEST_SNPRINTF -DBUILD_ROKEN_LIB $(OBJ)\snprintf-test.exe: $(OBJ)\snprintf-test.obj $(OBJ)\libtest.lib $(LIBROKEN) + $(EXECONLINK) $(OBJ)\resolve-test.exe: $(OBJ)\resolve-test.obj $(LIBROKEN) + $(EXECONLINK) $(OBJ)\base64-test.exe: $(OBJ)\base64-test.obj $(OBJ)\base64.obj + $(EXECONLINK) $(OBJ)\getaddrinfo-test.exe: $(OBJ)\getaddrinfo-test.obj $(LIBROKEN) + $(EXECONLINK) $(OBJ)\hex-test.exe: $(OBJ)\hex-test.obj $(LIBROKEN) - -$(OBJ)\test-readenv.exe: $(OBJ)\test-readenv.obj $(LIBROKEN) + $(EXECONLINK) $(OBJ)\parse_bytes-test.exe: $(OBJ)\parse_bytes-test.obj $(LIBROKEN) - -$(OBJ)\parse_reply-test.exe: $(OBJ)\parse_reply-test.obj $(LIBROKEN) + $(EXECONLINK) $(OBJ)\dirent-test.exe: $(OBJ)\dirent-test.obj $(LIBROKEN) + $(EXECONLINK) $(OBJ)\getifaddrs-test.exe: $(OBJ)\getifaddrs-test.obj $(LIBROKEN) + $(EXECONLINK) + +$(OBJ)\test-mini_inetd.exe: $(OBJ)\test-mini_inetd.obj $(LIBROKEN) + $(EXECONLINK) test-binaries: $(TEST_PROGS) $(TMP_PROGS) test-run: cd $(OBJ) + test-mini_inetd.exe dirent-test.exe base64-test.exe getaddrinfo-test.exe From 480acc60ec5d780229a98f2765141e6b2069057c Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:16:08 -0400 Subject: [PATCH 085/134] Build libwind as a .dll by default --- lib/wind/NTMakefile | 12 ++++++++++++ lib/wind/libwind-exports.def | 23 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 lib/wind/libwind-exports.def diff --git a/lib/wind/NTMakefile b/lib/wind/NTMakefile index e4b6af36e..404626d57 100644 --- a/lib/wind/NTMakefile +++ b/lib/wind/NTMakefile @@ -50,9 +50,21 @@ libwind_OBJs= \ $(OBJ)\wind_err.obj \ $(OBJ)\utf8.obj +!ifndef STATICLIBS + +$(LIBWIND): $(BINDIR)\libwind.dll + +$(BINDIR)\libwind.dll: $(libwind_OBJs) $(LIBCOMERR) + $(DLLGUILINK) -def:libwind-exports.def -implib:$(LIBWIND) + $(DLLPREP) + +!else + $(LIBWIND): $(libwind_OBJs) $(LIBCON) +!endif + INCFILES= \ $(INCDIR)\wind.h \ $(INCDIR)\wind_err.h \ diff --git a/lib/wind/libwind-exports.def b/lib/wind/libwind-exports.def new file mode 100644 index 000000000..66d6c946e --- /dev/null +++ b/lib/wind/libwind-exports.def @@ -0,0 +1,23 @@ +EXPORTS + wind_stringprep + wind_profile + wind_punycode_label_toascii + wind_utf8ucs4 + wind_utf8ucs4_length + wind_ucs4utf8 + wind_ucs4utf8_length + wind_ucs2utf8 + wind_utf8ucs2 + wind_utf8ucs2_length + wind_ucs2utf8_length + wind_ucs2read + +; testing + _wind_combining_class + _wind_stringprep_testbidi + _wind_stringprep_error + _wind_stringprep_prohibited + _wind_stringprep_map + _wind_stringprep_normalize + _wind_ldap_case_exact_attribute + _wind_ucs2read From 7262cbab9c026ebe1c29594764901590b8326a6d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 14 Sep 2009 15:16:37 -0400 Subject: [PATCH 086/134] Comment for fd_from_socket() --- lib/roken/socket.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/roken/socket.c b/lib/roken/socket.c index 8a83c85b8..aa7e76ca3 100644 --- a/lib/roken/socket.c +++ b/lib/roken/socket.c @@ -301,6 +301,14 @@ socket_set_ipv6only (SOCKET sock, int val) #ifdef SOCKET_IS_NOT_AN_FD +/** + * Create a file descriptor from a socket + * + * While the socket handle in \a sock can be used with WinSock + * functions after calling fd_from_socket(), it should not be closed + * with closesocket(). The socket will be closed when the associated + * file descriptor is closed. + */ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL fd_from_socket(SOCKET sock, int flags) { From 81b70c3488a8f8bd7748f6a7192ecf79a67966df Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 15 Sep 2009 16:12:34 -0400 Subject: [PATCH 087/134] Copy cc_ops and kt_types when copying a krb5_context in krb5_copy_context() --- lib/krb5/context.c | 50 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/lib/krb5/context.c b/lib/krb5/context.c index f3f3d1a72..529247e76 100644 --- a/lib/krb5/context.c +++ b/lib/krb5/context.c @@ -242,6 +242,29 @@ cc_ops_register(krb5_context context) return 0; } +static krb5_error_code +cc_ops_copy(krb5_context context, const krb5_context src_context) +{ + context->cc_ops = NULL; + context->num_cc_ops = 0; + + if (src_context->num_cc_ops == 0) + return 0; + + context->cc_ops = malloc(sizeof(context->cc_ops[0]) * src_context->num_cc_ops); + if (context->cc_ops == NULL) { + krb5_set_error_message(context, KRB5_CC_NOMEM, + N_("malloc: out of memory", "")); + return KRB5_CC_NOMEM; + } + + context->num_cc_ops = src_context->num_cc_ops; + memcpy(context->cc_ops, src_context->cc_ops, + sizeof(context->cc_ops[0]) * src_context->num_cc_ops); + + return 0; +} + static krb5_error_code kt_ops_register(krb5_context context) { @@ -259,6 +282,28 @@ kt_ops_register(krb5_context context) return 0; } +static krb5_error_code +kt_ops_copy(krb5_context context, const krb5_context src_context) +{ + context->num_kt_types = 0; + context->kt_types = NULL; + + if (src_context->num_kt_types == 0) + return 0; + + context->kt_types = malloc(sizeof(context->kt_types[0]) * src_context->num_kt_types); + if (context->kt_types == NULL) { + krb5_set_error_message(context, ENOMEM, + N_("malloc: out of memory", "")); + return ENOMEM; + } + + context->num_kt_types = src_context->num_kt_types; + memcpy(context->kt_types, src_context->kt_types, + sizeof(context->kt_types[0]) * src_context->num_kt_types); + + return 0; +} /** * Initializes the context structure and reads the configuration file @@ -424,8 +469,9 @@ krb5_copy_context(krb5_context context, krb5_context *out) /* XXX should copy */ krb5_init_ets(p); - cc_ops_register(p); - kt_ops_register(p); + + cc_ops_copy(p, context); + kt_ops_copy(p, context); #if 0 /* XXX */ if(context->warn_dest != NULL) From a87447f2b4efa5c0bceb94f1a82110de963515ba Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 15 Sep 2009 16:13:03 -0400 Subject: [PATCH 088/134] Use casts to reduce errors when converting sockaddr* to sockaddr_in or sockaddr_in6 --- lib/roken/inet_pton.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/roken/inet_pton.c b/lib/roken/inet_pton.c index 58a5d1f62..3db1f49f2 100644 --- a/lib/roken/inet_pton.c +++ b/lib/roken/inet_pton.c @@ -48,7 +48,7 @@ inet_pton(int af, const char *src, void *dst) INT s = sizeof(si4); si4.sin_family = AF_INET; - r = WSAStringToAddress(src, AF_INET, NULL, &si4, &s); + r = WSAStringToAddress(src, AF_INET, NULL, (LPSOCKADDR) &si4, &s); if (r == 0) { memcpy(dst, &si4.sin_addr, sizeof(si4.sin_addr)); @@ -64,7 +64,7 @@ inet_pton(int af, const char *src, void *dst) INT s = sizeof(si6); si6.sin6_family = AF_INET6; - r = WSAStringToAddress(src, AF_INET6, NULL, &si6, &s); + r = WSAStringToAddress(src, AF_INET6, NULL, (LPSOCKADDR) &si6, &s); if (r == 0) { memcpy(dst, &si6.sin6_addr, sizeof(si6.sin6_addr)); From 052d34e611dcf917816346cb2a82f8415d664c74 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Tue, 24 Nov 2009 13:36:03 -0800 Subject: [PATCH 089/134] define a socket type, krb5_socket_t --- include/bits.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/bits.c b/include/bits.c index 1070428c5..e0348a504 100644 --- a/include/bits.c +++ b/include/bits.c @@ -234,6 +234,15 @@ int main(int argc, char **argv) fprintf(f, "typedef int krb5_ssize_t;\n"); #endif fprintf(f, "\n"); + +#if defined(_WIN32) + #include + fprintf(f, "typedef SOCKET krb5_socket_t;\n"); +#else + fprintf(f, "typedef int krb5_socket_t;\n"); +#endif + fprintf(f, "\n"); + #endif /* KRB5 */ fprintf(f, "#endif /* %s */\n", hb); From 98ed50fdf079eb8c3f64ee01a9562ee246c7e89b Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Tue, 24 Nov 2009 13:40:32 -0800 Subject: [PATCH 090/134] switch krb5_socket_t --- lib/krb5/auth_context.c | 4 ++-- lib/krb5/net_read.c | 4 ++-- lib/krb5/net_write.c | 6 +++--- lib/krb5/send_to_kdc.c | 14 +++++++------- lib/krb5/store_fd.c | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/krb5/auth_context.c b/lib/krb5/auth_context.c index 610a424b2..db24e73a4 100644 --- a/lib/krb5/auth_context.c +++ b/lib/krb5/auth_context.c @@ -157,7 +157,7 @@ krb5_auth_con_setaddrs(krb5_context context, KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_genaddrs(krb5_context context, krb5_auth_context auth_context, - SOCKET fd, int flags) + krb5_socket_t fd, int flags) { krb5_error_code ret; krb5_address local_k_address, remote_k_address; @@ -221,7 +221,7 @@ krb5_auth_con_setaddrs_from_fd (krb5_context context, krb5_auth_context auth_context, void *p_fd) { - SOCKET fd = *(SOCKET*)p_fd; + krb5_socket_t fd = *(krb5_socket_t *)p_fd; int flags = 0; if(auth_context->local_address == NULL) flags |= KRB5_AUTH_CONTEXT_GENERATE_LOCAL_FULL_ADDR; diff --git a/lib/krb5/net_read.c b/lib/krb5/net_read.c index 512a3ccef..6e3023335 100644 --- a/lib/krb5/net_read.c +++ b/lib/krb5/net_read.c @@ -39,7 +39,7 @@ krb5_net_read (krb5_context context, void *buf, size_t len) { - SOCKET fd = *((SOCKET *)p_fd); + krb5_socket_t fd = *((krb5_socket_t *)p_fd); #ifdef SOCKET_IS_NOT_AN_FD #ifdef _MSC_VER @@ -51,7 +51,7 @@ krb5_net_read (krb5_context context, } } #else -#error Don't know how to handle socket that may be an fd +#error Dont know how to handle socket that may be an fd #endif #endif diff --git a/lib/krb5/net_write.c b/lib/krb5/net_write.c index 1561a4440..19d2a005d 100644 --- a/lib/krb5/net_write.c +++ b/lib/krb5/net_write.c @@ -39,7 +39,7 @@ krb5_net_write (krb5_context context, const void *buf, size_t len) { - SOCKET fd = *((SOCKET *)p_fd); + krb5_socket_t fd = *((krb5_socket_t *)p_fd); #ifdef SOCKET_IS_NOT_AN_FD #ifdef _MSC_VER @@ -51,7 +51,7 @@ krb5_net_write (krb5_context context, } } #else -#error Don't know how to handle SOCKET that may be an fd +#error Dont know how to handle SOCKET that may be an fd #endif #endif @@ -65,7 +65,7 @@ krb5_net_write_block(krb5_context context, size_t len, time_t timeout) { - SOCKET fd = *((SOCKET *)p_fd); + krb5_socket_t fd = *((krb5_socket_t *)p_fd); int ret; struct timeval tv, *tvp; const char *cbuf = (const char *)buf; diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index e184db460..3723d98a6 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -47,7 +47,7 @@ struct send_to_kdc { */ static int -recv_loop (SOCKET fd, +recv_loop (krb5_socket_t fd, time_t tmout, int udp, size_t limit, @@ -113,7 +113,7 @@ recv_loop (SOCKET fd, */ static int -send_and_recv_udp(SOCKET fd, +send_and_recv_udp(krb5_socket_t fd, time_t tmout, const krb5_data *req, krb5_data *rep) @@ -132,7 +132,7 @@ send_and_recv_udp(SOCKET fd, */ static int -send_and_recv_tcp(SOCKET fd, +send_and_recv_tcp(krb5_socket_t fd, time_t tmout, const krb5_data *req, krb5_data *rep) @@ -164,7 +164,7 @@ send_and_recv_tcp(SOCKET fd, } int -_krb5_send_and_recv_tcp(SOCKET fd, +_krb5_send_and_recv_tcp(krb5_socket_t fd, time_t tmout, const krb5_data *req, krb5_data *rep) @@ -177,7 +177,7 @@ _krb5_send_and_recv_tcp(SOCKET fd, */ static int -send_and_recv_http(SOCKET fd, +send_and_recv_http(krb5_socket_t fd, time_t tmout, const char *prefix, const krb5_data *req, @@ -266,7 +266,7 @@ send_via_proxy (krb5_context context, struct addrinfo hints; struct addrinfo *ai, *a; int ret; - SOCKET s = INVALID_SOCKET; + krb5_socket_t s = INVALID_SOCKET; char portstr[NI_MAXSERV]; if (proxy == NULL) @@ -370,7 +370,7 @@ krb5_sendto (krb5_context context, krb5_data *receive) { krb5_error_code ret; - SOCKET fd; + krb5_socket_t fd; int i; krb5_data_zero(receive); diff --git a/lib/krb5/store_fd.c b/lib/krb5/store_fd.c index a8974b649..bd357dbe3 100644 --- a/lib/krb5/store_fd.c +++ b/lib/krb5/store_fd.c @@ -86,7 +86,7 @@ fd_free(krb5_storage * sp) */ KRB5_LIB_FUNCTION krb5_storage * KRB5_LIB_CALL -krb5_storage_from_fd(SOCKET fd_in) +krb5_storage_from_fd(krb5_socket_t fd_in) { krb5_storage *sp; int fd; @@ -99,7 +99,7 @@ krb5_storage_from_fd(SOCKET fd_in) fd = _open_osfhandle(fd_in, 0); } #else -#error Don't know how to deal with fd that may or may not be a socket. +#error Dont know how to deal with fd that may or may not be a socket. #endif #else /* SOCKET_IS_NOT_AN_FD */ fd = dup(fd_in); From f1c0c1bba381637caec073c41eb46061f8fe7562 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Wed, 25 Nov 2009 05:29:18 +0100 Subject: [PATCH 091/134] prefix SOCKET symbols with rk_ --- kdc/connect.c | 71 +++++++++++++++--------------- kdc/hpropd.c | 2 +- lib/kadm5/ipropd_master.c | 41 ++++++++--------- lib/kadm5/private.h | 2 +- lib/krb5/auth_context.c | 8 ++-- lib/krb5/context.c | 8 +--- lib/krb5/net_read.c | 17 +------ lib/krb5/net_write.c | 24 +++------- lib/krb5/send_to_kdc.c | 4 +- lib/krb5/store_fd.c | 4 +- lib/roken/NTMakefile | 2 +- lib/roken/getifaddrs-test.c | 4 +- lib/roken/mini_inetd.c | 36 +++++++-------- lib/roken/net_read.c | 10 +++-- lib/roken/net_write.c | 8 ++-- lib/roken/roken-common.h | 17 +++---- lib/roken/roken.h.in | 64 +++++++++++---------------- lib/roken/sendmsg.c | 88 ++++++++++++++++++++++++++++++++++++- lib/roken/sendmsg_w32.c | 86 ------------------------------------ lib/roken/socket.c | 27 ++++++------ lib/roken/test-mini_inetd.c | 59 ++++++++++++++----------- 21 files changed, 272 insertions(+), 310 deletions(-) delete mode 100644 lib/roken/sendmsg_w32.c diff --git a/kdc/connect.c b/kdc/connect.c index d55415e41..58126ecef 100644 --- a/kdc/connect.c +++ b/kdc/connect.c @@ -217,7 +217,7 @@ parse_ports(krb5_context context, */ struct descr { - SOCKET s; + krb5_socket_t s; int type; int port; unsigned char *buf; @@ -235,7 +235,7 @@ init_descr(struct descr *d) { memset(d, 0, sizeof(*d)); d->sa = (struct sockaddr *)&d->__ss; - d->s = INVALID_SOCKET; + d->s = rk_INVALID_SOCKET; } /* @@ -271,7 +271,7 @@ init_socket(krb5_context context, if (ret) { krb5_warn(context, ret, "krb5_addr2sockaddr"); closesocket(d->s); - d->s = INVALID_SOCKET; + d->s = rk_INVALID_SOCKET; return; } @@ -279,9 +279,9 @@ init_socket(krb5_context context, return; d->s = socket(family, type, 0); - if(IS_BAD_SOCKET(d->s)){ + if(rk_IS_BAD_SOCKET(d->s)){ krb5_warn(context, errno, "socket(%d, %d, 0)", family, type); - d->s = INVALID_SOCKET; + d->s = rk_INVALID_SOCKET; return; } #if defined(HAVE_SETSOCKOPT) && defined(SOL_SOCKET) && defined(SO_REUSEADDR) @@ -293,24 +293,24 @@ init_socket(krb5_context context, d->type = type; d->port = port; - if(IS_SOCKET_ERROR(bind(d->s, sa, sa_size))){ + if(rk_IS_SOCKET_ERROR(bind(d->s, sa, sa_size))){ char a_str[256]; size_t len; krb5_print_address (a, a_str, sizeof(a_str), &len); krb5_warn(context, errno, "bind %s/%d", a_str, ntohs(port)); closesocket(d->s); - d->s = INVALID_SOCKET; + d->s = rk_INVALID_SOCKET; return; } - if(type == SOCK_STREAM && IS_SOCKET_ERROR(listen(d->s, SOMAXCONN))){ + if(type == SOCK_STREAM && rk_IS_SOCKET_ERROR(listen(d->s, SOMAXCONN))){ char a_str[256]; size_t len; krb5_print_address (a, a_str, sizeof(a_str), &len); krb5_warn(context, errno, "listen %s/%d", a_str, ntohs(port)); closesocket(d->s); - d->s = INVALID_SOCKET; + d->s = rk_INVALID_SOCKET; return; } } @@ -348,7 +348,7 @@ init_sockets(krb5_context context, for (j = 0; j < addresses.len; ++j) { init_socket(context, config, &d[num], &addresses.val[j], ports[i].family, ports[i].type, ports[i].port); - if(d[num].s != INVALID_SOCKET){ + if(d[num].s != rk_INVALID_SOCKET){ char a_str[80]; size_t len; @@ -423,15 +423,16 @@ send_reply(krb5_context context, l[1] = (reply->length >> 16) & 0xff; l[2] = (reply->length >> 8) & 0xff; l[3] = reply->length & 0xff; - if(IS_SOCKET_ERROR(sendto(d->s, l, sizeof(l), 0, d->sa, d->sock_len))) { + if(rk_IS_SOCKET_ERROR(sendto(d->s, l, sizeof(l), 0, d->sa, d->sock_len))) { kdc_log (context, config, - 0, "sendto(%s): %s", d->addr_string, strerror(SOCK_ERRNO)); + 0, "sendto(%s): %s", d->addr_string, + strerror(rk_SOCK_ERRNO)); return; } } - if(IS_SOCKET_ERROR(sendto(d->s, reply->data, reply->length, 0, d->sa, d->sock_len))) { - kdc_log (context, config, - 0, "sendto(%s): %s", d->addr_string, strerror(SOCK_ERRNO)); + if(rk_IS_SOCKET_ERROR(sendto(d->s, reply->data, reply->length, 0, d->sa, d->sock_len))) { + kdc_log (context, config, 0, "sendto(%s): %s", d->addr_string, + strerror(rk_SOCK_ERRNO)); return; } } @@ -489,8 +490,8 @@ handle_udp(krb5_context context, d->sock_len = sizeof(d->__ss); n = recvfrom(d->s, buf, max_request, 0, d->sa, &d->sock_len); - if(IS_SOCKET_ERROR(n)) - krb5_warn(context, SOCK_ERRNO, "recvfrom"); + if(rk_IS_SOCKET_ERROR(n)) + krb5_warn(context, rk_SOCK_ERRNO, "recvfrom"); else { addr_to_string (context, d->sa, d->sock_len, d->addr_string, sizeof(d->addr_string)); @@ -523,9 +524,9 @@ clear_descr(struct descr *d) if(d->buf) memset(d->buf, 0, d->size); d->len = 0; - if(d->s != INVALID_SOCKET) + if(d->s != rk_INVALID_SOCKET) closesocket(d->s); - d->s = INVALID_SOCKET; + d->s = rk_INVALID_SOCKET; } @@ -559,15 +560,15 @@ add_new_tcp (krb5_context context, krb5_kdc_configuration *config, struct descr *d, int parent, int child) { - SOCKET s; + krb5_socket_t s; if (child == -1) return; d[child].sock_len = sizeof(d[child].__ss); s = accept(d[parent].s, d[child].sa, &d[child].sock_len); - if(IS_BAD_SOCKET(s)) { - krb5_warn(context, SOCK_ERRNO, "accept"); + if(rk_IS_BAD_SOCKET(s)) { + krb5_warn(context, rk_SOCK_ERRNO, "accept"); return; } @@ -720,14 +721,14 @@ handle_http_tcp (krb5_context context, kdc_log(context, config, 0, "HTTP request from %s is non KDC request", d->addr_string); kdc_log(context, config, 5, "HTTP request: %s", t); free(data); - if (IS_SOCKET_ERROR(send(d->s, proto, strlen(proto), 0))) { + if (rk_IS_SOCKET_ERROR(send(d->s, proto, strlen(proto), 0))) { kdc_log(context, config, 0, "HTTP write failed: %s: %s", - d->addr_string, strerror(SOCK_ERRNO)); + d->addr_string, strerror(rk_SOCK_ERRNO)); return -1; } - if (IS_SOCKET_ERROR(send(d->s, msg, strlen(msg), 0))) { + if (rk_IS_SOCKET_ERROR(send(d->s, msg, strlen(msg), 0))) { kdc_log(context, config, 0, "HTTP write failed: %s: %s", - d->addr_string, strerror(SOCK_ERRNO)); + d->addr_string, strerror(rk_SOCK_ERRNO)); return -1; } return -1; @@ -740,16 +741,16 @@ handle_http_tcp (krb5_context context, "Pragma: no-cache\r\n" "Content-type: application/octet-stream\r\n" "Content-transfer-encoding: binary\r\n\r\n"; - if (IS_SOCKET_ERROR(send(d->s, proto, strlen(proto), 0))) { + if (rk_IS_SOCKET_ERROR(send(d->s, proto, strlen(proto), 0))) { free(data); kdc_log(context, config, 0, "HTTP write failed: %s: %s", - d->addr_string, strerror(SOCK_ERRNO)); + d->addr_string, strerror(rk_SOCK_ERRNO)); return -1; } - if (IS_SOCKET_ERROR(send(d->s, msg, strlen(msg), 0))) { + if (rk_IS_SOCKET_ERROR(send(d->s, msg, strlen(msg), 0))) { free(data); kdc_log(context, config, 0, "HTTP write failed: %s: %s", - d->addr_string, strerror(SOCK_ERRNO)); + d->addr_string, strerror(rk_SOCK_ERRNO)); return -1; } } @@ -780,8 +781,8 @@ handle_tcp(krb5_context context, } n = recvfrom(d[idx].s, buf, sizeof(buf), 0, NULL, NULL); - if(IS_SOCKET_ERROR(n)){ - krb5_warn(context, SOCK_ERRNO, "recvfrom failed from %s to %s/%d", + if(rk_IS_SOCKET_ERROR(n)){ + krb5_warn(context, rk_SOCK_ERRNO, "recvfrom failed from %s to %s/%d", d[idx].addr_string, descr_type(d + idx), ntohs(d[idx].port)); return; @@ -867,7 +868,7 @@ loop(krb5_context context, FD_ZERO(&fds); for(i = 0; i < ndescr; i++) { - if(!IS_BAD_SOCKET(d[i].s)){ + if(!rk_IS_BAD_SOCKET(d[i].s)){ if(d[i].type == SOCK_STREAM && d[i].timeout && d[i].timeout < time(NULL)) { kdc_log(context, config, 1, @@ -909,11 +910,11 @@ loop(krb5_context context, break; case -1: if (errno != EINTR) - krb5_warn(context, SOCK_ERRNO, "select"); + krb5_warn(context, rk_SOCK_ERRNO, "select"); break; default: for(i = 0; i < ndescr; i++) - if(!IS_BAD_SOCKET(d[i].s) && FD_ISSET(d[i].s, &fds)) { + if(!rk_IS_BAD_SOCKET(d[i].s) && FD_ISSET(d[i].s, &fds)) { if(d[i].type == SOCK_DGRAM) handle_udp(context, config, &d[i]); else if(d[i].type == SOCK_STREAM) diff --git a/kdc/hpropd.c b/kdc/hpropd.c index 1f86257db..2fbcbc4a4 100644 --- a/kdc/hpropd.c +++ b/kdc/hpropd.c @@ -78,7 +78,7 @@ main(int argc, char **argv) krb5_principal c1, c2; krb5_authenticator authent; krb5_keytab keytab; - SOCKET sock = INVALID_SOCKET; + krb5_socket_t sock = rk_INVALID_SOCKET; int close_socket = 0; HDB *db = NULL; int optidx = 0; diff --git a/lib/kadm5/ipropd_master.c b/lib/kadm5/ipropd_master.c index e3d574d0f..17d19a8f5 100644 --- a/lib/kadm5/ipropd_master.c +++ b/lib/kadm5/ipropd_master.c @@ -45,13 +45,13 @@ static int time_before_gone; const char *master_hostname; -static SOCKET +static krb5_socket_t make_signal_socket (krb5_context context) { #ifndef NO_UNIX_SOCKETS struct sockaddr_un addr; const char *fn; - SOCKET fd; + krb5_socket_t fd; fn = kadm5_log_signal_socket(context); @@ -67,30 +67,30 @@ make_signal_socket (krb5_context context) return fd; #else struct addrinfo *ai = NULL; - SOCKET fd; + krb5_socket_t fd; kadm5_log_signal_socket_info(context, 1, &ai); fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); - if (IS_BAD_SOCKET(fd)) - krb5_err (context, 1, SOCK_ERRNO, "socket AF=%d", ai->ai_family); + if (rk_IS_BAD_SOCKET(fd)) + krb5_err (context, 1, rk_SOCK_ERRNO, "socket AF=%d", ai->ai_family); - if (IS_SOCKET_ERROR( bind (fd, ai->ai_addr, ai->ai_addrlen) )) - krb5_err (context, 1, SOCK_ERRNO, "bind"); + if (rk_IS_SOCKET_ERROR( bind (fd, ai->ai_addr, ai->ai_addrlen) )) + krb5_err (context, 1, rk_SOCK_ERRNO, "bind"); return fd; #endif } -static SOCKET +static krb5_socket_t make_listen_socket (krb5_context context, const char *port_str) { - SOCKET fd; + krb5_socket_t fd; int one = 1; struct sockaddr_in addr; fd = socket (AF_INET, SOCK_STREAM, 0); - if (IS_BAD_SOCKET(fd)) - krb5_err (context, 1, SOCK_ERRNO, "socket AF_INET"); + if (rk_IS_BAD_SOCKET(fd)) + krb5_err (context, 1, rk_SOCK_ERRNO, "socket AF_INET"); setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)); memset (&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; @@ -120,7 +120,7 @@ make_listen_socket (krb5_context context, const char *port_str) } struct slave { - SOCKET fd; + krb5_socket_t fd; struct sockaddr_in addr; char *name; krb5_auth_context ac; @@ -195,9 +195,9 @@ slave_dead(krb5_context context, slave *s) { krb5_warnx(context, "slave %s dead", s->name); - if (!IS_BAD_SOCKET(s->fd)) { + if (!rk_IS_BAD_SOCKET(s->fd)) { closesocket (s->fd); - s->fd = INVALID_SOCKET; + s->fd = rk_INVALID_SOCKET; } s->flags |= SLAVE_F_DEAD; slave_seen(s); @@ -208,7 +208,7 @@ remove_slave (krb5_context context, slave *s, slave **root) { slave **p; - if (!IS_BAD_SOCKET(s->fd)) + if (!rk_IS_BAD_SOCKET(s->fd)) closesocket (s->fd); if (s->name) free (s->name); @@ -224,7 +224,8 @@ remove_slave (krb5_context context, slave *s, slave **root) } static void -add_slave (krb5_context context, krb5_keytab keytab, slave **root, SOCKET fd) +add_slave (krb5_context context, krb5_keytab keytab, slave **root, + krb5_socket_t fd) { krb5_principal server; krb5_error_code ret; @@ -243,8 +244,8 @@ add_slave (krb5_context context, krb5_keytab keytab, slave **root, SOCKET fd) addr_len = sizeof(s->addr); s->fd = accept (fd, (struct sockaddr *)&s->addr, &addr_len); - if (IS_BAD_SOCKET(s->fd)) { - krb5_warn (context, errno, "accept"); + if (rk_IS_BAD_SOCKET(s->fd)) { + krb5_warn (context, rk_SOCK_ERRNO, "accept"); goto error; } if (master_hostname) @@ -309,7 +310,7 @@ error: struct prop_context { krb5_auth_context auth_context; - SOCKET fd; + krb5_socket_t fd; }; static int @@ -759,7 +760,7 @@ main(int argc, char **argv) void *kadm_handle; kadm5_server_context *server_context; kadm5_config_params conf; - SOCKET signal_fd, listen_fd; + krb5_socket_t signal_fd, listen_fd; int log_fd; slave *slaves = NULL; uint32_t current_version = 0, old_version = 0; diff --git a/lib/kadm5/private.h b/lib/kadm5/private.h index c1fec6feb..7c5b27f17 100644 --- a/lib/kadm5/private.h +++ b/lib/kadm5/private.h @@ -79,7 +79,7 @@ typedef struct kadm5_log_context { #else struct addrinfo *socket_info; #endif - SOCKET socket_fd; + krb5_socket_t socket_fd; } kadm5_log_context; typedef struct kadm5_server_context { diff --git a/lib/krb5/auth_context.c b/lib/krb5/auth_context.c index db24e73a4..db1833b4b 100644 --- a/lib/krb5/auth_context.c +++ b/lib/krb5/auth_context.c @@ -170,9 +170,9 @@ krb5_auth_con_genaddrs(krb5_context context, if(flags & KRB5_AUTH_CONTEXT_GENERATE_LOCAL_ADDR) { if (auth_context->local_address == NULL) { len = sizeof(ss_local); - if(IS_SOCKET_ERROR(getsockname(fd, local, &len))) { + if(rk_IS_SOCKET_ERROR(getsockname(fd, local, &len))) { char buf[128]; - ret = SOCK_ERRNO; + ret = rk_SOCK_ERRNO; strerror_r(ret, buf, sizeof(buf)); krb5_set_error_message(context, ret, "getsockname: %s", buf); goto out; @@ -188,9 +188,9 @@ krb5_auth_con_genaddrs(krb5_context context, } if(flags & KRB5_AUTH_CONTEXT_GENERATE_REMOTE_ADDR) { len = sizeof(ss_remote); - if(IS_SOCKET_ERROR(getpeername(fd, remote, &len))) { + if(rk_IS_SOCKET_ERROR(getpeername(fd, remote, &len))) { char buf[128]; - ret = SOCK_ERRNO; + ret = rk_SOCK_ERRNO; strerror_r(ret, buf, sizeof(buf)); krb5_set_error_message(context, ret, "getpeername: %s", buf); goto out; diff --git a/lib/krb5/context.c b/lib/krb5/context.c index 529247e76..d3dcb3064 100644 --- a/lib/krb5/context.c +++ b/lib/krb5/context.c @@ -363,10 +363,8 @@ krb5_init_context(krb5_context *context) if (ret) goto out; #endif -#ifdef NEED_SOCK_INIT - if (SOCK_INIT) + if (SOCK_INIT()) p->flags |= KRB5_CTX_F_SOCKETS_INITIALIZED; -#endif out: if(ret) { @@ -535,11 +533,9 @@ krb5_free_context(krb5_context context) HEIMDAL_MUTEX_destroy(context->mutex); free(context->mutex); -#ifdef NEED_SOCK_INIT if (context->flags & KRB5_CTX_F_SOCKETS_INITIALIZED) { - SOCK_EXIT; + SOCK_EXIT(); } -#endif memset(context, 0, sizeof(*context)); free(context); diff --git a/lib/krb5/net_read.c b/lib/krb5/net_read.c index 6e3023335..f6d781c27 100644 --- a/lib/krb5/net_read.c +++ b/lib/krb5/net_read.c @@ -40,20 +40,5 @@ krb5_net_read (krb5_context context, size_t len) { krb5_socket_t fd = *((krb5_socket_t *)p_fd); - -#ifdef SOCKET_IS_NOT_AN_FD -#ifdef _MSC_VER - { - HANDLE h = _get_osfhandle(fd); - - if (h != INVALID_HANDLE_VALUE) { - return net_read (fd, buf, len); - } - } -#else -#error Dont know how to handle socket that may be an fd -#endif -#endif - - return net_read_s (fd, buf, len); + return net_read(fd, buf, len); } diff --git a/lib/krb5/net_write.c b/lib/krb5/net_write.c index 19d2a005d..82f699374 100644 --- a/lib/krb5/net_write.c +++ b/lib/krb5/net_write.c @@ -40,24 +40,10 @@ krb5_net_write (krb5_context context, size_t len) { krb5_socket_t fd = *((krb5_socket_t *)p_fd); - -#ifdef SOCKET_IS_NOT_AN_FD -#ifdef _MSC_VER - { - HANDLE h = _get_osfhandle(fd); - - if (h != INVALID_HANDLE_VALUE) { - return net_write (fd, buf, len); - } - } -#else -#error Dont know how to handle SOCKET that may be an fd -#endif -#endif - - return net_write_s (fd, buf, len); + return net_write(fd, buf, len); } +KRB5_DEPRECATED KRB5_LIB_FUNCTION krb5_ssize_t KRB5_LIB_CALL krb5_net_write_block(krb5_context context, void *p_fd, @@ -85,8 +71,8 @@ krb5_net_write_block(krb5_context context, tvp = NULL; ret = select(fd + 1, NULL, &wfds, NULL, tvp); - if (IS_SOCKET_ERROR(ret)) { - if (SOCK_ERRNO == EINTR) + if (rk_IS_SOCKET_ERROR(ret)) { + if (rk_SOCK_ERRNO == EINTR) continue; return -1; } @@ -99,7 +85,7 @@ krb5_net_write_block(krb5_context context, count = send (fd, cbuf, rem, 0); - if (IS_SOCKET_ERROR(count)) { + if (rk_IS_SOCKET_ERROR(count)) { return -1; } diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index 3723d98a6..c539babb8 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -266,7 +266,7 @@ send_via_proxy (krb5_context context, struct addrinfo hints; struct addrinfo *ai, *a; int ret; - krb5_socket_t s = INVALID_SOCKET; + krb5_socket_t s = rk_INVALID_SOCKET; char portstr[NI_MAXSERV]; if (proxy == NULL) @@ -416,7 +416,7 @@ krb5_sendto (krb5_context context, for (a = ai; a != NULL; a = a->ai_next) { fd = socket (a->ai_family, a->ai_socktype | SOCK_CLOEXEC, a->ai_protocol); - if (IS_BAD_SOCKET(fd)) + if (rk_IS_BAD_SOCKET(fd)) continue; rk_cloexec(fd); if (connect (fd, a->ai_addr, a->ai_addrlen) < 0) { diff --git a/lib/krb5/store_fd.c b/lib/krb5/store_fd.c index bd357dbe3..bb261be2d 100644 --- a/lib/krb5/store_fd.c +++ b/lib/krb5/store_fd.c @@ -91,7 +91,7 @@ krb5_storage_from_fd(krb5_socket_t fd_in) krb5_storage *sp; int fd; -#ifdef SOCKET_IS_NOT_AN_FD +#ifdef _WIN32 #ifdef _MSC_VER if (_get_osfhandle(fd_in) != -1) { fd = dup(fd_in); @@ -101,7 +101,7 @@ krb5_storage_from_fd(krb5_socket_t fd_in) #else #error Dont know how to deal with fd that may or may not be a socket. #endif -#else /* SOCKET_IS_NOT_AN_FD */ +#else fd = dup(fd_in); #endif diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile index f6d2e30dc..05f01382e 100644 --- a/lib/roken/NTMakefile +++ b/lib/roken/NTMakefile @@ -79,7 +79,7 @@ libroken_la_OBJS = \ $(OBJ)\resolve.obj \ $(OBJ)\roken_gethostby.obj \ $(OBJ)\rtbl.obj \ - $(OBJ)\sendmsg_w32.obj \ + $(OBJ)\sendmsg.obj \ $(OBJ)\setenv.obj \ $(OBJ)\setprogname.obj \ $(OBJ)\simple_exec_w32.obj \ diff --git a/lib/roken/getifaddrs-test.c b/lib/roken/getifaddrs-test.c index 2762e4552..34141a2d3 100644 --- a/lib/roken/getifaddrs-test.c +++ b/lib/roken/getifaddrs-test.c @@ -80,7 +80,7 @@ main(int argc, char **argv) int ret; if (SOCK_INIT) - errx(1, "Couldn't initialize sockets. Err=%d\n", SOCK_ERRNO); + errx(1, "Couldn't initialize sockets. Err=%d\n", rk_SOCK_ERRNO); ret = getifaddrs(&addrs); if (ret != 0) @@ -95,7 +95,7 @@ main(int argc, char **argv) freeifaddrs(addrs); if (SOCK_EXIT) - errx(1, "Couldn't uninitialize sockets. Err=%d\n", SOCK_ERRNO); + errx(1, "Couldn't uninitialize sockets. Err=%d\n", rk_SOCK_ERRNO); return 0; } diff --git a/lib/roken/mini_inetd.c b/lib/roken/mini_inetd.c index 7f9b61681..1cf3815d1 100644 --- a/lib/roken/mini_inetd.c +++ b/lib/roken/mini_inetd.c @@ -41,12 +41,12 @@ */ static void -accept_it (SOCKET s, SOCKET *ret_socket) +accept_it (rk_socket_t s, rk_socket_t *ret_socket) { - SOCKET as; + rk_socket_t as; as = accept(s, NULL, NULL); - if(IS_BAD_SOCKET(as)) + if(rk_IS_BAD_SOCKET(as)) err (1, "accept"); if (ret_socket) { @@ -54,20 +54,16 @@ accept_it (SOCKET s, SOCKET *ret_socket) *ret_socket = as; } else { - int fd = fd_from_socket(as, 0); + int fd = socket_to_fd(as, 0); - /* We would use _O_RDONLY for the fd_from_socket() call for + /* We would use _O_RDONLY for the socket_to_fd() call for STDIN, but there are instances where we assume that STDIN is a r/w socket. */ dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); -#ifdef SOCKET_IS_NOT_AN_FD - close(fd); -#else - closesocket(as); -#endif + closesocket(fd); } } @@ -90,14 +86,14 @@ accept_it (SOCKET s, SOCKET *ret_socket) * @see mini_inetd() */ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -mini_inetd_addrinfo (struct addrinfo *ai, SOCKET *ret_socket) +mini_inetd_addrinfo (struct addrinfo *ai, rk_socket_t *ret_socket) { int ret; struct addrinfo *a; int n, nalloc, i; - SOCKET *fds; + rk_socket_t *fds; fd_set orig_read_set, read_set; - SOCKET max_fd = (SOCKET)-1; + rk_socket_t max_fd = (rk_socket_t)-1; for (nalloc = 0, a = ai; a != NULL; a = a->ai_next) ++nalloc; @@ -112,20 +108,20 @@ mini_inetd_addrinfo (struct addrinfo *ai, SOCKET *ret_socket) for (i = 0, a = ai; a != NULL; a = a->ai_next) { fds[i] = socket (a->ai_family, a->ai_socktype, a->ai_protocol); - if (IS_BAD_SOCKET(fds[i])) + if (rk_IS_BAD_SOCKET(fds[i])) continue; socket_set_reuseaddr (fds[i], 1); socket_set_ipv6only(fds[i], 1); - if (IS_SOCKET_ERROR(bind (fds[i], a->ai_addr, a->ai_addrlen))) { + if (rk_IS_SOCKET_ERROR(bind (fds[i], a->ai_addr, a->ai_addrlen))) { warn ("bind af = %d", a->ai_family); closesocket(fds[i]); - fds[i] = INVALID_SOCKET; + fds[i] = rk_INVALID_SOCKET; continue; } - if (IS_SOCKET_ERROR(listen (fds[i], SOMAXCONN))) { + if (rk_IS_SOCKET_ERROR(listen (fds[i], SOMAXCONN))) { warn ("listen af = %d", a->ai_family); closesocket(fds[i]); - fds[i] = INVALID_SOCKET; + fds[i] = rk_INVALID_SOCKET; continue; } #ifndef NO_LIMIT_FD_SETSIZE @@ -144,7 +140,7 @@ mini_inetd_addrinfo (struct addrinfo *ai, SOCKET *ret_socket) read_set = orig_read_set; ret = select (max_fd + 1, &read_set, NULL, NULL, NULL); - if (IS_SOCKET_ERROR(ret) && SOCK_ERRNO != EINTR) + if (rk_IS_SOCKET_ERROR(ret) && rk_SOCK_ERRNO != EINTR) err (1, "select"); } while (ret <= 0); @@ -177,7 +173,7 @@ mini_inetd_addrinfo (struct addrinfo *ai, SOCKET *ret_socket) * @see mini_inetd_addrinfo() */ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -mini_inetd (int port, SOCKET * ret_socket) +mini_inetd (int port, rk_socket_t * ret_socket) { int error; struct addrinfo *ai, hints; diff --git a/lib/roken/net_read.c b/lib/roken/net_read.c index 1010d8b8e..b57dda3dd 100644 --- a/lib/roken/net_read.c +++ b/lib/roken/net_read.c @@ -39,8 +39,10 @@ * Like read but never return partial data. */ +#ifndef _WIN32 + ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL -net_read (int fd, void *buf, size_t nbytes) +net_read (rk_socket_t fd, void *buf, size_t nbytes) { char *cbuf = (char *)buf; ssize_t count; @@ -62,10 +64,10 @@ net_read (int fd, void *buf, size_t nbytes) return nbytes; } -#ifdef SOCKET_IS_NOT_AN_FD +#else ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL -net_read_s (SOCKET sock, void *buf, size_t nbytes) +net_read(rk_socket_t sock, void *buf, size_t nbytes) { char *cbuf = (char *)buf; ssize_t count; @@ -80,7 +82,7 @@ net_read_s (SOCKET sock, void *buf, size_t nbytes) WSACancelBlockingCall(). */ #ifndef HAVE_WINSOCK - if (SOCK_ERRNO == EINTR) + if (rk_SOCK_ERRNO == EINTR) continue; #endif return count; diff --git a/lib/roken/net_write.c b/lib/roken/net_write.c index a12c06a49..94c9df1c3 100644 --- a/lib/roken/net_write.c +++ b/lib/roken/net_write.c @@ -39,8 +39,10 @@ * Like write but never return partial data. */ +#ifndef _WIN32 + ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL -net_write (int fd, const void *buf, size_t nbytes) +net_write (rk_socket_t fd, const void *buf, size_t nbytes) { const char *cbuf = (const char *)buf; ssize_t count; @@ -60,10 +62,10 @@ net_write (int fd, const void *buf, size_t nbytes) return nbytes; } -#ifdef SOCKET_IS_NOT_AN_FD +#else ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL -net_write_s (SOCKET sock, const void *buf, size_t nbytes) +net_write(rk_socket_t sock, const void *buf, size_t nbytes) { const char *cbuf = (const char *)buf; ssize_t count; diff --git a/lib/roken/roken-common.h b/lib/roken/roken-common.h index 918254158..bdaedfa84 100644 --- a/lib/roken/roken-common.h +++ b/lib/roken/roken-common.h @@ -392,30 +392,27 @@ socket_set_port (struct sockaddr *, int); #define socket_set_portrange rk_socket_set_portrange ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_portrange (SOCKET, int, int); +socket_set_portrange (rk_socket_t, int, int); #define socket_set_debug rk_socket_set_debug ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_debug (SOCKET); +socket_set_debug (rk_socket_t); #define socket_set_tos rk_socket_set_tos ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_tos (SOCKET, int); +socket_set_tos (rk_socket_t, int); #define socket_set_reuseaddr rk_socket_set_reuseaddr ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_reuseaddr (SOCKET, int); +socket_set_reuseaddr (rk_socket_t, int); #define socket_set_ipv6only rk_socket_set_ipv6only ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_ipv6only (SOCKET, int); +socket_set_ipv6only (rk_socket_t, int); -#ifdef SOCKET_IS_NOT_AN_FD +#define socket_to_fd rk_socket_to_fd ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL -fd_from_socket(SOCKET, int); -#else -#define fd_from_socket(s,f) (s) -#endif +socket_to_fd(rk_socket_t, int); #define vstrcollect rk_vstrcollect ROKEN_LIB_FUNCTION char ** ROKEN_LIB_CALL diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 5dd6652ac..9b7773b3f 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -56,36 +56,36 @@ #include -#define IS_BAD_SOCKET(s) ((s) == INVALID_SOCKET) -#define IS_SOCKET_ERROR(rv) ((rv) == SOCKET_ERROR) -#define SOCK_ERRNO WSAGetLastError() -#define SOCK_IOCTL(s,c,a) ioctlsocket((s),(c),(a)) +typedef SOCKET rk_socket_t; + +#define rk_IS_BAD_SOCKET(s) ((s) == INVALID_SOCKET) +#define rk_IS_SOCKET_ERROR(rv) ((rv) == SOCKET_ERROR) +#define rk_SOCK_ERRNO WSAGetLastError() +#define rk_SOCK_IOCTL(s,c,a) ioctlsocket((s),(c),(a)) #define ETIMEDOUT WSAETIMEDOUT #define EWOULDBLOCK WSAEWOULDBLOCK #define ENOTSOCK WSAENOTSOCK -#define SOCK_INIT rk_WSAStartup() -#define SOCK_EXIT rk_WSACleanup() -#define NEED_SOCK_INIT 1 +#define rk_SOCK_INIT rk_WSAStartup() +#define rk_SOCK_EXIT rk_WSACleanup() ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSAStartup(void); ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_WSACleanup(void); #else /* not WinSock */ -typedef int SOCKET; +typedef int rk_socket_t; -#define closesocket(x) close(x) -#define SOCK_IOCTL(s,c,a) ioctl((s),(c),(a)) -#define IS_BAD_SOCKET(s) ((s) < 0) -#define IS_SOCKET_ERROR(rv) ((rv) < 0) -#define SOCK_ERRNO errno -#define INVALID_SOCKET (-1) +#define rk_closesocket(x) close(x) +#define rk_SOCK_IOCTL(s,c,a) ioctl((s),(c),(a)) +#define rk_IS_BAD_SOCKET(s) ((s) < 0) +#define rk_IS_SOCKET_ERROR(rv) ((rv) < 0) +#define rk_SOCK_ERRNO errno +#define rk_INVALID_SOCKET (-1) -#define SOCK_INIT (0) -#define SOCK_EXIT (0) -#undef NEED_SOCK_INIT +#define rk_SOCK_INIT 0 +#define rk_SOCK_EXIT 0 #endif @@ -654,24 +654,14 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL roken_vconcat (char *, size_t, va_list); ROKEN_LIB_FUNCTION size_t ROKEN_LIB_CALL roken_vmconcat (char **, size_t, va_list); -ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_write (int, const void *, size_t); +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL + net_write (rk_socket_t, const void *, size_t); -ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_read (int, void *, size_t); +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL + net_read (rk_socket_t, void *, size_t); -#ifdef SOCKET_IS_NOT_AN_FD - -ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_write_s (SOCKET, const void *, size_t); - -ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL net_read_s (SOCKET, void *, size_t); - -#else - -#define net_read_s net_read -#define net_write_s net_write - -#endif - -ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL issuid(void); +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + issuid(void); #ifndef HAVE_STRUCT_WINSIZE struct winsize { @@ -833,9 +823,7 @@ struct msghdr { }; ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL -sendmsg_w32(SOCKET s, const struct msghdr * msg, int flags); - -#define sendmsg(s,m,f) sendmsg_w32((s),(m),(f)) +sendmsg(rk_socket_t s, const struct msghdr * msg, int flags); #endif @@ -935,10 +923,10 @@ extern const char *__progname; #endif ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -mini_inetd_addrinfo (struct addrinfo*, SOCKET *); +mini_inetd_addrinfo (struct addrinfo*, rk_socket *); ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -mini_inetd (int, SOCKET *); +mini_inetd (int, rk_socket_t *); #ifndef HAVE_LOCALTIME_R #define localtime_r rk_localtime_r diff --git a/lib/roken/sendmsg.c b/lib/roken/sendmsg.c index d2e8b00ff..bbe5c303f 100644 --- a/lib/roken/sendmsg.c +++ b/lib/roken/sendmsg.c @@ -35,8 +35,10 @@ #include "roken.h" +#ifndef _WIN32 + ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL -sendmsg(SOCKET s, const struct msghdr *msg, int flags) +sendmsg(rk_socket_t s, const struct msghdr *msg, int flags) { ssize_t ret; size_t tot = 0; @@ -60,3 +62,87 @@ sendmsg(SOCKET s, const struct msghdr *msg, int flags) free (buf); return ret; } + +#else /* _WIN32 */ + +/*********************************************************************** + * Copyright (c) 2009, Secure Endpoints Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - 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. + * + * - Neither the name of Secure Endpoints Inc. 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 COPYRIGHT HOLDERS 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 + * COPYRIGHT HOLDER 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. + * + **********************************************************************/ + +/* + * Implementation of sendmsg() for WIN32 + * + * We are using a contrived definition of msghdr which actually uses + * an array of ::_WSABUF structures instead of ::iovec . This allows + * us to call WSASend directly using the given ::msghdr instead of + * having to allocate another array of ::_WSABUF and copying data for + * each call. + * + * Limitations: + * + * - msg->msg_name is ignored. So is msg->control. + * - WSASend() only supports ::MSG_DONTROUTE, ::MSG_OOB and + * ::MSG_PARTIAL. + * + * @param[in] s The socket to use. + * @param[in] msg The message + * @param[in] flags Flags. A combination of ::MSG_DONTROUTE, + * ::MSG_OOB and ::MSG_PARTIAL + * + * @return The number of bytes sent, on success. Or -1 on error. + */ +ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL +sendmsg_w32(rk_socket_t s, const struct msghdr * msg, int flags) +{ + int srv; + DWORD num_bytes_sent = 0; + + /* TODO: For _WIN32_WINNT >= 0x0600 we can use WSASendMsg using + WSAMSG which is a much more direct analogue to sendmsg(). */ + + srv = WSASend(s, msg->msg_iov, msg->msg_iovlen, + &num_bytes_sent, flags, NULL, NULL); + + if (srv == 0) + return (int) num_bytes_sent; + + /* srv == SOCKET_ERROR and WSAGetLastError() == WSA_IO_PENDING + indicates that a non-blocking transfer has been scheduled. + We'll have to check for that if we ever support non-blocking + I/O. */ + + return -1; +} + +#endif /* !_WIN32 */ diff --git a/lib/roken/sendmsg_w32.c b/lib/roken/sendmsg_w32.c deleted file mode 100644 index 19edf6931..000000000 --- a/lib/roken/sendmsg_w32.c +++ /dev/null @@ -1,86 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2009, Secure Endpoints Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - 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. - * - * - Neither the name of Secure Endpoints Inc. 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 COPYRIGHT HOLDERS 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 - * COPYRIGHT HOLDER 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. - * - **********************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -/** - * Implementation of sendmsg() for WIN32 - * - * We are using a contrived definition of msghdr which actually uses - * an array of ::_WSABUF structures instead of ::iovec . This allows - * us to call WSASend directly using the given ::msghdr instead of - * having to allocate another array of ::_WSABUF and copying data for - * each call. - * - * Limitations: - * - * - msg->msg_name is ignored. So is msg->control. - * - WSASend() only supports ::MSG_DONTROUTE, ::MSG_OOB and - * ::MSG_PARTIAL. - * - * @param[in] s The socket to use. - * @param[in] msg The message - * @param[in] flags Flags. A combination of ::MSG_DONTROUTE, - * ::MSG_OOB and ::MSG_PARTIAL - * - * @return The number of bytes sent, on success. Or -1 on error. - */ -ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL -sendmsg_w32(SOCKET s, const struct msghdr * msg, int flags) -{ - int srv; - DWORD num_bytes_sent = 0; - - /* TODO: For _WIN32_WINNT >= 0x0600 we can use WSASendMsg using - WSAMSG which is a much more direct analogue to sendmsg(). */ - - srv = WSASend(s, msg->msg_iov, msg->msg_iovlen, - &num_bytes_sent, flags, NULL, NULL); - - if (srv == 0) - return (int) num_bytes_sent; - - /* srv == SOCKET_ERROR and WSAGetLastError() == WSA_IO_PENDING - indicates that a non-blocking transfer has been scheduled. - We'll have to check for that if we ever support non-blocking - I/O. */ - - return -1; -} - diff --git a/lib/roken/socket.c b/lib/roken/socket.c index aa7e76ca3..24b5242ba 100644 --- a/lib/roken/socket.c +++ b/lib/roken/socket.c @@ -222,7 +222,7 @@ socket_set_port (struct sockaddr *sa, int port) * Set the range of ports to use when binding with port = 0. */ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_portrange (SOCKET sock, int restr, int af) +socket_set_portrange (rk_socket_t sock, int restr, int af) { #if defined(IP_PORTRANGE) if (af == AF_INET) { @@ -248,12 +248,12 @@ socket_set_portrange (SOCKET sock, int restr, int af) */ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_debug (SOCKET sock) +socket_set_debug (rk_socket_t sock) { #if defined(SO_DEBUG) && defined(HAVE_SETSOCKOPT) int on = 1; - if (setsockopt (sock, SOL_SOCKET, SO_DEBUG, (void *) &on, sizeof (on)) < 0) + if (setsockopt (sock, SOL_rk_socket_t, SO_DEBUG, (void *) &on, sizeof (on)) < 0) warn ("setsockopt SO_DEBUG (ignored)"); #endif } @@ -263,7 +263,7 @@ socket_set_debug (SOCKET sock) */ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_tos (SOCKET sock, int tos) +socket_set_tos (rk_socket_t sock, int tos) { #if defined(IP_TOS) && defined(HAVE_SETSOCKOPT) if (setsockopt (sock, IPPROTO_IP, IP_TOS, (void *) &tos, sizeof (int)) < 0) @@ -277,10 +277,10 @@ socket_set_tos (SOCKET sock, int tos) */ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_reuseaddr (SOCKET sock, int val) +socket_set_reuseaddr (rk_socket_t sock, int val) { #if defined(SO_REUSEADDR) && defined(HAVE_SETSOCKOPT) - if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&val, + if(setsockopt(sock, SOL_rk_socket_t, SO_REUSEADDR, (void *)&val, sizeof(val)) < 0) err (1, "setsockopt SO_REUSEADDR"); #endif @@ -291,28 +291,27 @@ socket_set_reuseaddr (SOCKET sock, int val) */ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL -socket_set_ipv6only (SOCKET sock, int val) +socket_set_ipv6only (rk_socket_t sock, int val) { #if defined(IPV6_V6ONLY) && defined(HAVE_SETSOCKOPT) setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&val, sizeof(val)); #endif } - -#ifdef SOCKET_IS_NOT_AN_FD - /** * Create a file descriptor from a socket * * While the socket handle in \a sock can be used with WinSock - * functions after calling fd_from_socket(), it should not be closed + * functions after calling socket_to_fd(), it should not be closed * with closesocket(). The socket will be closed when the associated * file descriptor is closed. */ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL -fd_from_socket(SOCKET sock, int flags) +socket_to_fd(rk_socket_t sock, int flags) { +#ifndef _WIN32 + return sock; +#else return _open_osfhandle((intptr_t) sock, flags); -} - #endif +} diff --git a/lib/roken/test-mini_inetd.c b/lib/roken/test-mini_inetd.c index 0aee4933a..fa486834b 100644 --- a/lib/roken/test-mini_inetd.c +++ b/lib/roken/test-mini_inetd.c @@ -55,31 +55,30 @@ get_address(int flags, struct addrinfo ** ret) ai.ai_protocol = PF_UNSPEC; rv = getaddrinfo("127.0.0.1", PORT_S, &ai, ret); - if (rv) { - fprintf(stderr, "[%s] getaddrinfo: %s", prog, gai_strerror(rv)); - } + if (rv) + warnx("getaddrinfo: %s", gai_strerror(rv)); return rv; } static int -get_connected_socket(SOCKET * s_ret) +get_connected_socket(rk_socket_t * s_ret) { struct addrinfo * ai = NULL; int rv = 0; - SOCKET s = INVALID_SOCKET; + rk_socket_t s = rk_INVALID_SOCKET; rv = get_address(0, &ai); if (rv) return rv; s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); - if (IS_BAD_SOCKET(s)) { + if (rk_IS_BAD_SOCKET(s)) { rv = 1; goto done; } rv = connect(s, ai->ai_addr, ai->ai_addrlen); - if (IS_SOCKET_ERROR(rv)) + if (rk_IS_SOCKET_ERROR(rv)) goto done; *s_ret = s; @@ -87,13 +86,13 @@ get_connected_socket(SOCKET * s_ret) rv = 0; done: - if (!IS_BAD_SOCKET(s)) + if (!rk_IS_BAD_SOCKET(s)) closesocket(s); if (ai) freeaddrinfo(ai); - return (rv)?SOCK_ERRNO: 0; + return (rv) ? rk_SOCK_ERRNO : 0; } const char * test_strings[] = { @@ -106,31 +105,34 @@ const char * test_strings[] = { static int test_simple_echo_client(void) { - SOCKET s = INVALID_SOCKET; + rk_socket_t s = INVALID_SOCKET; int rv; char buf[81]; int i; - fprintf (stderr, "[%s] Getting connected socket...", prog); + fprintf(stderr, "[%s] Getting connected socket...", getprogname()); rv = get_connected_socket(&s); if (rv) { - fprintf(stderr, "\n[%s] get_connected_socket() failed (%s)\n", prog, strerror(SOCK_ERRNO)); + fprintf(stderr, "\n[%s] get_connected_socket() failed (%s)\n", + getprogname(), strerror(rk_SOCK_ERRNO)); return 1; } - fprintf (stderr, "[%s] done\n", prog); + fprintf(stderr, "[%s] done\n", getprogname()); for (i=0; i < sizeof(test_strings)/sizeof(test_strings[0]); i++) { rv = send(s, test_strings[i], strlen(test_strings[i]), 0); - if (IS_SOCKET_ERROR(rv)) { - fprintf (stderr, "[%s] send() failure (%s)\n", prog, strerror(SOCK_ERRNO)); + if (rk_IS_SOCKET_ERROR(rv)) { + fprintf(stderr, "[%s] send() failure (%s)\n", + getprogname(), strerror(rk_SOCK_ERRNO)); closesocket(s); return 1; } rv = recv(s, buf, sizeof(buf), 0); - if (IS_SOCKET_ERROR(rv)) { - fprintf (stderr, "[%s] recv() failure (%s)\n", prog, strerror(SOCK_ERRNO)); + if (rk_IS_SOCKET_ERROR(rv)) { + fprintf (stderr, "[%s] recv() failure (%s)\n", + getprogname(), strerror(rk_SOCK_ERRNO)); closesocket(s); return 1; } @@ -163,12 +165,13 @@ test_simple_echo_socket(void) return test_simple_echo_client(); } else { - SOCKET s = INVALID_SOCKET; + rk_socket_t s = INVALID_SOCKET; fprintf (stderr, "[%s] Listening for connections...\n", prog); mini_inetd(htons(PORT), &s); - if (IS_BAD_SOCKET(s)) { - fprintf (stderr, "[%s] Connect failed (%s)\n", prog, strerror(SOCK_ERRNO)); + if (rk_IS_BAD_SOCKET(s)) { + fprintf (stderr, "[%s] Connect failed (%s)\n", + getprogname(), strerror(rk_SOCK_ERRNO)); } else { fprintf (stderr, "[%s] Connected\n", prog); } @@ -177,17 +180,19 @@ test_simple_echo_socket(void) char buf[81]; int rv, srv; - while ((rv = recv(s, buf, sizeof(buf), 0)) != 0 && !IS_SOCKET_ERROR(rv)) { + while ((rv = recv(s, buf, sizeof(buf), 0)) != 0 && !rk_IS_SOCKET_ERROR(rv)) { buf[rv] = 0; fprintf(stderr, "[%s] Received [%s]\n", prog, buf); /* simple echo */ srv = send(s, buf, rv, 0); if (srv != rv) { - if (IS_SOCKET_ERROR(srv)) - fprintf(stderr, "[%s] send() error [%s]\n", prog, strerror(SOCK_ERRNO)); + if (rk_IS_SOCKET_ERROR(srv)) + fprintf(stderr, "[%s] send() error [%s]\n", + getprogname(), strerror(rk_SOCK_ERRNO)); else - fprintf(stderr, "[%s] send() size mismatch %d != %d", prog, srv, rv); + fprintf(stderr, "[%s] send() size mismatch %d != %d", + getprogname(), srv, rv); } if (!strcmp(buf, "exit")) { @@ -198,7 +203,9 @@ test_simple_echo_socket(void) } } - fprintf(stderr, "[%s] recv() failed (%s)\n", prog, strerror(SOCK_ERRNO)); + fprintf(stderr, "[%s] recv() failed (%s)\n", + getprogname(), + strerror(rk_SOCK_ERRNO)); } closesocket(s); @@ -346,6 +353,8 @@ do_test(char * path) int main(int argc, char ** argv) { + setprogname(argv[0]); + if (argc == 2 && strcmp(argv[1], "--client") == 0) return do_client(); else if (argc == 2 && strcmp(argv[1], "--server") == 0) From c8fc15de860ec23cee35a563da12ec010d5d9894 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Wed, 25 Nov 2009 07:52:39 -0800 Subject: [PATCH 092/134] random number from windows csp --- lib/hcrypto/rand-w32.c | 123 +++++++++++++++++++++++++++++++++++++++++ lib/hcrypto/rand.c | 4 +- lib/hcrypto/randi.h | 1 + 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 lib/hcrypto/rand-w32.c diff --git a/lib/hcrypto/rand-w32.c b/lib/hcrypto/rand-w32.c new file mode 100644 index 000000000..d3f7cf6f5 --- /dev/null +++ b/lib/hcrypto/rand-w32.c @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2006 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. + */ + +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include "randi.h" + +static HCRYPTPROV cryptprovider = 0; + +static HCRYPTPROV +_hc_CryptProvider(void) +{ + BOOL res; + + if (cryptprovider != 0) + return cryptprovider; + + res = CryptAcquireContext(&cryptprovider, NULL, + MS_ENHANCED_PROV, PROV_RSA_FULL, + 0); + if(!res) + CryptAcquireContext(&cryptprovider, NULL, + MS_ENHANCED_PROV, PROV_RSA_FULL, + CRYPT_NEWKEYSET); + return cryptprovider; +} + +/* + * + */ + + +static void +w32crypto_seed(const void *indata, int size) +{ +} + + +static int +w32crypto_bytes(unsigned char *outdata, int size) +{ + if (CryptGenRandom(_hc_CryptProvider(), size, outdata) == 0) + return 0; + return 1; +} + +static void +w32crypto_cleanup(void) +{ +} + +static void +w32crypto_add(const void *indata, int size, double entropi) +{ +} + +static int +w32crypto_pseudorand(unsigned char *outdata, int size) +{ +} + +static int +w32crypto_status(void) +{ + if (_hc_CryptProvider() == NULL) + return 0; + return 1; +} + +const RAND_METHOD hc_rand_w32crypto_method = { + w32crypto_seed, + w32crypto_bytes, + w32crypto_cleanup, + w32crypto_add, + w32crypto_pseudorand, + w32crypto_status +}; + +const RAND_METHOD * +RAND_w32crypto_method(void) +{ + return &hc_rand_w32crypto_method; +} diff --git a/lib/hcrypto/rand.c b/lib/hcrypto/rand.c index 009498658..9f0438a34 100644 --- a/lib/hcrypto/rand.c +++ b/lib/hcrypto/rand.c @@ -60,7 +60,9 @@ init_method(void) { if (selected_meth != NULL) return; -#ifdef __APPLE__ +#if defined(_WIN32) + selected_meth = &hc_rand_w32crypto_method; +#elif defined(__APPLE__) selected_meth = &hc_rand_unix_method; #else selected_meth = &hc_rand_fortuna_method; diff --git a/lib/hcrypto/randi.h b/lib/hcrypto/randi.h index f8f6c39b3..c6c617af2 100644 --- a/lib/hcrypto/randi.h +++ b/lib/hcrypto/randi.h @@ -42,6 +42,7 @@ extern const RAND_METHOD hc_rand_fortuna_method; extern const RAND_METHOD hc_rand_unix_method; extern const RAND_METHOD hc_rand_egd_method; extern const RAND_METHOD hc_rand_timer_method; +extern const RAND_METHOD hc_rand_w32crypto_method; const RAND_METHOD * RAND_timer_method(void); From 16a890a29ca768953fc3ddea0977fe013564201b Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Wed, 25 Nov 2009 08:28:35 -0800 Subject: [PATCH 093/134] revert merged patches --- lib/roken/getarg.c | 5 ++--- lib/roken/roken-common.h | 5 ----- lib/roken/snprintf.c | 4 ---- lib/roken/socket.c | 4 ++-- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/lib/roken/getarg.c b/lib/roken/getarg.c index eac46e8f0..d182f0019 100644 --- a/lib/roken/getarg.c +++ b/lib/roken/getarg.c @@ -286,7 +286,6 @@ arg_printusage_i18n (struct getargs *args, } if (args[i].short_name && !ISFLAG(args[i])) { snprintf(buf, sizeof(buf), "[-%c", args[i].short_name); - buf[sizeof(buf)/sizeof(buf[0]) - 1] = '\0'; len += 2; len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf), 0, 0, &args[i], i18n); @@ -353,7 +352,7 @@ static int arg_match_long(struct getargs *args, size_t num_args, char *argv, int argc, char **rargv, int *goptind) { - size_t i; + int i; char *goptarg = NULL; int negate = 0; int partial_match = 0; @@ -485,7 +484,7 @@ static int arg_match_short (struct getargs *args, size_t num_args, char *argv, int argc, char **rargv, int *goptind) { - size_t j, k; + int j, k; for(j = 1; j > 0 && j < strlen(rargv[*goptind]); j++) { for(k = 0; k < num_args; k++) { diff --git a/lib/roken/roken-common.h b/lib/roken/roken-common.h index bdaedfa84..ac7a92d15 100644 --- a/lib/roken/roken-common.h +++ b/lib/roken/roken-common.h @@ -252,11 +252,6 @@ #define INET6_ADDRSTRLEN 46 #endif -/* - * error codes for inet_ntop/inet_pton - */ -#define EAFNOSUPPORT WSAEAFNOSUPPORT - /* * for shutdown(2) */ diff --git a/lib/roken/snprintf.c b/lib/roken/snprintf.c index 51dca3c9d..a20054672 100644 --- a/lib/roken/snprintf.c +++ b/lib/roken/snprintf.c @@ -40,10 +40,6 @@ #include "roken.h" #include -#if defined(TEST_SNPRINTF) -#include "snprintf-test.h" -#endif /* TEST_SNPRINTF */ - enum format_flags { minus_flag = 1, plus_flag = 2, diff --git a/lib/roken/socket.c b/lib/roken/socket.c index fdf090d52..bfc4b7102 100644 --- a/lib/roken/socket.c +++ b/lib/roken/socket.c @@ -253,7 +253,7 @@ socket_set_debug (rk_socket_t sock) #if defined(SO_DEBUG) && defined(HAVE_SETSOCKOPT) int on = 1; - if (setsockopt (sock, SOL_rk_socket_t, SO_DEBUG, (void *) &on, sizeof (on)) < 0) + if (setsockopt (sock, SOL_SOCKET, SO_DEBUG, (void *) &on, sizeof (on)) < 0) warn ("setsockopt SO_DEBUG (ignored)"); #endif } @@ -280,7 +280,7 @@ ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL socket_set_reuseaddr (rk_socket_t sock, int val) { #if defined(SO_REUSEADDR) && defined(HAVE_SETSOCKOPT) - if(setsockopt(sock, SOL_rk_socket_t, SO_REUSEADDR, (void *)&val, + if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&val, sizeof(val)) < 0) err (1, "setsockopt SO_REUSEADDR"); #endif From 7513f59f012007458c37b5c6f90fe36308cf007d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 24 Nov 2009 17:56:32 -0500 Subject: [PATCH 094/134] include\crypto-header.h no longer needs to be generated on Windows --- include/NTMakefile | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/include/NTMakefile b/include/NTMakefile index 144b6ed2a..cd64a5275 100644 --- a/include/NTMakefile +++ b/include/NTMakefile @@ -43,20 +43,9 @@ INCFILES= \ $(INCDIR)\krb5-types.h \ $(INCDIR)\version.h -MAKECRYPTO=$(OBJ)\make_crypto.exe - -$(MAKECRYPTO): $(OBJ)\make_crypto.obj - $(EXECONLINK) - $(_VC_MANIFEST_EMBED_EXE) - $(_VC_MANIFEST_CLEAN) - $(_CODESIGN) - $(INCDIR)\krb5-types.h: krb5-types.h.w32 $(CP) $** $@ -$(INCDIR)\crypto-headers.h: $(MAKECRYPTO) - $(MAKECRYPTO) $@ - $(INCDIR)\config.h: config.h.w32 ..\windows\NTMakefile.config NTMakefile $(PERL) << < config.h.w32 > $@ From 84344949ec9143475ad77e5c5bdcf56cf9706833 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 24 Nov 2009 19:04:25 -0500 Subject: [PATCH 095/134] (lib/asn1/gen.c) The name for define_type() shouldn't include a semicolon --- lib/asn1/gen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/asn1/gen.c b/lib/asn1/gen.c index eb182e76a..343fb80c5 100644 --- a/lib/asn1/gen.c +++ b/lib/asn1/gen.c @@ -739,7 +739,7 @@ define_type (int level, const char *name, const char *basename, Type *t, int typ /* pad unused */ while (pos < m->val) { - asprintf (&n, "_unused%d:1;", pos); + asprintf (&n, "_unused%d:1", pos); define_type (level + 1, n, newbasename, &i, FALSE, FALSE); free(n); pos++; @@ -755,7 +755,7 @@ define_type (int level, const char *name, const char *basename, Type *t, int typ /* pad to 32 elements */ while (pos < 32) { char *n; - asprintf (&n, "_unused%d:1;", pos); + asprintf (&n, "_unused%d:1", pos); define_type (level + 1, n, newbasename, &i, FALSE, FALSE); free(n); pos++; From 94c9bd35570becff28464b9a68f3c03e056c2c7c Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 24 Nov 2009 19:05:32 -0500 Subject: [PATCH 096/134] (lib/asn1) Bring Windows build up-to-date --- lib/asn1/NTMakefile | 105 +- lib/asn1/libasn1-exports.def | 3191 +++++++++++++++++----------------- windows/NTMakefile.w32 | 3 + 3 files changed, 1626 insertions(+), 1673 deletions(-) diff --git a/lib/asn1/NTMakefile b/lib/asn1/NTMakefile index a26316be7..113b0f9b6 100644 --- a/lib/asn1/NTMakefile +++ b/lib/asn1/NTMakefile @@ -37,8 +37,8 @@ gen_files_k5 = \ $(OBJ)\asn1_AD_AND_OR.x \ $(OBJ)\asn1_AD_IF_RELEVANT.x \ $(OBJ)\asn1_AD_KDCIssued.x \ - $(OBJ)\asn1_AD_MANDATORY_FOR_KDC.x \ $(OBJ)\asn1_AD_LoginAlias.x \ + $(OBJ)\asn1_AD_MANDATORY_FOR_KDC.x \ $(OBJ)\asn1_APOptions.x \ $(OBJ)\asn1_AP_REP.x \ $(OBJ)\asn1_AP_REQ.x \ @@ -66,12 +66,15 @@ gen_files_k5 = \ $(OBJ)\asn1_EncryptedData.x \ $(OBJ)\asn1_EncryptionKey.x \ $(OBJ)\asn1_EtypeList.x \ + $(OBJ)\asn1_FastOptions.x \ $(OBJ)\asn1_HostAddress.x \ $(OBJ)\asn1_HostAddresses.x \ $(OBJ)\asn1_KDCOptions.x \ $(OBJ)\asn1_KDC_REP.x \ $(OBJ)\asn1_KDC_REQ.x \ $(OBJ)\asn1_KDC_REQ_BODY.x \ + $(OBJ)\asn1_KRB5SignedPath.x \ + $(OBJ)\asn1_KRB5SignedPathData.x \ $(OBJ)\asn1_KRB_CRED.x \ $(OBJ)\asn1_KRB_ERROR.x \ $(OBJ)\asn1_KRB_PRIV.x \ @@ -80,27 +83,35 @@ gen_files_k5 = \ $(OBJ)\asn1_KerberosString.x \ $(OBJ)\asn1_KerberosTime.x \ $(OBJ)\asn1_KrbCredInfo.x \ + $(OBJ)\asn1_KrbFastArmor.x \ + $(OBJ)\asn1_KrbFastArmoredRep.x \ + $(OBJ)\asn1_KrbFastArmoredReq.x \ + $(OBJ)\asn1_KrbFastFinished.x \ + $(OBJ)\asn1_KrbFastReq.x \ + $(OBJ)\asn1_KrbFastResponse.x \ $(OBJ)\asn1_LR_TYPE.x \ $(OBJ)\asn1_LastReq.x \ $(OBJ)\asn1_MESSAGE_TYPE.x \ $(OBJ)\asn1_METHOD_DATA.x \ $(OBJ)\asn1_NAME_TYPE.x \ + $(OBJ)\asn1_PA_FX_FAST_REPLY.x \ + $(OBJ)\asn1_PA_FX_FAST_REQUEST.x \ $(OBJ)\asn1_PADATA_TYPE.x \ + $(OBJ)\asn1_PA_ClientCanonicalized.x \ + $(OBJ)\asn1_PA_ClientCanonicalizedNames.x \ $(OBJ)\asn1_PA_DATA.x \ - $(OBJ)\asn1_PA_ENC_SAM_RESPONSE_ENC.x \ + $(OBJ)\asn1_PA_ENC_SAM_RESPONSE_ENC.x \ $(OBJ)\asn1_PA_ENC_TS_ENC.x \ $(OBJ)\asn1_PA_PAC_REQUEST.x \ $(OBJ)\asn1_PA_S4U2Self.x \ $(OBJ)\asn1_PA_SAM_CHALLENGE_2.x \ - $(OBJ)\asn1_PA_SAM_CHALLENGE_2_BODY.x \ + $(OBJ)\asn1_PA_SAM_CHALLENGE_2_BODY.x \ $(OBJ)\asn1_PA_SAM_REDIRECT.x \ $(OBJ)\asn1_PA_SAM_RESPONSE_2.x \ $(OBJ)\asn1_PA_SAM_TYPE.x \ - $(OBJ)\asn1_PA_ClientCanonicalized.x \ - $(OBJ)\asn1_PA_ClientCanonicalizedNames.x \ - $(OBJ)\asn1_PA_SvrReferralData.x \ - $(OBJ)\asn1_PA_ServerReferralData.x \ $(OBJ)\asn1_PA_SERVER_REFERRAL_DATA.x \ + $(OBJ)\asn1_PA_ServerReferralData.x \ + $(OBJ)\asn1_PA_SvrReferralData.x \ $(OBJ)\asn1_PROV_SRV_LOCATION.x \ $(OBJ)\asn1_Principal.x \ $(OBJ)\asn1_PrincipalName.x \ @@ -115,9 +126,7 @@ gen_files_k5 = \ $(OBJ)\asn1_TransitedEncoding.x \ $(OBJ)\asn1_TypedData.x \ $(OBJ)\asn1_krb5int32.x \ - $(OBJ)\asn1_krb5uint32.x \ - $(OBJ)\asn1_KRB5SignedPathData.x \ - $(OBJ)\asn1_KRB5SignedPath.x + $(OBJ)\asn1_krb5uint32.x gen_files_cms = \ $(OBJ)\asn1_CMSAttributes.x \ @@ -215,7 +224,6 @@ gen_files_rfc2459 = \ $(OBJ)\asn1_SubjectPublicKeyInfo.x \ $(OBJ)\asn1_TBSCRLCertList.x \ $(OBJ)\asn1_TBSCertificate.x \ - $(OBJ)\asn1_TeletexStringx.x \ $(OBJ)\asn1_Time.x \ $(OBJ)\asn1_UniqueIdentifier.x \ $(OBJ)\asn1_ValidationParms.x \ @@ -426,8 +434,10 @@ gen_files_pkcs9 = \ $(OBJ)\asn1_PKCS9_friendlyName.x gen_files_test = \ + $(OBJ)\asn1_TESTOptional.x \ $(OBJ)\asn1_TESTAlloc.x \ $(OBJ)\asn1_TESTAllocInner.x \ + $(OBJ)\asn1_TESTBitString.x \ $(OBJ)\asn1_TESTCONTAINING.x \ $(OBJ)\asn1_TESTCONTAININGENCODEDBY.x \ $(OBJ)\asn1_TESTCONTAININGENCODEDBY2.x \ @@ -441,14 +451,21 @@ gen_files_test = \ $(OBJ)\asn1_TESTInteger2.x \ $(OBJ)\asn1_TESTInteger3.x \ $(OBJ)\asn1_TESTLargeTag.x \ - $(OBJ)\asn1_TESTSeq.x \ - $(OBJ)\asn1_TESTUSERCONSTRAINED.x \ - $(OBJ)\asn1_TESTSeqOf.x \ $(OBJ)\asn1_TESTOSSize1.x \ + $(OBJ)\asn1_TESTPreserve.x \ + $(OBJ)\asn1_TESTSeq.x \ + $(OBJ)\asn1_TESTSeqOf.x \ + $(OBJ)\asn1_TESTSeqOf2.x \ + $(OBJ)\asn1_TESTSeqOf3.x \ + $(OBJ)\asn1_TESTSeqOfSeq.x \ + $(OBJ)\asn1_TESTSeqOfSeq2.x \ + $(OBJ)\asn1_TESTSeqOfSeq3.x \ $(OBJ)\asn1_TESTSeqSizeOf1.x \ $(OBJ)\asn1_TESTSeqSizeOf2.x \ $(OBJ)\asn1_TESTSeqSizeOf3.x \ - $(OBJ)\asn1_TESTSeqSizeOf4.x + $(OBJ)\asn1_TESTSeqSizeOf4.x \ + $(OBJ)\asn1_TESTUSERCONSTRAINED.x \ + $(OBJ)\asn1_TESTuint32.x gen_files_digest = \ $(OBJ)\asn1_DigestError.x \ @@ -464,18 +481,22 @@ gen_files_digest = \ $(OBJ)\asn1_NTLMInit.x \ $(OBJ)\asn1_NTLMInitReply.x \ $(OBJ)\asn1_NTLMRequest.x \ - $(OBJ)\asn1_NTLMResponse.x + $(OBJ)\asn1_NTLMRequest2.x \ + $(OBJ)\asn1_NTLMResponse.x \ + $(OBJ)\asn1_NTLMReply.x gen_files_kx509 = \ $(OBJ)\asn1_Kx509Response.x \ + $(OBJ)\asn1_KX509_ERROR_CODE.x \ $(OBJ)\asn1_Kx509Request.x ASN1_BINARIES = \ - $(BINDIR)\asn1_compile.exe \ - $(BINDIR)\asn1_print.exe \ + $(LIBEXECDIR)\asn1_compile.exe \ + $(LIBEXECDIR)\asn1_print.exe \ $(BINDIR)\asn1_gen.exe $(BINDIR)\asn1_compile.exe: \ + $(OBJ)\asn1parse.obj \ $(OBJ)\gen.obj \ $(OBJ)\gen_copy.obj \ $(OBJ)\gen_decode.obj \ @@ -484,10 +505,10 @@ $(BINDIR)\asn1_compile.exe: \ $(OBJ)\gen_glue.obj \ $(OBJ)\gen_length.obj \ $(OBJ)\gen_seq.obj \ + $(OBJ)\gen_template.obj \ $(OBJ)\hash.obj \ $(OBJ)\lex.obj \ $(OBJ)\main.obj \ - $(OBJ)\asn1parse.obj \ $(OBJ)\symbol.obj $(EXECONLINK) $(LIBROKEN) $(LIBVERS) $(_VC_MANIFEST_EMBED_EXE) @@ -675,25 +696,40 @@ $(gen_files_test) $(OBJ)\test_asn1.hx: $(BINDIR)\asn1_compile.exe test.asn1 || ($(RM) $(OBJ)\test_asn1.h ; exit /b 1) cd $(SRCDIR) -INCFILES=$(INCDIR)\der.h $(INCDIR)\heim_asn1.h $(INCDIR)\der-protos.h \ +INCFILES= \ + $(INCDIR)\der.h \ + $(INCDIR)\heim_asn1.h \ + $(INCDIR)\der-protos.h \ + $(INCDIR)\der-private.h \ + $(INCDIR)\asn1-common.h \ $(OBJ)\asn1_err.h $(INCDIR)\der-protos.h: $(OBJ)\der-protos.h -GENINCFILES= \ - $(INCDIR)\asn1_err.h \ - $(INCDIR)\cms_asn1.h \ - $(INCDIR)\digest_asn1.h \ - $(INCDIR)\krb5_asn1.h \ - $(INCDIR)\kx509_asn1.h \ - $(INCDIR)\pkcs12_asn1.h \ - $(INCDIR)\pkcs8_asn1.h \ - $(INCDIR)\pkcs9_asn1.h \ - $(INCDIR)\pkinit_asn1.h \ - $(INCDIR)\rfc2459_asn1.h +GENINCFILES= \ + $(INCDIR)\asn1_err.h \ + $(INCDIR)\cms_asn1.h \ + $(INCDIR)\digest_asn1.h \ + $(INCDIR)\krb5_asn1.h \ + $(INCDIR)\kx509_asn1.h \ + $(INCDIR)\pkcs12_asn1.h \ + $(INCDIR)\pkcs8_asn1.h \ + $(INCDIR)\pkcs9_asn1.h \ + $(INCDIR)\pkinit_asn1.h \ + $(INCDIR)\rfc2459_asn1.h \ + $(OBJ)\krb5_asn1-priv.h \ + $(OBJ)\pkinit_asn1-priv.h \ + $(OBJ)\cms_asn1-priv.h \ + $(OBJ)\rfc2459_asn1-priv.h \ + $(OBJ)\pkcs8_asn1-priv.h \ + $(OBJ)\pkcs9_asn1-priv.h \ + $(OBJ)\pkcs12_asn1-priv.h \ + $(OBJ)\digest_asn1-priv.h \ + $(OBJ)\kx509_asn1-priv.h \ + $(OBJ)\test_asn1.h \ + $(OBJ)\test_asn1-priv.h libasn1_SOURCES= \ - der-protos.h \ der_locl.h \ der.c \ der.h \ @@ -708,9 +744,12 @@ libasn1_SOURCES= \ extra.c \ timegm.c -$(OBJ)\der-protos.h: $(libasn1_SOURCES:der-protos.h=) +$(OBJ)\der-protos.h: $(libasn1_SOURCES) $(PERL) ..\..\cf\make-proto.pl -q -P remove -o $(OBJ)\der-protos.h $(libasn1_SOURCES) || $(RM) $(OBJ)\der-protos.h +$(OBJ)\der-private.h: $(libasn1_SOURCES) + $(PERL) ..\..\cf\make-proto.pl -q -P remove -p $(OBJ)\der-private.h $(libasn1_SOURCES) || $(RM) $(OBJ)\der-private.h + clean:: -$(RM) $(INCDIR)\der-protos.h diff --git a/lib/asn1/libasn1-exports.def b/lib/asn1/libasn1-exports.def index 6f753be54..51b2776ae 100644 --- a/lib/asn1/libasn1-exports.def +++ b/lib/asn1/libasn1-exports.def @@ -1,1656 +1,1567 @@ EXPORTS + APOptions2int + DigestTypes2int + DistributionPointReasonFlags2int + FastOptions2int + KDCOptions2int + KeyUsage2int + SAMFlags2int + TicketFlags2int + copy_AD_AND_OR + decode_AD_AND_OR + encode_AD_AND_OR + free_AD_AND_OR + length_AD_AND_OR + copy_AD_IF_RELEVANT + decode_AD_IF_RELEVANT + encode_AD_IF_RELEVANT + free_AD_IF_RELEVANT + length_AD_IF_RELEVANT + copy_AD_INITIAL_VERIFIED_CAS + decode_AD_INITIAL_VERIFIED_CAS + encode_AD_INITIAL_VERIFIED_CAS + free_AD_INITIAL_VERIFIED_CAS + length_AD_INITIAL_VERIFIED_CAS + copy_AD_KDCIssued + decode_AD_KDCIssued + encode_AD_KDCIssued + free_AD_KDCIssued + length_AD_KDCIssued + copy_AD_LoginAlias + decode_AD_LoginAlias + encode_AD_LoginAlias + free_AD_LoginAlias + length_AD_LoginAlias + copy_AD_MANDATORY_FOR_KDC + decode_AD_MANDATORY_FOR_KDC + encode_AD_MANDATORY_FOR_KDC + free_AD_MANDATORY_FOR_KDC + length_AD_MANDATORY_FOR_KDC + copy_APOptions + decode_APOptions + encode_APOptions + free_APOptions + length_APOptions + asn1_APOptions_units + copy_AP_REP + decode_AP_REP + encode_AP_REP + free_AP_REP + length_AP_REP + copy_AP_REQ + decode_AP_REQ + encode_AP_REQ + free_AP_REQ + length_AP_REQ + copy_AS_REP + decode_AS_REP + encode_AS_REP + free_AS_REP + length_AS_REP + copy_AS_REQ + decode_AS_REQ + encode_AS_REQ + free_AS_REQ + length_AS_REQ + copy_AUTHDATA_TYPE + decode_AUTHDATA_TYPE + encode_AUTHDATA_TYPE + free_AUTHDATA_TYPE + length_AUTHDATA_TYPE + copy_AccessDescription + decode_AccessDescription + encode_AccessDescription + free_AccessDescription + length_AccessDescription + copy_AlgorithmIdentifier + decode_AlgorithmIdentifier + encode_AlgorithmIdentifier + free_AlgorithmIdentifier + length_AlgorithmIdentifier + copy_Attribute + decode_Attribute + encode_Attribute + free_Attribute + length_Attribute + copy_AttributeType + decode_AttributeType + encode_AttributeType + free_AttributeType + length_AttributeType + copy_AttributeTypeAndValue + decode_AttributeTypeAndValue + encode_AttributeTypeAndValue + free_AttributeTypeAndValue + length_AttributeTypeAndValue + copy_AttributeValue + decode_AttributeValue + encode_AttributeValue + free_AttributeValue + length_AttributeValue + copy_AuthPack + decode_AuthPack + encode_AuthPack + free_AuthPack + length_AuthPack + copy_AuthPack_Win2k + decode_AuthPack_Win2k + encode_AuthPack_Win2k + free_AuthPack_Win2k + length_AuthPack_Win2k + copy_Authenticator + decode_Authenticator + encode_Authenticator + free_Authenticator + length_Authenticator + copy_AuthorityInfoAccessSyntax + decode_AuthorityInfoAccessSyntax + encode_AuthorityInfoAccessSyntax + free_AuthorityInfoAccessSyntax + length_AuthorityInfoAccessSyntax + copy_AuthorityKeyIdentifier + decode_AuthorityKeyIdentifier + encode_AuthorityKeyIdentifier + free_AuthorityKeyIdentifier + length_AuthorityKeyIdentifier + add_AuthorizationData + copy_AuthorizationData + decode_AuthorizationData + encode_AuthorizationData + free_AuthorizationData + length_AuthorizationData + remove_AuthorizationData + copy_AuthorizationDataElement + decode_AuthorizationDataElement + encode_AuthorizationDataElement + free_AuthorizationDataElement + length_AuthorizationDataElement + copy_BaseDistance + decode_BaseDistance + encode_BaseDistance + free_BaseDistance + length_BaseDistance + copy_BasicConstraints + decode_BasicConstraints + encode_BasicConstraints + free_BasicConstraints + length_BasicConstraints + copy_CKSUMTYPE + decode_CKSUMTYPE + encode_CKSUMTYPE + free_CKSUMTYPE + length_CKSUMTYPE + copy_CMSAttributes + decode_CMSAttributes + encode_CMSAttributes + free_CMSAttributes + length_CMSAttributes + copy_CMSCBCParameter + decode_CMSCBCParameter + encode_CMSCBCParameter + free_CMSCBCParameter + length_CMSCBCParameter + copy_CMSEncryptedData + decode_CMSEncryptedData + encode_CMSEncryptedData + free_CMSEncryptedData + length_CMSEncryptedData + copy_CMSIdentifier + decode_CMSIdentifier + encode_CMSIdentifier + free_CMSIdentifier + length_CMSIdentifier + copy_CMSRC2CBCParameter + decode_CMSRC2CBCParameter + encode_CMSRC2CBCParameter + free_CMSRC2CBCParameter + length_CMSRC2CBCParameter + copy_CMSVersion + decode_CMSVersion + encode_CMSVersion + free_CMSVersion + length_CMSVersion + copy_CRLCertificateList + decode_CRLCertificateList + encode_CRLCertificateList + free_CRLCertificateList + length_CRLCertificateList + add_CRLDistributionPoints + copy_CRLDistributionPoints + decode_CRLDistributionPoints + encode_CRLDistributionPoints + free_CRLDistributionPoints + length_CRLDistributionPoints + remove_CRLDistributionPoints + copy_CRLReason + decode_CRLReason + encode_CRLReason + free_CRLReason + length_CRLReason + copy_Certificate + decode_Certificate + encode_Certificate + free_Certificate + length_Certificate + copy_CertificateList + decode_CertificateList + encode_CertificateList + free_CertificateList + length_CertificateList + copy_CertificateRevocationLists + decode_CertificateRevocationLists + encode_CertificateRevocationLists + free_CertificateRevocationLists + length_CertificateRevocationLists + copy_CertificateSerialNumber + decode_CertificateSerialNumber + encode_CertificateSerialNumber + free_CertificateSerialNumber + length_CertificateSerialNumber + copy_CertificateSet + decode_CertificateSet + encode_CertificateSet + free_CertificateSet + length_CertificateSet + copy_Certificates + decode_Certificates + encode_Certificates + free_Certificates + length_Certificates + copy_ChangePasswdDataMS + decode_ChangePasswdDataMS + encode_ChangePasswdDataMS + free_ChangePasswdDataMS + length_ChangePasswdDataMS + copy_Checksum + decode_Checksum + encode_Checksum + free_Checksum + length_Checksum + copy_ContentEncryptionAlgorithmIdentifier + decode_ContentEncryptionAlgorithmIdentifier + encode_ContentEncryptionAlgorithmIdentifier + free_ContentEncryptionAlgorithmIdentifier + length_ContentEncryptionAlgorithmIdentifier + copy_ContentInfo + decode_ContentInfo + encode_ContentInfo + free_ContentInfo + length_ContentInfo + copy_ContentType + decode_ContentType + encode_ContentType + free_ContentType + length_ContentType + copy_DHNonce + decode_DHNonce + encode_DHNonce + free_DHNonce + length_DHNonce + copy_DHPublicKey + decode_DHPublicKey + encode_DHPublicKey + free_DHPublicKey + length_DHPublicKey + copy_DHRepInfo + decode_DHRepInfo + encode_DHRepInfo + free_DHRepInfo + length_DHRepInfo + copy_DSAParams + decode_DSAParams + encode_DSAParams + free_DSAParams + length_DSAParams + copy_DSAPublicKey + decode_DSAPublicKey + encode_DSAPublicKey + free_DSAPublicKey + length_DSAPublicKey + copy_DSASigValue + decode_DSASigValue + encode_DSASigValue + free_DSASigValue + length_DSASigValue + copy_DigestAlgorithmIdentifier + decode_DigestAlgorithmIdentifier + encode_DigestAlgorithmIdentifier + free_DigestAlgorithmIdentifier + length_DigestAlgorithmIdentifier + copy_DigestAlgorithmIdentifiers + decode_DigestAlgorithmIdentifiers + encode_DigestAlgorithmIdentifiers + free_DigestAlgorithmIdentifiers + length_DigestAlgorithmIdentifiers + copy_DigestError + decode_DigestError + encode_DigestError + free_DigestError + length_DigestError + copy_DigestInfo + decode_DigestInfo + encode_DigestInfo + free_DigestInfo + length_DigestInfo + copy_DigestInit + decode_DigestInit + encode_DigestInit + free_DigestInit + length_DigestInit + copy_DigestInitReply + decode_DigestInitReply + encode_DigestInitReply + free_DigestInitReply + length_DigestInitReply + copy_DigestREP + decode_DigestREP + encode_DigestREP + free_DigestREP + length_DigestREP + copy_DigestREQ + decode_DigestREQ + encode_DigestREQ + free_DigestREQ + length_DigestREQ + copy_DigestRepInner + decode_DigestRepInner + encode_DigestRepInner + free_DigestRepInner + length_DigestRepInner + copy_DigestReqInner + decode_DigestReqInner + encode_DigestReqInner + free_DigestReqInner + length_DigestReqInner + copy_DigestRequest + decode_DigestRequest + encode_DigestRequest + free_DigestRequest + length_DigestRequest + copy_DigestResponse + decode_DigestResponse + encode_DigestResponse + free_DigestResponse + length_DigestResponse + copy_DigestTypes + decode_DigestTypes + encode_DigestTypes + free_DigestTypes + length_DigestTypes + asn1_DigestTypes_units + copy_DirectoryString + decode_DirectoryString + encode_DirectoryString + free_DirectoryString + length_DirectoryString + copy_DistributionPoint + decode_DistributionPoint + encode_DistributionPoint + free_DistributionPoint + length_DistributionPoint + copy_DistributionPointName + decode_DistributionPointName + encode_DistributionPointName + free_DistributionPointName + length_DistributionPointName + copy_DistributionPointReasonFlags + decode_DistributionPointReasonFlags + encode_DistributionPointReasonFlags + free_DistributionPointReasonFlags + length_DistributionPointReasonFlags + asn1_DistributionPointReasonFlags_units + copy_DomainParameters + decode_DomainParameters + encode_DomainParameters + free_DomainParameters + length_DomainParameters + copy_ECDSA_Sig_Value + decode_ECDSA_Sig_Value + encode_ECDSA_Sig_Value + free_ECDSA_Sig_Value + length_ECDSA_Sig_Value + copy_ECParameters + decode_ECParameters + encode_ECParameters + free_ECParameters + length_ECParameters + copy_ECPoint + decode_ECPoint + encode_ECPoint + free_ECPoint + length_ECPoint + copy_ENCTYPE + decode_ENCTYPE + encode_ENCTYPE + free_ENCTYPE + length_ENCTYPE + add_ETYPE_INFO + copy_ETYPE_INFO + decode_ETYPE_INFO + encode_ETYPE_INFO + free_ETYPE_INFO + length_ETYPE_INFO + remove_ETYPE_INFO + add_ETYPE_INFO2 + copy_ETYPE_INFO2 + decode_ETYPE_INFO2 + encode_ETYPE_INFO2 + free_ETYPE_INFO2 + length_ETYPE_INFO2 + remove_ETYPE_INFO2 + copy_ETYPE_INFO2_ENTRY + decode_ETYPE_INFO2_ENTRY + encode_ETYPE_INFO2_ENTRY + free_ETYPE_INFO2_ENTRY + length_ETYPE_INFO2_ENTRY + copy_ETYPE_INFO_ENTRY + decode_ETYPE_INFO_ENTRY + encode_ETYPE_INFO_ENTRY + free_ETYPE_INFO_ENTRY + length_ETYPE_INFO_ENTRY + copy_EncAPRepPart + decode_EncAPRepPart + encode_EncAPRepPart + free_EncAPRepPart + length_EncAPRepPart + copy_EncASRepPart + decode_EncASRepPart + encode_EncASRepPart + free_EncASRepPart + length_EncASRepPart + copy_EncKDCRepPart + decode_EncKDCRepPart + encode_EncKDCRepPart + free_EncKDCRepPart + length_EncKDCRepPart + copy_EncKrbCredPart + decode_EncKrbCredPart + encode_EncKrbCredPart + free_EncKrbCredPart + length_EncKrbCredPart + copy_EncKrbPrivPart + decode_EncKrbPrivPart + encode_EncKrbPrivPart + free_EncKrbPrivPart + length_EncKrbPrivPart + copy_EncTGSRepPart + decode_EncTGSRepPart + encode_EncTGSRepPart + free_EncTGSRepPart + length_EncTGSRepPart + copy_EncTicketPart + decode_EncTicketPart + encode_EncTicketPart + free_EncTicketPart + length_EncTicketPart + copy_EncapsulatedContentInfo + decode_EncapsulatedContentInfo + encode_EncapsulatedContentInfo + free_EncapsulatedContentInfo + length_EncapsulatedContentInfo + copy_EncryptedContent + decode_EncryptedContent + encode_EncryptedContent + free_EncryptedContent + length_EncryptedContent + copy_EncryptedContentInfo + decode_EncryptedContentInfo + encode_EncryptedContentInfo + free_EncryptedContentInfo + length_EncryptedContentInfo + copy_EncryptedData + decode_EncryptedData + encode_EncryptedData + free_EncryptedData + length_EncryptedData + copy_EncryptedKey + decode_EncryptedKey + encode_EncryptedKey + free_EncryptedKey + length_EncryptedKey + copy_EncryptionKey + decode_EncryptionKey + encode_EncryptionKey + free_EncryptionKey + length_EncryptionKey + copy_EnvelopedData + decode_EnvelopedData + encode_EnvelopedData + free_EnvelopedData + length_EnvelopedData + copy_EtypeList + decode_EtypeList + encode_EtypeList + free_EtypeList + length_EtypeList + copy_ExtKeyUsage + decode_ExtKeyUsage + encode_ExtKeyUsage + free_ExtKeyUsage + length_ExtKeyUsage + copy_Extension + decode_Extension + encode_Extension + free_Extension + length_Extension + add_Extensions + copy_Extensions + decode_Extensions + encode_Extensions + free_Extensions + length_Extensions + remove_Extensions + copy_ExternalPrincipalIdentifier + decode_ExternalPrincipalIdentifier + encode_ExternalPrincipalIdentifier + free_ExternalPrincipalIdentifier + length_ExternalPrincipalIdentifier + copy_ExternalPrincipalIdentifiers + decode_ExternalPrincipalIdentifiers + encode_ExternalPrincipalIdentifiers + free_ExternalPrincipalIdentifiers + length_ExternalPrincipalIdentifiers + copy_FastOptions + decode_FastOptions + encode_FastOptions + free_FastOptions + length_FastOptions + asn1_FastOptions_units + copy_GeneralName + decode_GeneralName + encode_GeneralName + free_GeneralName + length_GeneralName + add_GeneralNames + copy_GeneralNames + decode_GeneralNames + encode_GeneralNames + free_GeneralNames + length_GeneralNames + remove_GeneralNames + copy_GeneralSubtree + decode_GeneralSubtree + encode_GeneralSubtree + free_GeneralSubtree + length_GeneralSubtree + copy_GeneralSubtrees + decode_GeneralSubtrees + encode_GeneralSubtrees + free_GeneralSubtrees + length_GeneralSubtrees + copy_HostAddress + decode_HostAddress + encode_HostAddress + free_HostAddress + length_HostAddress + copy_HostAddresses + decode_HostAddresses + encode_HostAddresses + free_HostAddresses + length_HostAddresses + copy_IssuerAndSerialNumber + decode_IssuerAndSerialNumber + encode_IssuerAndSerialNumber + free_IssuerAndSerialNumber + length_IssuerAndSerialNumber + copy_KDCDHKeyInfo + decode_KDCDHKeyInfo + encode_KDCDHKeyInfo + free_KDCDHKeyInfo + length_KDCDHKeyInfo + copy_KDCDHKeyInfo_Win2k + decode_KDCDHKeyInfo_Win2k + encode_KDCDHKeyInfo_Win2k + free_KDCDHKeyInfo_Win2k + length_KDCDHKeyInfo_Win2k + copy_KDCOptions + decode_KDCOptions + encode_KDCOptions + free_KDCOptions + length_KDCOptions + asn1_KDCOptions_units + copy_KDC_REP + decode_KDC_REP + encode_KDC_REP + free_KDC_REP + length_KDC_REP + copy_KDC_REQ + decode_KDC_REQ + encode_KDC_REQ + free_KDC_REQ + length_KDC_REQ + copy_KDC_REQ_BODY + decode_KDC_REQ_BODY + encode_KDC_REQ_BODY + free_KDC_REQ_BODY + length_KDC_REQ_BODY + copy_KDFAlgorithmId + decode_KDFAlgorithmId + encode_KDFAlgorithmId + free_KDFAlgorithmId + length_KDFAlgorithmId + copy_KRB5PrincipalName + decode_KRB5PrincipalName + encode_KRB5PrincipalName + free_KRB5PrincipalName + length_KRB5PrincipalName + copy_KRB5SignedPath + decode_KRB5SignedPath + encode_KRB5SignedPath + free_KRB5SignedPath + length_KRB5SignedPath + copy_KRB5SignedPathData + decode_KRB5SignedPathData + encode_KRB5SignedPathData + free_KRB5SignedPathData + length_KRB5SignedPathData + copy_KRB_CRED + decode_KRB_CRED + encode_KRB_CRED + free_KRB_CRED + length_KRB_CRED + copy_KRB_ERROR + decode_KRB_ERROR + encode_KRB_ERROR + free_KRB_ERROR + length_KRB_ERROR + copy_KRB_PRIV + decode_KRB_PRIV + encode_KRB_PRIV + free_KRB_PRIV + length_KRB_PRIV + copy_KRB_SAFE + decode_KRB_SAFE + encode_KRB_SAFE + free_KRB_SAFE + length_KRB_SAFE + copy_KRB_SAFE_BODY + decode_KRB_SAFE_BODY + encode_KRB_SAFE_BODY + free_KRB_SAFE_BODY + length_KRB_SAFE_BODY + copy_KX509_ERROR_CODE + decode_KX509_ERROR_CODE + encode_KX509_ERROR_CODE + free_KX509_ERROR_CODE + length_KX509_ERROR_CODE + copy_KerberosString + decode_KerberosString + encode_KerberosString + free_KerberosString + length_KerberosString + copy_KerberosTime + decode_KerberosTime + encode_KerberosTime + free_KerberosTime + length_KerberosTime + copy_KeyEncryptionAlgorithmIdentifier + decode_KeyEncryptionAlgorithmIdentifier + encode_KeyEncryptionAlgorithmIdentifier + free_KeyEncryptionAlgorithmIdentifier + length_KeyEncryptionAlgorithmIdentifier + copy_KeyIdentifier + decode_KeyIdentifier + encode_KeyIdentifier + free_KeyIdentifier + length_KeyIdentifier + copy_KeyTransRecipientInfo + decode_KeyTransRecipientInfo + encode_KeyTransRecipientInfo + free_KeyTransRecipientInfo + length_KeyTransRecipientInfo + copy_KeyUsage + decode_KeyUsage + encode_KeyUsage + free_KeyUsage + length_KeyUsage + asn1_KeyUsage_units + copy_KrbCredInfo + decode_KrbCredInfo + encode_KrbCredInfo + free_KrbCredInfo + length_KrbCredInfo + copy_KrbFastArmor + decode_KrbFastArmor + encode_KrbFastArmor + free_KrbFastArmor + length_KrbFastArmor + copy_KrbFastArmoredRep + decode_KrbFastArmoredRep + encode_KrbFastArmoredRep + free_KrbFastArmoredRep + length_KrbFastArmoredRep + copy_KrbFastArmoredReq + decode_KrbFastArmoredReq + encode_KrbFastArmoredReq + free_KrbFastArmoredReq + length_KrbFastArmoredReq + copy_KrbFastFinished + decode_KrbFastFinished + encode_KrbFastFinished + free_KrbFastFinished + length_KrbFastFinished + copy_KrbFastReq + decode_KrbFastReq + encode_KrbFastReq + free_KrbFastReq + length_KrbFastReq + copy_KrbFastResponse + decode_KrbFastResponse + encode_KrbFastResponse + free_KrbFastResponse + length_KrbFastResponse + copy_Kx509Request + decode_Kx509Request + encode_Kx509Request + free_Kx509Request + length_Kx509Request + copy_Kx509Response + decode_Kx509Response + encode_Kx509Response + free_Kx509Response + length_Kx509Response + copy_LR_TYPE + decode_LR_TYPE + encode_LR_TYPE + free_LR_TYPE + length_LR_TYPE + copy_LastReq + decode_LastReq + encode_LastReq + free_LastReq + length_LastReq + copy_MESSAGE_TYPE + decode_MESSAGE_TYPE + encode_MESSAGE_TYPE + free_MESSAGE_TYPE + length_MESSAGE_TYPE + add_METHOD_DATA + copy_METHOD_DATA + decode_METHOD_DATA + encode_METHOD_DATA + free_METHOD_DATA + length_METHOD_DATA + remove_METHOD_DATA + copy_MS_UPN_SAN + decode_MS_UPN_SAN + encode_MS_UPN_SAN + free_MS_UPN_SAN + length_MS_UPN_SAN + copy_MessageDigest + decode_MessageDigest + encode_MessageDigest + free_MessageDigest + length_MessageDigest + copy_NAME_TYPE + decode_NAME_TYPE + encode_NAME_TYPE + free_NAME_TYPE + length_NAME_TYPE + copy_NTLMInit + decode_NTLMInit + encode_NTLMInit + free_NTLMInit + length_NTLMInit + copy_NTLMInitReply + decode_NTLMInitReply + encode_NTLMInitReply + free_NTLMInitReply + length_NTLMInitReply + copy_NTLMReply + decode_NTLMReply + encode_NTLMReply + free_NTLMReply + length_NTLMReply + copy_NTLMRequest + decode_NTLMRequest + encode_NTLMRequest + free_NTLMRequest + length_NTLMRequest + copy_NTLMRequest2 + decode_NTLMRequest2 + encode_NTLMRequest2 + free_NTLMRequest2 + length_NTLMRequest2 + copy_NTLMResponse + decode_NTLMResponse + encode_NTLMResponse + free_NTLMResponse + length_NTLMResponse + copy_Name + decode_Name + encode_Name + free_Name + length_Name + copy_NameConstraints + decode_NameConstraints + encode_NameConstraints + free_NameConstraints + length_NameConstraints + copy_OriginatorInfo + decode_OriginatorInfo + encode_OriginatorInfo + free_OriginatorInfo + length_OriginatorInfo + copy_OtherName + decode_OtherName + encode_OtherName + free_OtherName + length_OtherName + copy_PADATA_TYPE + decode_PADATA_TYPE + encode_PADATA_TYPE + free_PADATA_TYPE + length_PADATA_TYPE + copy_PA_ClientCanonicalized + decode_PA_ClientCanonicalized + encode_PA_ClientCanonicalized + free_PA_ClientCanonicalized + length_PA_ClientCanonicalized + copy_PA_ClientCanonicalizedNames + decode_PA_ClientCanonicalizedNames + encode_PA_ClientCanonicalizedNames + free_PA_ClientCanonicalizedNames + length_PA_ClientCanonicalizedNames + copy_PA_DATA + decode_PA_DATA + encode_PA_DATA + free_PA_DATA + length_PA_DATA + copy_PA_ENC_SAM_RESPONSE_ENC + decode_PA_ENC_SAM_RESPONSE_ENC + encode_PA_ENC_SAM_RESPONSE_ENC + free_PA_ENC_SAM_RESPONSE_ENC + length_PA_ENC_SAM_RESPONSE_ENC + copy_PA_ENC_TS_ENC + decode_PA_ENC_TS_ENC + encode_PA_ENC_TS_ENC + free_PA_ENC_TS_ENC + length_PA_ENC_TS_ENC + copy_PA_FX_FAST_REPLY + decode_PA_FX_FAST_REPLY + encode_PA_FX_FAST_REPLY + free_PA_FX_FAST_REPLY + length_PA_FX_FAST_REPLY + copy_PA_FX_FAST_REQUEST + decode_PA_FX_FAST_REQUEST + encode_PA_FX_FAST_REQUEST + free_PA_FX_FAST_REQUEST + length_PA_FX_FAST_REQUEST + copy_PA_PAC_REQUEST + decode_PA_PAC_REQUEST + encode_PA_PAC_REQUEST + free_PA_PAC_REQUEST + length_PA_PAC_REQUEST + copy_PA_PK_AS_REP + decode_PA_PK_AS_REP + encode_PA_PK_AS_REP + free_PA_PK_AS_REP + length_PA_PK_AS_REP + copy_PA_PK_AS_REP_BTMM + decode_PA_PK_AS_REP_BTMM + encode_PA_PK_AS_REP_BTMM + free_PA_PK_AS_REP_BTMM + length_PA_PK_AS_REP_BTMM + copy_PA_PK_AS_REP_Win2k + decode_PA_PK_AS_REP_Win2k + encode_PA_PK_AS_REP_Win2k + free_PA_PK_AS_REP_Win2k + length_PA_PK_AS_REP_Win2k + copy_PA_PK_AS_REQ + decode_PA_PK_AS_REQ + encode_PA_PK_AS_REQ + free_PA_PK_AS_REQ + length_PA_PK_AS_REQ + copy_PA_PK_AS_REQ_Win2k + decode_PA_PK_AS_REQ_Win2k + encode_PA_PK_AS_REQ_Win2k + free_PA_PK_AS_REQ_Win2k + length_PA_PK_AS_REQ_Win2k + copy_PA_S4U2Self + decode_PA_S4U2Self + encode_PA_S4U2Self + free_PA_S4U2Self + length_PA_S4U2Self + copy_PA_SAM_CHALLENGE_2 + decode_PA_SAM_CHALLENGE_2 + encode_PA_SAM_CHALLENGE_2 + free_PA_SAM_CHALLENGE_2 + length_PA_SAM_CHALLENGE_2 + copy_PA_SAM_CHALLENGE_2_BODY + decode_PA_SAM_CHALLENGE_2_BODY + encode_PA_SAM_CHALLENGE_2_BODY + free_PA_SAM_CHALLENGE_2_BODY + length_PA_SAM_CHALLENGE_2_BODY + copy_PA_SAM_REDIRECT + decode_PA_SAM_REDIRECT + encode_PA_SAM_REDIRECT + free_PA_SAM_REDIRECT + length_PA_SAM_REDIRECT + copy_PA_SAM_RESPONSE_2 + decode_PA_SAM_RESPONSE_2 + encode_PA_SAM_RESPONSE_2 + free_PA_SAM_RESPONSE_2 + length_PA_SAM_RESPONSE_2 + copy_PA_SAM_TYPE + decode_PA_SAM_TYPE + encode_PA_SAM_TYPE + free_PA_SAM_TYPE + length_PA_SAM_TYPE + copy_PA_SERVER_REFERRAL_DATA + decode_PA_SERVER_REFERRAL_DATA + encode_PA_SERVER_REFERRAL_DATA + free_PA_SERVER_REFERRAL_DATA + length_PA_SERVER_REFERRAL_DATA + copy_PA_ServerReferralData + decode_PA_ServerReferralData + encode_PA_ServerReferralData + free_PA_ServerReferralData + length_PA_ServerReferralData + copy_PA_SvrReferralData + decode_PA_SvrReferralData + encode_PA_SvrReferralData + free_PA_SvrReferralData + length_PA_SvrReferralData + copy_PKAuthenticator + decode_PKAuthenticator + encode_PKAuthenticator + free_PKAuthenticator + length_PKAuthenticator + copy_PKAuthenticator_Win2k + decode_PKAuthenticator_Win2k + encode_PKAuthenticator_Win2k + free_PKAuthenticator_Win2k + length_PKAuthenticator_Win2k + copy_PKCS12_Attribute + decode_PKCS12_Attribute + encode_PKCS12_Attribute + free_PKCS12_Attribute + length_PKCS12_Attribute + copy_PKCS12_Attributes + decode_PKCS12_Attributes + encode_PKCS12_Attributes + free_PKCS12_Attributes + length_PKCS12_Attributes + copy_PKCS12_AuthenticatedSafe + decode_PKCS12_AuthenticatedSafe + encode_PKCS12_AuthenticatedSafe + free_PKCS12_AuthenticatedSafe + length_PKCS12_AuthenticatedSafe + copy_PKCS12_CertBag + decode_PKCS12_CertBag + encode_PKCS12_CertBag + free_PKCS12_CertBag + length_PKCS12_CertBag + copy_PKCS12_MacData + decode_PKCS12_MacData + encode_PKCS12_MacData + free_PKCS12_MacData + length_PKCS12_MacData + copy_PKCS12_OctetString + decode_PKCS12_OctetString + encode_PKCS12_OctetString + free_PKCS12_OctetString + length_PKCS12_OctetString + copy_PKCS12_PBEParams + decode_PKCS12_PBEParams + encode_PKCS12_PBEParams + free_PKCS12_PBEParams + length_PKCS12_PBEParams + copy_PKCS12_PFX + decode_PKCS12_PFX + encode_PKCS12_PFX + free_PKCS12_PFX + length_PKCS12_PFX + copy_PKCS12_SafeBag + decode_PKCS12_SafeBag + encode_PKCS12_SafeBag + free_PKCS12_SafeBag + length_PKCS12_SafeBag + copy_PKCS12_SafeContents + decode_PKCS12_SafeContents + encode_PKCS12_SafeContents + free_PKCS12_SafeContents + length_PKCS12_SafeContents + copy_PKCS8Attributes + decode_PKCS8Attributes + encode_PKCS8Attributes + free_PKCS8Attributes + length_PKCS8Attributes + copy_PKCS8EncryptedData + decode_PKCS8EncryptedData + encode_PKCS8EncryptedData + free_PKCS8EncryptedData + length_PKCS8EncryptedData + copy_PKCS8EncryptedPrivateKeyInfo + decode_PKCS8EncryptedPrivateKeyInfo + encode_PKCS8EncryptedPrivateKeyInfo + free_PKCS8EncryptedPrivateKeyInfo + length_PKCS8EncryptedPrivateKeyInfo + copy_PKCS8PrivateKey + decode_PKCS8PrivateKey + encode_PKCS8PrivateKey + free_PKCS8PrivateKey + length_PKCS8PrivateKey + copy_PKCS8PrivateKeyAlgorithmIdentifier + decode_PKCS8PrivateKeyAlgorithmIdentifier + encode_PKCS8PrivateKeyAlgorithmIdentifier + free_PKCS8PrivateKeyAlgorithmIdentifier + length_PKCS8PrivateKeyAlgorithmIdentifier + copy_PKCS8PrivateKeyInfo + decode_PKCS8PrivateKeyInfo + encode_PKCS8PrivateKeyInfo + free_PKCS8PrivateKeyInfo + length_PKCS8PrivateKeyInfo + copy_PKCS9_BMPString + decode_PKCS9_BMPString + encode_PKCS9_BMPString + free_PKCS9_BMPString + length_PKCS9_BMPString + copy_PKCS9_friendlyName + decode_PKCS9_friendlyName + encode_PKCS9_friendlyName + free_PKCS9_friendlyName + length_PKCS9_friendlyName + copy_PKIXXmppAddr + decode_PKIXXmppAddr + encode_PKIXXmppAddr + free_PKIXXmppAddr + length_PKIXXmppAddr + copy_PROV_SRV_LOCATION + decode_PROV_SRV_LOCATION + encode_PROV_SRV_LOCATION + free_PROV_SRV_LOCATION + length_PROV_SRV_LOCATION + copy_PkinitSP80056AOtherInfo + decode_PkinitSP80056AOtherInfo + encode_PkinitSP80056AOtherInfo + free_PkinitSP80056AOtherInfo + length_PkinitSP80056AOtherInfo + copy_PkinitSuppPubInfo + decode_PkinitSuppPubInfo + encode_PkinitSuppPubInfo + free_PkinitSuppPubInfo + length_PkinitSuppPubInfo + copy_Principal + decode_Principal + encode_Principal + free_Principal + length_Principal + copy_PrincipalName + decode_PrincipalName + encode_PrincipalName + free_PrincipalName + length_PrincipalName + add_Principals + copy_Principals + decode_Principals + encode_Principals + free_Principals + length_Principals + remove_Principals + copy_ProxyCertInfo + decode_ProxyCertInfo + encode_ProxyCertInfo + free_ProxyCertInfo + length_ProxyCertInfo + copy_ProxyPolicy + decode_ProxyPolicy + encode_ProxyPolicy + free_ProxyPolicy + length_ProxyPolicy + copy_RDNSequence + decode_RDNSequence + encode_RDNSequence + free_RDNSequence + length_RDNSequence + copy_RSAPrivateKey + decode_RSAPrivateKey + encode_RSAPrivateKey + free_RSAPrivateKey + length_RSAPrivateKey + copy_RSAPublicKey + decode_RSAPublicKey + encode_RSAPublicKey + free_RSAPublicKey + length_RSAPublicKey + copy_Realm + decode_Realm + encode_Realm + free_Realm + length_Realm + copy_RecipientIdentifier + decode_RecipientIdentifier + encode_RecipientIdentifier + free_RecipientIdentifier + length_RecipientIdentifier + copy_RecipientInfo + decode_RecipientInfo + encode_RecipientInfo + free_RecipientInfo + length_RecipientInfo + copy_RecipientInfos + decode_RecipientInfos + encode_RecipientInfos + free_RecipientInfos + length_RecipientInfos + copy_RelativeDistinguishedName + decode_RelativeDistinguishedName + encode_RelativeDistinguishedName + free_RelativeDistinguishedName + length_RelativeDistinguishedName + copy_ReplyKeyPack + decode_ReplyKeyPack + encode_ReplyKeyPack + free_ReplyKeyPack + length_ReplyKeyPack + copy_ReplyKeyPack_Win2k + decode_ReplyKeyPack_Win2k + encode_ReplyKeyPack_Win2k + free_ReplyKeyPack_Win2k + length_ReplyKeyPack_Win2k + copy_SAMFlags + decode_SAMFlags + encode_SAMFlags + free_SAMFlags + length_SAMFlags + asn1_SAMFlags_units + copy_SignatureAlgorithmIdentifier + decode_SignatureAlgorithmIdentifier + encode_SignatureAlgorithmIdentifier + free_SignatureAlgorithmIdentifier + length_SignatureAlgorithmIdentifier + copy_SignatureValue + decode_SignatureValue + encode_SignatureValue + free_SignatureValue + length_SignatureValue + copy_SignedData + decode_SignedData + encode_SignedData + free_SignedData + length_SignedData + copy_SignerIdentifier + decode_SignerIdentifier + encode_SignerIdentifier + free_SignerIdentifier + length_SignerIdentifier + copy_SignerInfo + decode_SignerInfo + encode_SignerInfo + free_SignerInfo + length_SignerInfo + copy_SignerInfos + decode_SignerInfos + encode_SignerInfos + free_SignerInfos + length_SignerInfos + copy_SubjectKeyIdentifier + decode_SubjectKeyIdentifier + encode_SubjectKeyIdentifier + free_SubjectKeyIdentifier + length_SubjectKeyIdentifier + copy_SubjectPublicKeyInfo + decode_SubjectPublicKeyInfo + encode_SubjectPublicKeyInfo + free_SubjectPublicKeyInfo + length_SubjectPublicKeyInfo + copy_TBSCRLCertList + decode_TBSCRLCertList + encode_TBSCRLCertList + free_TBSCRLCertList + length_TBSCRLCertList + copy_TBSCertificate + decode_TBSCertificate + encode_TBSCertificate + free_TBSCertificate + length_TBSCertificate + copy_TD_DH_PARAMETERS + decode_TD_DH_PARAMETERS + encode_TD_DH_PARAMETERS + free_TD_DH_PARAMETERS + length_TD_DH_PARAMETERS + copy_TD_INVALID_CERTIFICATES + decode_TD_INVALID_CERTIFICATES + encode_TD_INVALID_CERTIFICATES + free_TD_INVALID_CERTIFICATES + length_TD_INVALID_CERTIFICATES + copy_TD_TRUSTED_CERTIFIERS + decode_TD_TRUSTED_CERTIFIERS + encode_TD_TRUSTED_CERTIFIERS + free_TD_TRUSTED_CERTIFIERS + length_TD_TRUSTED_CERTIFIERS + copy_TGS_REP + decode_TGS_REP + encode_TGS_REP + free_TGS_REP + length_TGS_REP + copy_TGS_REQ + decode_TGS_REQ + encode_TGS_REQ + free_TGS_REQ + length_TGS_REQ + copy_TYPED_DATA + decode_TYPED_DATA + encode_TYPED_DATA + free_TYPED_DATA + length_TYPED_DATA + copy_Ticket + decode_Ticket + encode_Ticket + free_Ticket + length_Ticket + copy_TicketFlags + decode_TicketFlags + encode_TicketFlags + free_TicketFlags + length_TicketFlags + asn1_TicketFlags_units + copy_Time + decode_Time + encode_Time + free_Time + length_Time + copy_TransitedEncoding + decode_TransitedEncoding + encode_TransitedEncoding + free_TransitedEncoding + length_TransitedEncoding + copy_TrustedCA + decode_TrustedCA + encode_TrustedCA + free_TrustedCA + length_TrustedCA + copy_TrustedCA_Win2k + decode_TrustedCA_Win2k + encode_TrustedCA_Win2k + free_TrustedCA_Win2k + length_TrustedCA_Win2k + copy_TypedData + decode_TypedData + encode_TypedData + free_TypedData + length_TypedData + copy_UniqueIdentifier + decode_UniqueIdentifier + encode_UniqueIdentifier + free_UniqueIdentifier + length_UniqueIdentifier + copy_UnprotectedAttributes + decode_UnprotectedAttributes + encode_UnprotectedAttributes + free_UnprotectedAttributes + length_UnprotectedAttributes + copy_ValidationParms + decode_ValidationParms + encode_ValidationParms + free_ValidationParms + length_ValidationParms + copy_Validity + decode_Validity + encode_Validity + free_Validity + length_Validity + copy_Version + decode_Version + encode_Version + free_Version + length_Version + heim_any_cmp + initialize_asn1_error_table + initialize_asn1_error_table_r + der_copy_bit_string + der_copy_bmp_string + der_copy_general_string + der_copy_generalized_time + der_copy_heim_integer + der_copy_ia5_string + der_copy_integer + der_copy_octet_string + der_copy_oid + der_copy_printable_string + der_copy_universal_string + der_copy_unsigned + der_copy_utctime + der_copy_utf8string + der_copy_visible_string + _der_timegm + der_free_bit_string + der_free_bmp_string + der_free_general_string + der_free_generalized_time + der_free_heim_integer + der_free_ia5_string + der_free_integer + der_free_octet_string + der_free_oid + der_free_printable_string + der_free_universal_string + der_free_unsigned + der_free_utctime + int2APOptions + int2DigestTypes + int2DistributionPointReasonFlags + int2FastOptions + int2KDCOptions + int2KeyUsage + int2SAMFlags + int2TicketFlags + der_free_utf8string + der_free_visible_string + der_get_bit_string + der_get_bmp_string + der_get_boolean der_get_class_name der_get_class_num - der_get_type_name - der_get_type_num - der_get_tag_name - der_get_tag_num - der_get_unsigned + der_get_general_string + der_get_generalized_time + der_get_heim_integer + der_get_ia5_string der_get_integer der_get_length - der_get_boolean - der_get_general_string - der_get_utf8string - der_get_printable_string - der_get_ia5_string - der_get_bmp_string - der_get_universal_string - der_get_visible_string der_get_octet_string der_get_octet_string_ber - der_get_heim_integer - der_get_generalized_time - der_get_utctime der_get_oid + der_get_printable_string der_get_tag + der_get_tag_name + der_get_tag_num + der_get_type_name + der_get_type_num + der_get_universal_string + der_get_unsigned + der_get_utctime + der_get_utf8string + der_get_visible_string + copy_heim_any + decode_heim_any + encode_heim_any + free_heim_any + length_heim_any + copy_heim_any_set + decode_heim_any_set + encode_heim_any_set + free_heim_any_set + length_heim_any_set + der_heim_bit_string_cmp + der_heim_bmp_string_cmp + _heim_der_set_sort + _heim_fix_dce + der_heim_integer_cmp + _heim_len_int + _heim_len_unsigned + der_heim_octet_string_cmp + der_heim_oid_cmp + _heim_time2generalizedtime + der_heim_universal_string_cmp + copy_krb5int32 + decode_krb5int32 + encode_krb5int32 + free_krb5int32 + length_krb5int32 + copy_krb5uint32 + decode_krb5uint32 + encode_krb5uint32 + free_krb5uint32 + length_krb5uint32 + der_length_bit_string + der_length_bmp_string + der_length_boolean + der_length_enumerated + der_length_general_string + der_length_generalized_time + der_length_heim_integer + der_length_ia5_string + der_length_integer + der_length_len + der_length_octet_string + der_length_oid + der_length_printable_string + der_length_tag + der_length_universal_string + der_length_unsigned + der_length_utctime + der_length_utf8string + der_length_visible_string der_match_tag der_match_tag2 der_match_tag_and_length - _heim_fix_dce - der_get_bit_string - der_put_unsigned - der_put_integer - der_put_length + asn1_oid_id_Userid + asn1_oid_id_aes_128_cbc + asn1_oid_id_aes_192_cbc + asn1_oid_id_aes_256_cbc + asn1_oid_id_at_commonName + asn1_oid_id_at_countryName + asn1_oid_id_at_generationQualifier + asn1_oid_id_at_givenName + asn1_oid_id_at_initials + asn1_oid_id_at_localityName + asn1_oid_id_at_name + asn1_oid_id_at_organizationName + asn1_oid_id_at_organizationalUnitName + asn1_oid_id_at_pseudonym + asn1_oid_id_at_serialNumber + asn1_oid_id_at_stateOrProvinceName + asn1_oid_id_at_streetAddress + asn1_oid_id_at_surname + asn1_oid_id_dhpublicnumber + asn1_oid_id_domainComponent + asn1_oid_id_dsa + asn1_oid_id_dsa_with_sha1 + asn1_oid_id_ecDH + asn1_oid_id_ecMQV + asn1_oid_id_ecPublicKey + asn1_oid_id_ec_group_secp160r1 + asn1_oid_id_ec_group_secp160r2 + asn1_oid_id_ec_group_secp256r1 + asn1_oid_id_ecdsa_with_SHA1 + asn1_oid_id_ecdsa_with_SHA256 + asn1_oid_id_heim_rsa_pkcs1_x509 + asn1_oid_id_ms_cert_enroll_domaincontroller + asn1_oid_id_ms_client_authentication + asn1_oid_id_netscape + asn1_oid_id_netscape_cert_comment + asn1_oid_id_nistAlgorithm + asn1_oid_id_nist_aes_algs + asn1_oid_id_nist_sha_algs + asn1_oid_id_pbeWithSHAAnd128BitRC2_CBC + asn1_oid_id_pbeWithSHAAnd128BitRC4 + asn1_oid_id_pbeWithSHAAnd2_KeyTripleDES_CBC + asn1_oid_id_pbeWithSHAAnd3_KeyTripleDES_CBC + asn1_oid_id_pbeWithSHAAnd40BitRC4 + asn1_oid_id_pbewithSHAAnd40BitRC2_CBC + asn1_oid_id_pkauthdata + asn1_oid_id_pkcs12_bagtypes + asn1_oid_id_pkcs12_certBag + asn1_oid_id_pkcs12_crlBag + asn1_oid_id_pkcs12_keyBag + asn1_oid_id_pkcs12_pkcs8ShroudedKeyBag + asn1_oid_id_pkcs12_safeContentsBag + asn1_oid_id_pkcs12_secretBag + asn1_oid_id_pkcs1_md2WithRSAEncryption + asn1_oid_id_pkcs1_md5WithRSAEncryption + asn1_oid_id_pkcs1_rsaEncryption + asn1_oid_id_pkcs1_sha1WithRSAEncryption + asn1_oid_id_pkcs1_sha256WithRSAEncryption + asn1_oid_id_pkcs1_sha384WithRSAEncryption + asn1_oid_id_pkcs1_sha512WithRSAEncryption + asn1_oid_id_pkcs2_md2 + asn1_oid_id_pkcs2_md4 + asn1_oid_id_pkcs2_md5 + asn1_oid_id_pkcs3_des_ede3_cbc + asn1_oid_id_pkcs3_rc2_cbc + asn1_oid_id_pkcs3_rc4 + asn1_oid_id_pkcs7 + asn1_oid_id_pkcs7_data + asn1_oid_id_pkcs7_digestedData + asn1_oid_id_pkcs7_encryptedData + asn1_oid_id_pkcs7_envelopedData + asn1_oid_id_pkcs7_signedAndEnvelopedData + asn1_oid_id_pkcs7_signedData + asn1_oid_id_pkcs9_contentType + asn1_oid_id_pkcs9_countersignature + asn1_oid_id_pkcs9_emailAddress + asn1_oid_id_pkcs9_messageDigest + asn1_oid_id_pkcs9_signingTime + asn1_oid_id_pkcs_1 + asn1_oid_id_pkcs_12 + asn1_oid_id_pkcs_12PbeIds + asn1_oid_id_pkcs_2 + asn1_oid_id_pkcs_3 + asn1_oid_id_pkcs_9 + asn1_oid_id_pkcs_9_at_certTypes + asn1_oid_id_pkcs_9_at_certTypes_x509 + asn1_oid_id_pkcs_9_at_friendlyName + asn1_oid_id_pkcs_9_at_localKeyId + asn1_oid_id_pkdhkeydata + asn1_oid_id_pkekuoid + asn1_oid_id_pkinit + asn1_oid_id_pkinit_kdf + asn1_oid_id_pkinit_kdf_ah_sha1 + asn1_oid_id_pkinit_kdf_ah_sha256 + asn1_oid_id_pkinit_kdf_ah_sha512 + asn1_oid_id_pkinit_ms_eku + asn1_oid_id_pkinit_ms_san + asn1_oid_id_pkinit_san + asn1_oid_id_pkix + asn1_oid_id_pkix_kp + asn1_oid_id_pkix_kp_OCSPSigning + asn1_oid_id_pkix_kp_clientAuth + asn1_oid_id_pkix_kp_emailProtection + asn1_oid_id_pkix_kp_serverAuth + asn1_oid_id_pkix_kp_timeStamping + asn1_oid_id_pkix_on + asn1_oid_id_pkix_on_dnsSRV + asn1_oid_id_pkix_on_xmppAddr + asn1_oid_id_pkix_pe + asn1_oid_id_pkix_pe_authorityInfoAccess + asn1_oid_id_pkix_pe_proxyCertInfo + asn1_oid_id_pkix_ppl + asn1_oid_id_pkix_ppl_anyLanguage + asn1_oid_id_pkix_ppl_independent + asn1_oid_id_pkix_ppl_inheritAll + asn1_oid_id_pkkdcekuoid + asn1_oid_id_pkrkeydata + asn1_oid_id_rsa_digestAlgorithm + asn1_oid_id_rsa_digest_md2 + asn1_oid_id_rsa_digest_md4 + asn1_oid_id_rsa_digest_md5 + asn1_oid_id_rsadsi_des_ede3_cbc + asn1_oid_id_rsadsi_encalg + asn1_oid_id_rsadsi_rc2_cbc + asn1_oid_id_secsig_sha_1 + asn1_oid_id_sha224 + asn1_oid_id_sha256 + asn1_oid_id_sha384 + asn1_oid_id_sha512 + asn1_oid_id_uspkicommon_card_id + asn1_oid_id_uspkicommon_piv_interim + asn1_oid_id_x509_ce + asn1_oid_id_x509_ce_authorityKeyIdentifier + asn1_oid_id_x509_ce_basicConstraints + asn1_oid_id_x509_ce_cRLDistributionPoints + asn1_oid_id_x509_ce_cRLNumber + asn1_oid_id_x509_ce_cRLReason + asn1_oid_id_x509_ce_certificateIssuer + asn1_oid_id_x509_ce_certificatePolicies + asn1_oid_id_x509_ce_deltaCRLIndicator + asn1_oid_id_x509_ce_extKeyUsage + asn1_oid_id_x509_ce_freshestCRL + asn1_oid_id_x509_ce_holdInstructionCode + asn1_oid_id_x509_ce_inhibitAnyPolicy + asn1_oid_id_x509_ce_invalidityDate + asn1_oid_id_x509_ce_issuerAltName + asn1_oid_id_x509_ce_issuingDistributionPoint + asn1_oid_id_x509_ce_keyUsage + asn1_oid_id_x509_ce_nameConstraints + asn1_oid_id_x509_ce_policyConstraints + asn1_oid_id_x509_ce_policyMappings + asn1_oid_id_x509_ce_privateKeyUsagePeriod + asn1_oid_id_x509_ce_subjectAltName + asn1_oid_id_x509_ce_subjectDirectoryAttributes + asn1_oid_id_x509_ce_subjectKeyIdentifier + asn1_oid_id_x520_at + asn1_oid_id_x9_57 + der_parse_heim_oid + der_parse_hex_heim_integer + der_print_heim_oid + der_print_hex_heim_integer + der_put_bit_string + der_put_bmp_string der_put_boolean der_put_general_string - der_put_utf8string - der_put_printable_string - der_put_ia5_string - der_put_bmp_string - der_put_universal_string - der_put_visible_string - der_put_octet_string - der_put_heim_integer der_put_generalized_time - der_put_utctime - der_put_oid - der_put_tag + der_put_heim_integer + der_put_ia5_string + der_put_integer + der_put_length der_put_length_and_tag - _heim_time2generalizedtime - der_put_bit_string - _heim_der_set_sort - der_free_general_string - der_free_utf8string - der_free_printable_string - der_free_ia5_string - der_free_bmp_string - der_free_universal_string - der_free_visible_string - der_free_octet_string - der_free_heim_integer - der_free_oid - der_free_bit_string - _heim_len_unsigned - _heim_len_int - der_length_len - der_length_integer - der_length_unsigned - der_length_enumerated - der_length_general_string - der_length_utf8string - der_length_printable_string - der_length_ia5_string - der_length_bmp_string - der_length_universal_string - der_length_visible_string - der_length_octet_string - der_length_heim_integer - der_length_oid - der_length_generalized_time - der_length_utctime - der_length_boolean - der_length_bit_string - der_copy_general_string - der_copy_utf8string - der_copy_printable_string - der_copy_ia5_string - der_copy_bmp_string - der_copy_universal_string - der_copy_visible_string - der_copy_octet_string - der_copy_heim_integer - der_copy_oid - der_copy_bit_string - der_heim_oid_cmp - der_heim_octet_string_cmp - der_heim_bit_string_cmp - der_heim_integer_cmp - der_heim_bmp_string_cmp - der_heim_universal_string_cmp - der_parse_hex_heim_integer - der_print_hex_heim_integer - der_print_heim_oid - der_parse_heim_oid - encode_heim_any - decode_heim_any - free_heim_any - length_heim_any - copy_heim_any - encode_heim_any_set - decode_heim_any_set - free_heim_any_set - length_heim_any_set - copy_heim_any_set - heim_any_cmp - _der_timegm - encode_AccessDescription - decode_AccessDescription - free_AccessDescription - length_AccessDescription - copy_AccessDescription - encode_AlgorithmIdentifier - decode_AlgorithmIdentifier - free_AlgorithmIdentifier - length_AlgorithmIdentifier - copy_AlgorithmIdentifier - encode_Attribute - decode_Attribute - free_Attribute - length_Attribute - copy_Attribute - encode_AttributeType - decode_AttributeType - free_AttributeType - length_AttributeType - copy_AttributeType - encode_AttributeTypeAndValue - decode_AttributeTypeAndValue - free_AttributeTypeAndValue - length_AttributeTypeAndValue - copy_AttributeTypeAndValue - encode_AttributeValue - decode_AttributeValue - free_AttributeValue - length_AttributeValue - copy_AttributeValue - encode_AuthorityInfoAccessSyntax - decode_AuthorityInfoAccessSyntax - free_AuthorityInfoAccessSyntax - length_AuthorityInfoAccessSyntax - copy_AuthorityInfoAccessSyntax - encode_AuthorityKeyIdentifier - decode_AuthorityKeyIdentifier - free_AuthorityKeyIdentifier - length_AuthorityKeyIdentifier - copy_AuthorityKeyIdentifier - encode_BaseDistance - decode_BaseDistance - free_BaseDistance - length_BaseDistance - copy_BaseDistance - encode_BasicConstraints - decode_BasicConstraints - free_BasicConstraints - length_BasicConstraints - copy_BasicConstraints - encode_CRLCertificateList - decode_CRLCertificateList - free_CRLCertificateList - length_CRLCertificateList - copy_CRLCertificateList - encode_CRLDistributionPoints - decode_CRLDistributionPoints - free_CRLDistributionPoints - length_CRLDistributionPoints - copy_CRLDistributionPoints - add_CRLDistributionPoints - remove_CRLDistributionPoints - encode_CRLReason - decode_CRLReason - free_CRLReason - length_CRLReason - copy_CRLReason - encode_Certificate - decode_Certificate - free_Certificate - length_Certificate - copy_Certificate - encode_CertificateSerialNumber - decode_CertificateSerialNumber - free_CertificateSerialNumber - length_CertificateSerialNumber - copy_CertificateSerialNumber - encode_Certificates - decode_Certificates - free_Certificates - length_Certificates - copy_Certificates - encode_DHPublicKey - decode_DHPublicKey - free_DHPublicKey - length_DHPublicKey - copy_DHPublicKey - encode_DSAParams - decode_DSAParams - free_DSAParams - length_DSAParams - copy_DSAParams - encode_DSAPublicKey - decode_DSAPublicKey - free_DSAPublicKey - length_DSAPublicKey - copy_DSAPublicKey - encode_DSASigValue - decode_DSASigValue - free_DSASigValue - length_DSASigValue - copy_DSASigValue - encode_DigestInfo - decode_DigestInfo - free_DigestInfo - length_DigestInfo - copy_DigestInfo - encode_DirectoryString - decode_DirectoryString - free_DirectoryString - length_DirectoryString - copy_DirectoryString - encode_DistributionPoint - decode_DistributionPoint - free_DistributionPoint - length_DistributionPoint - copy_DistributionPoint - encode_DistributionPointName - decode_DistributionPointName - free_DistributionPointName - length_DistributionPointName - copy_DistributionPointName - encode_DistributionPointReasonFlags - decode_DistributionPointReasonFlags - free_DistributionPointReasonFlags - length_DistributionPointReasonFlags - copy_DistributionPointReasonFlags - DistributionPointReasonFlags2int - int2DistributionPointReasonFlags - asn1_DistributionPointReasonFlags_units - encode_DomainParameters - decode_DomainParameters - free_DomainParameters - length_DomainParameters - copy_DomainParameters - encode_ECParameters - decode_ECParameters - free_ECParameters - length_ECParameters - copy_ECParameters - encode_ECPoint - decode_ECPoint - free_ECPoint - length_ECPoint - copy_ECPoint - encode_ECDSA_Sig_Value - decode_ECDSA_Sig_Value - free_ECDSA_Sig_Value - length_ECDSA_Sig_Value - copy_ECDSA_Sig_Value - encode_ExtKeyUsage - decode_ExtKeyUsage - free_ExtKeyUsage - length_ExtKeyUsage - copy_ExtKeyUsage - encode_Extension - decode_Extension - free_Extension - length_Extension - copy_Extension - encode_Extensions - decode_Extensions - free_Extensions - length_Extensions - copy_Extensions - add_Extensions - remove_Extensions - encode_GeneralName - decode_GeneralName - free_GeneralName - length_GeneralName - copy_GeneralName - encode_GeneralNames - decode_GeneralNames - free_GeneralNames - length_GeneralNames - copy_GeneralNames - add_GeneralNames - remove_GeneralNames - encode_GeneralSubtree - decode_GeneralSubtree - free_GeneralSubtree - length_GeneralSubtree - copy_GeneralSubtree - encode_GeneralSubtrees - decode_GeneralSubtrees - free_GeneralSubtrees - length_GeneralSubtrees - copy_GeneralSubtrees - encode_KeyIdentifier - decode_KeyIdentifier - free_KeyIdentifier - length_KeyIdentifier - copy_KeyIdentifier - encode_KeyUsage - decode_KeyUsage - free_KeyUsage - length_KeyUsage - copy_KeyUsage - KeyUsage2int - int2KeyUsage - asn1_KeyUsage_units - encode_Name - decode_Name - free_Name - length_Name - copy_Name - encode_NameConstraints - decode_NameConstraints - free_NameConstraints - length_NameConstraints - copy_NameConstraints - encode_OtherName - decode_OtherName - free_OtherName - length_OtherName - copy_OtherName - encode_PKIXXmppAddr - decode_PKIXXmppAddr - free_PKIXXmppAddr - length_PKIXXmppAddr - copy_PKIXXmppAddr - encode_ProxyCertInfo - decode_ProxyCertInfo - free_ProxyCertInfo - length_ProxyCertInfo - copy_ProxyCertInfo - encode_ProxyPolicy - decode_ProxyPolicy - free_ProxyPolicy - length_ProxyPolicy - copy_ProxyPolicy - encode_RDNSequence - decode_RDNSequence - free_RDNSequence - length_RDNSequence - copy_RDNSequence - encode_RSAPrivateKey - decode_RSAPrivateKey - free_RSAPrivateKey - length_RSAPrivateKey - copy_RSAPrivateKey - encode_RSAPublicKey - decode_RSAPublicKey - free_RSAPublicKey - length_RSAPublicKey - copy_RSAPublicKey - encode_RelativeDistinguishedName - decode_RelativeDistinguishedName - free_RelativeDistinguishedName - length_RelativeDistinguishedName - copy_RelativeDistinguishedName - encode_SubjectKeyIdentifier - decode_SubjectKeyIdentifier - free_SubjectKeyIdentifier - length_SubjectKeyIdentifier - copy_SubjectKeyIdentifier - encode_SubjectPublicKeyInfo - decode_SubjectPublicKeyInfo - free_SubjectPublicKeyInfo - length_SubjectPublicKeyInfo - copy_SubjectPublicKeyInfo - encode_TBSCRLCertList - decode_TBSCRLCertList - free_TBSCRLCertList - length_TBSCRLCertList - copy_TBSCRLCertList - encode_TBSCertificate - decode_TBSCertificate - free_TBSCertificate - length_TBSCertificate - copy_TBSCertificate - encode_TeletexStringx - decode_TeletexStringx - free_TeletexStringx - length_TeletexStringx - copy_TeletexStringx - encode_Time - decode_Time - free_Time - length_Time - copy_Time - encode_UniqueIdentifier - decode_UniqueIdentifier - free_UniqueIdentifier - length_UniqueIdentifier - copy_UniqueIdentifier - encode_ValidationParms - decode_ValidationParms - free_ValidationParms - length_ValidationParms - copy_ValidationParms - encode_Validity - decode_Validity - free_Validity - length_Validity - copy_Validity - encode_Version - decode_Version - free_Version - length_Version - copy_Version - asn1_oid_id_Userid - oid_id_Userid - asn1_oid_id_aes_128_cbc - oid_id_aes_128_cbc - asn1_oid_id_aes_192_cbc - oid_id_aes_192_cbc - asn1_oid_id_aes_256_cbc - oid_id_aes_256_cbc - asn1_oid_id_at_commonName - oid_id_at_commonName - asn1_oid_id_at_countryName - oid_id_at_countryName - asn1_oid_id_at_generationQualifier - oid_id_at_generationQualifier - asn1_oid_id_at_givenName - oid_id_at_givenName - asn1_oid_id_at_initials - oid_id_at_initials - asn1_oid_id_at_localityName - oid_id_at_localityName - asn1_oid_id_at_name - oid_id_at_name - asn1_oid_id_at_organizationName - oid_id_at_organizationName - asn1_oid_id_at_organizationalUnitName - oid_id_at_organizationalUnitName - asn1_oid_id_at_pseudonym - oid_id_at_pseudonym - asn1_oid_id_at_serialNumber - oid_id_at_serialNumber - asn1_oid_id_at_stateOrProvinceName - oid_id_at_stateOrProvinceName - asn1_oid_id_at_streetAddress - oid_id_at_streetAddress - asn1_oid_id_at_surname - oid_id_at_surname - asn1_oid_id_dhpublicnumber - oid_id_dhpublicnumber - asn1_oid_id_domainComponent - oid_id_domainComponent - asn1_oid_id_dsa - oid_id_dsa - asn1_oid_id_dsa_with_sha1 - oid_id_dsa_with_sha1 - asn1_oid_id_ecDH - oid_id_ecDH - asn1_oid_id_ecMQV - oid_id_ecMQV - asn1_oid_id_ecPublicKey - oid_id_ecPublicKey - asn1_oid_id_ec_group_secp160r1 - oid_id_ec_group_secp160r1 - asn1_oid_id_ec_group_secp160r2 - oid_id_ec_group_secp160r2 - asn1_oid_id_ec_group_secp256r1 - oid_id_ec_group_secp256r1 - asn1_oid_id_ecdsa_with_SHA1 - oid_id_ecdsa_with_SHA1 - asn1_oid_id_ecdsa_with_SHA256 - oid_id_ecdsa_with_SHA256 - asn1_oid_id_heim_rsa_pkcs1_x509 - oid_id_heim_rsa_pkcs1_x509 - asn1_oid_id_ms_cert_enroll_domaincontroller - oid_id_ms_cert_enroll_domaincontroller - asn1_oid_id_ms_client_authentication - oid_id_ms_client_authentication - asn1_oid_id_netscape - oid_id_netscape - asn1_oid_id_netscape_cert_comment - oid_id_netscape_cert_comment - asn1_oid_id_nistAlgorithm - oid_id_nistAlgorithm - asn1_oid_id_nist_aes_algs - oid_id_nist_aes_algs - asn1_oid_id_nist_sha_algs - oid_id_nist_sha_algs - asn1_oid_id_pkcs1_md2WithRSAEncryption - oid_id_pkcs1_md2WithRSAEncryption - asn1_oid_id_pkcs1_md5WithRSAEncryption - oid_id_pkcs1_md5WithRSAEncryption - asn1_oid_id_pkcs1_rsaEncryption - oid_id_pkcs1_rsaEncryption - asn1_oid_id_pkcs1_sha1WithRSAEncryption - oid_id_pkcs1_sha1WithRSAEncryption - asn1_oid_id_pkcs1_sha256WithRSAEncryption - oid_id_pkcs1_sha256WithRSAEncryption - asn1_oid_id_pkcs1_sha384WithRSAEncryption - oid_id_pkcs1_sha384WithRSAEncryption - asn1_oid_id_pkcs1_sha512WithRSAEncryption - oid_id_pkcs1_sha512WithRSAEncryption - asn1_oid_id_pkcs2_md2 - oid_id_pkcs2_md2 - asn1_oid_id_pkcs2_md4 - oid_id_pkcs2_md4 - asn1_oid_id_pkcs2_md5 - oid_id_pkcs2_md5 - asn1_oid_id_pkcs3_des_ede3_cbc - oid_id_pkcs3_des_ede3_cbc - asn1_oid_id_pkcs3_rc2_cbc - oid_id_pkcs3_rc2_cbc - asn1_oid_id_pkcs3_rc4 - oid_id_pkcs3_rc4 - asn1_oid_id_pkcs_1 - oid_id_pkcs_1 - asn1_oid_id_pkcs_2 - oid_id_pkcs_2 - asn1_oid_id_pkcs_3 - oid_id_pkcs_3 - asn1_oid_id_pkix - oid_id_pkix - asn1_oid_id_pkix_kp - oid_id_pkix_kp - asn1_oid_id_pkix_kp_OCSPSigning - oid_id_pkix_kp_OCSPSigning - asn1_oid_id_pkix_kp_clientAuth - oid_id_pkix_kp_clientAuth - asn1_oid_id_pkix_kp_emailProtection - oid_id_pkix_kp_emailProtection - asn1_oid_id_pkix_kp_serverAuth - oid_id_pkix_kp_serverAuth - asn1_oid_id_pkix_kp_timeStamping - oid_id_pkix_kp_timeStamping - asn1_oid_id_pkix_on - oid_id_pkix_on - asn1_oid_id_pkix_on_dnsSRV - oid_id_pkix_on_dnsSRV - asn1_oid_id_pkix_on_xmppAddr - oid_id_pkix_on_xmppAddr - asn1_oid_id_pkix_pe - oid_id_pkix_pe - asn1_oid_id_pkix_pe_authorityInfoAccess - oid_id_pkix_pe_authorityInfoAccess - asn1_oid_id_pkix_pe_proxyCertInfo - oid_id_pkix_pe_proxyCertInfo - asn1_oid_id_pkix_ppl - oid_id_pkix_ppl - asn1_oid_id_pkix_ppl_anyLanguage - oid_id_pkix_ppl_anyLanguage - asn1_oid_id_pkix_ppl_independent - oid_id_pkix_ppl_independent - asn1_oid_id_pkix_ppl_inheritAll - oid_id_pkix_ppl_inheritAll - asn1_oid_id_rsa_digestAlgorithm - oid_id_rsa_digestAlgorithm - asn1_oid_id_rsa_digest_md2 - oid_id_rsa_digest_md2 - asn1_oid_id_rsa_digest_md4 - oid_id_rsa_digest_md4 - asn1_oid_id_rsa_digest_md5 - oid_id_rsa_digest_md5 - asn1_oid_id_rsadsi_des_ede3_cbc - oid_id_rsadsi_des_ede3_cbc - asn1_oid_id_rsadsi_encalg - oid_id_rsadsi_encalg - asn1_oid_id_rsadsi_rc2_cbc - oid_id_rsadsi_rc2_cbc - asn1_oid_id_secsig_sha_1 - oid_id_secsig_sha_1 - asn1_oid_id_sha224 - oid_id_sha224 - asn1_oid_id_sha256 - oid_id_sha256 - asn1_oid_id_sha384 - oid_id_sha384 - asn1_oid_id_sha512 - oid_id_sha512 - asn1_oid_id_uspkicommon_card_id - oid_id_uspkicommon_card_id - asn1_oid_id_uspkicommon_piv_interim - oid_id_uspkicommon_piv_interim - asn1_oid_id_x509_ce - oid_id_x509_ce - asn1_oid_id_x509_ce_authorityKeyIdentifier - oid_id_x509_ce_authorityKeyIdentifier - asn1_oid_id_x509_ce_basicConstraints - oid_id_x509_ce_basicConstraints - asn1_oid_id_x509_ce_cRLDistributionPoints - oid_id_x509_ce_cRLDistributionPoints - asn1_oid_id_x509_ce_cRLNumber - oid_id_x509_ce_cRLNumber - asn1_oid_id_x509_ce_cRLReason - oid_id_x509_ce_cRLReason - asn1_oid_id_x509_ce_certificateIssuer - oid_id_x509_ce_certificateIssuer - asn1_oid_id_x509_ce_certificatePolicies - oid_id_x509_ce_certificatePolicies - asn1_oid_id_x509_ce_deltaCRLIndicator - oid_id_x509_ce_deltaCRLIndicator - asn1_oid_id_x509_ce_extKeyUsage - oid_id_x509_ce_extKeyUsage - asn1_oid_id_x509_ce_freshestCRL - oid_id_x509_ce_freshestCRL - asn1_oid_id_x509_ce_holdInstructionCode - oid_id_x509_ce_holdInstructionCode - asn1_oid_id_x509_ce_inhibitAnyPolicy - oid_id_x509_ce_inhibitAnyPolicy - asn1_oid_id_x509_ce_invalidityDate - oid_id_x509_ce_invalidityDate - asn1_oid_id_x509_ce_issuerAltName - oid_id_x509_ce_issuerAltName - asn1_oid_id_x509_ce_issuingDistributionPoint - oid_id_x509_ce_issuingDistributionPoint - asn1_oid_id_x509_ce_keyUsage - oid_id_x509_ce_keyUsage - asn1_oid_id_x509_ce_nameConstraints - oid_id_x509_ce_nameConstraints - asn1_oid_id_x509_ce_policyConstraints - oid_id_x509_ce_policyConstraints - asn1_oid_id_x509_ce_policyMappings - oid_id_x509_ce_policyMappings - asn1_oid_id_x509_ce_privateKeyUsagePeriod - oid_id_x509_ce_privateKeyUsagePeriod - asn1_oid_id_x509_ce_subjectAltName - oid_id_x509_ce_subjectAltName - asn1_oid_id_x509_ce_subjectDirectoryAttributes - oid_id_x509_ce_subjectDirectoryAttributes - asn1_oid_id_x509_ce_subjectKeyIdentifier - oid_id_x509_ce_subjectKeyIdentifier - asn1_oid_id_x520_at - oid_id_x520_at - asn1_oid_id_x9_57 - oid_id_x9_57 - encode_CMSAttributes - decode_CMSAttributes - free_CMSAttributes - length_CMSAttributes - copy_CMSAttributes - encode_CMSCBCParameter - decode_CMSCBCParameter - free_CMSCBCParameter - length_CMSCBCParameter - copy_CMSCBCParameter - encode_CMSEncryptedData - decode_CMSEncryptedData - free_CMSEncryptedData - length_CMSEncryptedData - copy_CMSEncryptedData - encode_CMSIdentifier - decode_CMSIdentifier - free_CMSIdentifier - length_CMSIdentifier - copy_CMSIdentifier - encode_CMSRC2CBCParameter - decode_CMSRC2CBCParameter - free_CMSRC2CBCParameter - length_CMSRC2CBCParameter - copy_CMSRC2CBCParameter - encode_CMSVersion - decode_CMSVersion - free_CMSVersion - length_CMSVersion - copy_CMSVersion - encode_CertificateList - decode_CertificateList - free_CertificateList - length_CertificateList - copy_CertificateList - encode_CertificateRevocationLists - decode_CertificateRevocationLists - free_CertificateRevocationLists - length_CertificateRevocationLists - copy_CertificateRevocationLists - encode_CertificateSet - decode_CertificateSet - free_CertificateSet - length_CertificateSet - copy_CertificateSet - encode_ContentEncryptionAlgorithmIdentifier - decode_ContentEncryptionAlgorithmIdentifier - free_ContentEncryptionAlgorithmIdentifier - length_ContentEncryptionAlgorithmIdentifier - copy_ContentEncryptionAlgorithmIdentifier - encode_ContentInfo - decode_ContentInfo - free_ContentInfo - length_ContentInfo - copy_ContentInfo - encode_ContentType - decode_ContentType - free_ContentType - length_ContentType - copy_ContentType - encode_DigestAlgorithmIdentifier - decode_DigestAlgorithmIdentifier - free_DigestAlgorithmIdentifier - length_DigestAlgorithmIdentifier - copy_DigestAlgorithmIdentifier - encode_DigestAlgorithmIdentifiers - decode_DigestAlgorithmIdentifiers - free_DigestAlgorithmIdentifiers - length_DigestAlgorithmIdentifiers - copy_DigestAlgorithmIdentifiers - encode_EncapsulatedContentInfo - decode_EncapsulatedContentInfo - free_EncapsulatedContentInfo - length_EncapsulatedContentInfo - copy_EncapsulatedContentInfo - encode_EncryptedContent - decode_EncryptedContent - free_EncryptedContent - length_EncryptedContent - copy_EncryptedContent - encode_EncryptedContentInfo - decode_EncryptedContentInfo - free_EncryptedContentInfo - length_EncryptedContentInfo - copy_EncryptedContentInfo - encode_EncryptedKey - decode_EncryptedKey - free_EncryptedKey - length_EncryptedKey - copy_EncryptedKey - encode_EnvelopedData - decode_EnvelopedData - free_EnvelopedData - length_EnvelopedData - copy_EnvelopedData - encode_IssuerAndSerialNumber - decode_IssuerAndSerialNumber - free_IssuerAndSerialNumber - length_IssuerAndSerialNumber - copy_IssuerAndSerialNumber - encode_KeyEncryptionAlgorithmIdentifier - decode_KeyEncryptionAlgorithmIdentifier - free_KeyEncryptionAlgorithmIdentifier - length_KeyEncryptionAlgorithmIdentifier - copy_KeyEncryptionAlgorithmIdentifier - encode_KeyTransRecipientInfo - decode_KeyTransRecipientInfo - free_KeyTransRecipientInfo - length_KeyTransRecipientInfo - copy_KeyTransRecipientInfo - encode_MessageDigest - decode_MessageDigest - free_MessageDigest - length_MessageDigest - copy_MessageDigest - encode_OriginatorInfo - decode_OriginatorInfo - free_OriginatorInfo - length_OriginatorInfo - copy_OriginatorInfo - encode_RecipientIdentifier - decode_RecipientIdentifier - free_RecipientIdentifier - length_RecipientIdentifier - copy_RecipientIdentifier - encode_RecipientInfo - decode_RecipientInfo - free_RecipientInfo - length_RecipientInfo - copy_RecipientInfo - encode_RecipientInfos - decode_RecipientInfos - free_RecipientInfos - length_RecipientInfos - copy_RecipientInfos - encode_SignatureAlgorithmIdentifier - decode_SignatureAlgorithmIdentifier - free_SignatureAlgorithmIdentifier - length_SignatureAlgorithmIdentifier - copy_SignatureAlgorithmIdentifier - encode_SignatureValue - decode_SignatureValue - free_SignatureValue - length_SignatureValue - copy_SignatureValue - encode_SignedData - decode_SignedData - free_SignedData - length_SignedData - copy_SignedData - encode_SignerIdentifier - decode_SignerIdentifier - free_SignerIdentifier - length_SignerIdentifier - copy_SignerIdentifier - encode_SignerInfo - decode_SignerInfo - free_SignerInfo - length_SignerInfo - copy_SignerInfo - encode_SignerInfos - decode_SignerInfos - free_SignerInfos - length_SignerInfos - copy_SignerInfos - asn1_oid_id_pkcs7 - oid_id_pkcs7 - asn1_oid_id_pkcs7_data - oid_id_pkcs7_data - asn1_oid_id_pkcs7_digestedData - oid_id_pkcs7_digestedData - asn1_oid_id_pkcs7_encryptedData - oid_id_pkcs7_encryptedData - asn1_oid_id_pkcs7_envelopedData - oid_id_pkcs7_envelopedData - asn1_oid_id_pkcs7_signedAndEnvelopedData - oid_id_pkcs7_signedAndEnvelopedData - asn1_oid_id_pkcs7_signedData - oid_id_pkcs7_signedData - encode_UnprotectedAttributes - decode_UnprotectedAttributes - free_UnprotectedAttributes - length_UnprotectedAttributes - copy_UnprotectedAttributes - encode_AD_AND_OR - decode_AD_AND_OR - free_AD_AND_OR - length_AD_AND_OR - copy_AD_AND_OR - encode_AD_IF_RELEVANT - decode_AD_IF_RELEVANT - free_AD_IF_RELEVANT - length_AD_IF_RELEVANT - copy_AD_IF_RELEVANT - encode_AD_KDCIssued - decode_AD_KDCIssued - free_AD_KDCIssued - length_AD_KDCIssued - copy_AD_KDCIssued - encode_AD_MANDATORY_FOR_KDC - decode_AD_MANDATORY_FOR_KDC - free_AD_MANDATORY_FOR_KDC - length_AD_MANDATORY_FOR_KDC - copy_AD_MANDATORY_FOR_KDC - encode_AD_LoginAlias - decode_AD_LoginAlias - free_AD_LoginAlias - length_AD_LoginAlias - copy_AD_LoginAlias - encode_APOptions - decode_APOptions - free_APOptions - length_APOptions - copy_APOptions - APOptions2int - int2APOptions - asn1_APOptions_units - encode_AP_REP - decode_AP_REP - free_AP_REP - length_AP_REP - copy_AP_REP - encode_AP_REQ - decode_AP_REQ - free_AP_REQ - length_AP_REQ - copy_AP_REQ - encode_AS_REP - decode_AS_REP - free_AS_REP - length_AS_REP - copy_AS_REP - encode_AS_REQ - decode_AS_REQ - free_AS_REQ - length_AS_REQ - copy_AS_REQ - encode_AUTHDATA_TYPE - decode_AUTHDATA_TYPE - free_AUTHDATA_TYPE - length_AUTHDATA_TYPE - copy_AUTHDATA_TYPE - encode_Authenticator - decode_Authenticator - free_Authenticator - length_Authenticator - copy_Authenticator - encode_AuthorizationData - decode_AuthorizationData - free_AuthorizationData - length_AuthorizationData - copy_AuthorizationData - add_AuthorizationData - remove_AuthorizationData - encode_AuthorizationDataElement - decode_AuthorizationDataElement - free_AuthorizationDataElement - length_AuthorizationDataElement - copy_AuthorizationDataElement - encode_CKSUMTYPE - decode_CKSUMTYPE - free_CKSUMTYPE - length_CKSUMTYPE - copy_CKSUMTYPE - encode_ChangePasswdDataMS - decode_ChangePasswdDataMS - free_ChangePasswdDataMS - length_ChangePasswdDataMS - copy_ChangePasswdDataMS - encode_Checksum - decode_Checksum - free_Checksum - length_Checksum - copy_Checksum - encode_ENCTYPE - decode_ENCTYPE - free_ENCTYPE - length_ENCTYPE - copy_ENCTYPE - encode_ETYPE_INFO - decode_ETYPE_INFO - free_ETYPE_INFO - length_ETYPE_INFO - copy_ETYPE_INFO - add_ETYPE_INFO - remove_ETYPE_INFO - encode_ETYPE_INFO2 - decode_ETYPE_INFO2 - free_ETYPE_INFO2 - length_ETYPE_INFO2 - copy_ETYPE_INFO2 - add_ETYPE_INFO2 - remove_ETYPE_INFO2 - encode_ETYPE_INFO2_ENTRY - decode_ETYPE_INFO2_ENTRY - free_ETYPE_INFO2_ENTRY - length_ETYPE_INFO2_ENTRY - copy_ETYPE_INFO2_ENTRY - encode_ETYPE_INFO_ENTRY - decode_ETYPE_INFO_ENTRY - free_ETYPE_INFO_ENTRY - length_ETYPE_INFO_ENTRY - copy_ETYPE_INFO_ENTRY - encode_EncAPRepPart - decode_EncAPRepPart - free_EncAPRepPart - length_EncAPRepPart - copy_EncAPRepPart - encode_EncASRepPart - decode_EncASRepPart - free_EncASRepPart - length_EncASRepPart - copy_EncASRepPart - encode_EncKDCRepPart - decode_EncKDCRepPart - free_EncKDCRepPart - length_EncKDCRepPart - copy_EncKDCRepPart - encode_EncKrbCredPart - decode_EncKrbCredPart - free_EncKrbCredPart - length_EncKrbCredPart - copy_EncKrbCredPart - encode_EncKrbPrivPart - decode_EncKrbPrivPart - free_EncKrbPrivPart - length_EncKrbPrivPart - copy_EncKrbPrivPart - encode_EncTGSRepPart - decode_EncTGSRepPart - free_EncTGSRepPart - length_EncTGSRepPart - copy_EncTGSRepPart - encode_EncTicketPart - decode_EncTicketPart - free_EncTicketPart - length_EncTicketPart - copy_EncTicketPart - encode_EncryptedData - decode_EncryptedData - free_EncryptedData - length_EncryptedData - copy_EncryptedData - encode_EncryptionKey - decode_EncryptionKey - free_EncryptionKey - length_EncryptionKey - copy_EncryptionKey - encode_EtypeList - decode_EtypeList - free_EtypeList - length_EtypeList - copy_EtypeList - encode_HostAddress - decode_HostAddress - free_HostAddress - length_HostAddress - copy_HostAddress - encode_HostAddresses - decode_HostAddresses - free_HostAddresses - length_HostAddresses - copy_HostAddresses - encode_KDCOptions - decode_KDCOptions - free_KDCOptions - length_KDCOptions - copy_KDCOptions - KDCOptions2int - int2KDCOptions - asn1_KDCOptions_units - encode_KDC_REP - decode_KDC_REP - free_KDC_REP - length_KDC_REP - copy_KDC_REP - encode_KDC_REQ - decode_KDC_REQ - free_KDC_REQ - length_KDC_REQ - copy_KDC_REQ - encode_KDC_REQ_BODY - decode_KDC_REQ_BODY - free_KDC_REQ_BODY - length_KDC_REQ_BODY - copy_KDC_REQ_BODY - encode_KRB_CRED - decode_KRB_CRED - free_KRB_CRED - length_KRB_CRED - copy_KRB_CRED - encode_KRB_ERROR - decode_KRB_ERROR - free_KRB_ERROR - length_KRB_ERROR - copy_KRB_ERROR - encode_KRB_PRIV - decode_KRB_PRIV - free_KRB_PRIV - length_KRB_PRIV - copy_KRB_PRIV - encode_KRB_SAFE - decode_KRB_SAFE - free_KRB_SAFE - length_KRB_SAFE - copy_KRB_SAFE - encode_KRB_SAFE_BODY - decode_KRB_SAFE_BODY - free_KRB_SAFE_BODY - length_KRB_SAFE_BODY - copy_KRB_SAFE_BODY - encode_KerberosString - decode_KerberosString - free_KerberosString - length_KerberosString - copy_KerberosString - encode_KerberosTime - decode_KerberosTime - free_KerberosTime - length_KerberosTime - copy_KerberosTime - encode_KrbCredInfo - decode_KrbCredInfo - free_KrbCredInfo - length_KrbCredInfo - copy_KrbCredInfo - encode_LR_TYPE - decode_LR_TYPE - free_LR_TYPE - length_LR_TYPE - copy_LR_TYPE - encode_LastReq - decode_LastReq - free_LastReq - length_LastReq - copy_LastReq - encode_MESSAGE_TYPE - decode_MESSAGE_TYPE - free_MESSAGE_TYPE - length_MESSAGE_TYPE - copy_MESSAGE_TYPE - encode_METHOD_DATA - decode_METHOD_DATA - free_METHOD_DATA - length_METHOD_DATA - copy_METHOD_DATA - add_METHOD_DATA - remove_METHOD_DATA - encode_NAME_TYPE - decode_NAME_TYPE - free_NAME_TYPE - length_NAME_TYPE - copy_NAME_TYPE - encode_PADATA_TYPE - decode_PADATA_TYPE - free_PADATA_TYPE - length_PADATA_TYPE - copy_PADATA_TYPE - encode_PA_DATA - decode_PA_DATA - free_PA_DATA - length_PA_DATA - copy_PA_DATA - encode_PA_ENC_SAM_RESPONSE_ENC - decode_PA_ENC_SAM_RESPONSE_ENC - free_PA_ENC_SAM_RESPONSE_ENC - length_PA_ENC_SAM_RESPONSE_ENC - copy_PA_ENC_SAM_RESPONSE_ENC - encode_PA_ENC_TS_ENC - decode_PA_ENC_TS_ENC - free_PA_ENC_TS_ENC - length_PA_ENC_TS_ENC - copy_PA_ENC_TS_ENC - encode_PA_PAC_REQUEST - decode_PA_PAC_REQUEST - free_PA_PAC_REQUEST - length_PA_PAC_REQUEST - copy_PA_PAC_REQUEST - encode_PA_S4U2Self - decode_PA_S4U2Self - free_PA_S4U2Self - length_PA_S4U2Self - copy_PA_S4U2Self - encode_PA_SAM_CHALLENGE_2 - decode_PA_SAM_CHALLENGE_2 - free_PA_SAM_CHALLENGE_2 - length_PA_SAM_CHALLENGE_2 - copy_PA_SAM_CHALLENGE_2 - encode_PA_SAM_CHALLENGE_2_BODY - decode_PA_SAM_CHALLENGE_2_BODY - free_PA_SAM_CHALLENGE_2_BODY - length_PA_SAM_CHALLENGE_2_BODY - copy_PA_SAM_CHALLENGE_2_BODY - encode_PA_SAM_REDIRECT - decode_PA_SAM_REDIRECT - free_PA_SAM_REDIRECT - length_PA_SAM_REDIRECT - copy_PA_SAM_REDIRECT - encode_PA_SAM_RESPONSE_2 - decode_PA_SAM_RESPONSE_2 - free_PA_SAM_RESPONSE_2 - length_PA_SAM_RESPONSE_2 - copy_PA_SAM_RESPONSE_2 - encode_PA_SAM_TYPE - decode_PA_SAM_TYPE - free_PA_SAM_TYPE - length_PA_SAM_TYPE - copy_PA_SAM_TYPE - encode_PA_ClientCanonicalized - decode_PA_ClientCanonicalized - free_PA_ClientCanonicalized - length_PA_ClientCanonicalized - copy_PA_ClientCanonicalized - encode_PA_ClientCanonicalizedNames - decode_PA_ClientCanonicalizedNames - free_PA_ClientCanonicalizedNames - length_PA_ClientCanonicalizedNames - copy_PA_ClientCanonicalizedNames - encode_PA_SvrReferralData - decode_PA_SvrReferralData - free_PA_SvrReferralData - length_PA_SvrReferralData - copy_PA_SvrReferralData - encode_PA_ServerReferralData - decode_PA_ServerReferralData - free_PA_ServerReferralData - length_PA_ServerReferralData - copy_PA_ServerReferralData - encode_PA_SERVER_REFERRAL_DATA - decode_PA_SERVER_REFERRAL_DATA - free_PA_SERVER_REFERRAL_DATA - length_PA_SERVER_REFERRAL_DATA - copy_PA_SERVER_REFERRAL_DATA - encode_PROV_SRV_LOCATION - decode_PROV_SRV_LOCATION - free_PROV_SRV_LOCATION - length_PROV_SRV_LOCATION - copy_PROV_SRV_LOCATION - encode_Principal - decode_Principal - free_Principal - length_Principal - copy_Principal - encode_PrincipalName - decode_PrincipalName - free_PrincipalName - length_PrincipalName - copy_PrincipalName - encode_Principals - decode_Principals - free_Principals - length_Principals - copy_Principals - add_Principals - remove_Principals - encode_Realm - decode_Realm - free_Realm - length_Realm - copy_Realm - encode_SAMFlags - decode_SAMFlags - free_SAMFlags - length_SAMFlags - copy_SAMFlags - SAMFlags2int - int2SAMFlags - asn1_SAMFlags_units - encode_TGS_REP - decode_TGS_REP - free_TGS_REP - length_TGS_REP - copy_TGS_REP - encode_TGS_REQ - decode_TGS_REQ - free_TGS_REQ - length_TGS_REQ - copy_TGS_REQ - encode_TYPED_DATA - decode_TYPED_DATA - free_TYPED_DATA - length_TYPED_DATA - copy_TYPED_DATA - encode_Ticket - decode_Ticket - free_Ticket - length_Ticket - copy_Ticket - encode_TicketFlags - decode_TicketFlags - free_TicketFlags - length_TicketFlags - copy_TicketFlags - TicketFlags2int - int2TicketFlags - asn1_TicketFlags_units - encode_TransitedEncoding - decode_TransitedEncoding - free_TransitedEncoding - length_TransitedEncoding - copy_TransitedEncoding - encode_TypedData - decode_TypedData - free_TypedData - length_TypedData - copy_TypedData - encode_krb5int32 - decode_krb5int32 - free_krb5int32 - length_krb5int32 - copy_krb5int32 - encode_krb5uint32 - decode_krb5uint32 - free_krb5uint32 - length_krb5uint32 - copy_krb5uint32 - encode_KRB5SignedPathData - decode_KRB5SignedPathData - free_KRB5SignedPathData - length_KRB5SignedPathData - copy_KRB5SignedPathData - encode_KRB5SignedPath - decode_KRB5SignedPath - free_KRB5SignedPath - length_KRB5SignedPath - copy_KRB5SignedPath - asn1_oid_id_pkinit - oid_id_pkinit - asn1_oid_id_pkauthdata - oid_id_pkauthdata - asn1_oid_id_pkdhkeydata - oid_id_pkdhkeydata - asn1_oid_id_pkrkeydata - oid_id_pkrkeydata - asn1_oid_id_pkekuoid - oid_id_pkekuoid - asn1_oid_id_pkkdcekuoid - oid_id_pkkdcekuoid - asn1_oid_id_pkinit_san - oid_id_pkinit_san - asn1_oid_id_pkinit_ms_eku - oid_id_pkinit_ms_eku - asn1_oid_id_pkinit_ms_san - oid_id_pkinit_ms_san - asn1_oid_id_pkinit_kdf - oid_id_pkinit_kdf - asn1_oid_id_pkinit_kdf_ah_sha1 - oid_id_pkinit_kdf_ah_sha1 - asn1_oid_id_pkinit_kdf_ah_sha256 - oid_id_pkinit_kdf_ah_sha256 - asn1_oid_id_pkinit_kdf_ah_sha512 - oid_id_pkinit_kdf_ah_sha512 - encode_MS_UPN_SAN - decode_MS_UPN_SAN - free_MS_UPN_SAN - length_MS_UPN_SAN - copy_MS_UPN_SAN - encode_DHNonce - decode_DHNonce - free_DHNonce - length_DHNonce - copy_DHNonce - encode_KDFAlgorithmId - decode_KDFAlgorithmId - free_KDFAlgorithmId - length_KDFAlgorithmId - copy_KDFAlgorithmId - encode_TrustedCA - decode_TrustedCA - free_TrustedCA - length_TrustedCA - copy_TrustedCA - encode_ExternalPrincipalIdentifier - decode_ExternalPrincipalIdentifier - free_ExternalPrincipalIdentifier - length_ExternalPrincipalIdentifier - copy_ExternalPrincipalIdentifier - encode_ExternalPrincipalIdentifiers - decode_ExternalPrincipalIdentifiers - free_ExternalPrincipalIdentifiers - length_ExternalPrincipalIdentifiers - copy_ExternalPrincipalIdentifiers - encode_PA_PK_AS_REQ - decode_PA_PK_AS_REQ - free_PA_PK_AS_REQ - length_PA_PK_AS_REQ - copy_PA_PK_AS_REQ - encode_PKAuthenticator - decode_PKAuthenticator - free_PKAuthenticator - length_PKAuthenticator - copy_PKAuthenticator - encode_AuthPack - decode_AuthPack - free_AuthPack - length_AuthPack - copy_AuthPack - encode_TD_TRUSTED_CERTIFIERS - decode_TD_TRUSTED_CERTIFIERS - free_TD_TRUSTED_CERTIFIERS - length_TD_TRUSTED_CERTIFIERS - copy_TD_TRUSTED_CERTIFIERS - encode_TD_INVALID_CERTIFICATES - decode_TD_INVALID_CERTIFICATES - free_TD_INVALID_CERTIFICATES - length_TD_INVALID_CERTIFICATES - copy_TD_INVALID_CERTIFICATES - encode_KRB5PrincipalName - decode_KRB5PrincipalName - free_KRB5PrincipalName - length_KRB5PrincipalName - copy_KRB5PrincipalName - encode_AD_INITIAL_VERIFIED_CAS - decode_AD_INITIAL_VERIFIED_CAS - free_AD_INITIAL_VERIFIED_CAS - length_AD_INITIAL_VERIFIED_CAS - copy_AD_INITIAL_VERIFIED_CAS - encode_DHRepInfo - decode_DHRepInfo - free_DHRepInfo - length_DHRepInfo - copy_DHRepInfo - encode_PA_PK_AS_REP - decode_PA_PK_AS_REP - free_PA_PK_AS_REP - length_PA_PK_AS_REP - copy_PA_PK_AS_REP - encode_KDCDHKeyInfo - decode_KDCDHKeyInfo - free_KDCDHKeyInfo - length_KDCDHKeyInfo - copy_KDCDHKeyInfo - encode_ReplyKeyPack - decode_ReplyKeyPack - free_ReplyKeyPack - length_ReplyKeyPack - copy_ReplyKeyPack - encode_TD_DH_PARAMETERS - decode_TD_DH_PARAMETERS - free_TD_DH_PARAMETERS - length_TD_DH_PARAMETERS - copy_TD_DH_PARAMETERS - encode_PKAuthenticator_Win2k - decode_PKAuthenticator_Win2k - free_PKAuthenticator_Win2k - length_PKAuthenticator_Win2k - copy_PKAuthenticator_Win2k - encode_AuthPack_Win2k - decode_AuthPack_Win2k - free_AuthPack_Win2k - length_AuthPack_Win2k - copy_AuthPack_Win2k - encode_TrustedCA_Win2k - decode_TrustedCA_Win2k - free_TrustedCA_Win2k - length_TrustedCA_Win2k - copy_TrustedCA_Win2k - encode_PA_PK_AS_REQ_Win2k - decode_PA_PK_AS_REQ_Win2k - free_PA_PK_AS_REQ_Win2k - length_PA_PK_AS_REQ_Win2k - copy_PA_PK_AS_REQ_Win2k - encode_PA_PK_AS_REP_Win2k - decode_PA_PK_AS_REP_Win2k - free_PA_PK_AS_REP_Win2k - length_PA_PK_AS_REP_Win2k - copy_PA_PK_AS_REP_Win2k - encode_PA_PK_AS_REP_BTMM - decode_PA_PK_AS_REP_BTMM - free_PA_PK_AS_REP_BTMM - length_PA_PK_AS_REP_BTMM - copy_PA_PK_AS_REP_BTMM - encode_KDCDHKeyInfo_Win2k - decode_KDCDHKeyInfo_Win2k - free_KDCDHKeyInfo_Win2k - length_KDCDHKeyInfo_Win2k - copy_KDCDHKeyInfo_Win2k - encode_ReplyKeyPack_Win2k - decode_ReplyKeyPack_Win2k - free_ReplyKeyPack_Win2k - length_ReplyKeyPack_Win2k - copy_ReplyKeyPack_Win2k - encode_PkinitSP80056AOtherInfo - decode_PkinitSP80056AOtherInfo - free_PkinitSP80056AOtherInfo - length_PkinitSP80056AOtherInfo - copy_PkinitSP80056AOtherInfo - encode_PkinitSuppPubInfo - decode_PkinitSuppPubInfo - free_PkinitSuppPubInfo - length_PkinitSuppPubInfo - copy_PkinitSuppPubInfo - encode_PKCS8PrivateKeyAlgorithmIdentifier - decode_PKCS8PrivateKeyAlgorithmIdentifier - free_PKCS8PrivateKeyAlgorithmIdentifier - length_PKCS8PrivateKeyAlgorithmIdentifier - copy_PKCS8PrivateKeyAlgorithmIdentifier - encode_PKCS8PrivateKey - decode_PKCS8PrivateKey - free_PKCS8PrivateKey - length_PKCS8PrivateKey - copy_PKCS8PrivateKey - encode_PKCS8PrivateKeyInfo - decode_PKCS8PrivateKeyInfo - free_PKCS8PrivateKeyInfo - length_PKCS8PrivateKeyInfo - copy_PKCS8PrivateKeyInfo - encode_PKCS8Attributes - decode_PKCS8Attributes - free_PKCS8Attributes - length_PKCS8Attributes - copy_PKCS8Attributes - encode_PKCS8EncryptedPrivateKeyInfo - decode_PKCS8EncryptedPrivateKeyInfo - free_PKCS8EncryptedPrivateKeyInfo - length_PKCS8EncryptedPrivateKeyInfo - copy_PKCS8EncryptedPrivateKeyInfo - encode_PKCS8EncryptedData - decode_PKCS8EncryptedData - free_PKCS8EncryptedData - length_PKCS8EncryptedData - copy_PKCS8EncryptedData - asn1_oid_id_pkcs_9 - oid_id_pkcs_9 - asn1_oid_id_pkcs9_contentType - oid_id_pkcs9_contentType - asn1_oid_id_pkcs9_emailAddress - oid_id_pkcs9_emailAddress - asn1_oid_id_pkcs9_messageDigest - oid_id_pkcs9_messageDigest - asn1_oid_id_pkcs9_signingTime - oid_id_pkcs9_signingTime - asn1_oid_id_pkcs9_countersignature - oid_id_pkcs9_countersignature - asn1_oid_id_pkcs_9_at_friendlyName - oid_id_pkcs_9_at_friendlyName - asn1_oid_id_pkcs_9_at_localKeyId - oid_id_pkcs_9_at_localKeyId - asn1_oid_id_pkcs_9_at_certTypes - oid_id_pkcs_9_at_certTypes - asn1_oid_id_pkcs_9_at_certTypes_x509 - oid_id_pkcs_9_at_certTypes_x509 - encode_PKCS9_BMPString - decode_PKCS9_BMPString - free_PKCS9_BMPString - length_PKCS9_BMPString - copy_PKCS9_BMPString - encode_PKCS9_friendlyName - decode_PKCS9_friendlyName - free_PKCS9_friendlyName - length_PKCS9_friendlyName - copy_PKCS9_friendlyName - asn1_oid_id_pkcs_12 - oid_id_pkcs_12 - asn1_oid_id_pkcs_12PbeIds - oid_id_pkcs_12PbeIds - asn1_oid_id_pbeWithSHAAnd128BitRC4 - oid_id_pbeWithSHAAnd128BitRC4 - asn1_oid_id_pbeWithSHAAnd40BitRC4 - oid_id_pbeWithSHAAnd40BitRC4 - asn1_oid_id_pbeWithSHAAnd3_KeyTripleDES_CBC - oid_id_pbeWithSHAAnd3_KeyTripleDES_CBC - asn1_oid_id_pbeWithSHAAnd2_KeyTripleDES_CBC - oid_id_pbeWithSHAAnd2_KeyTripleDES_CBC - asn1_oid_id_pbeWithSHAAnd128BitRC2_CBC - oid_id_pbeWithSHAAnd128BitRC2_CBC - asn1_oid_id_pbewithSHAAnd40BitRC2_CBC - oid_id_pbewithSHAAnd40BitRC2_CBC - asn1_oid_id_pkcs12_bagtypes - oid_id_pkcs12_bagtypes - asn1_oid_id_pkcs12_keyBag - oid_id_pkcs12_keyBag - asn1_oid_id_pkcs12_pkcs8ShroudedKeyBag - oid_id_pkcs12_pkcs8ShroudedKeyBag - asn1_oid_id_pkcs12_certBag - oid_id_pkcs12_certBag - asn1_oid_id_pkcs12_crlBag - oid_id_pkcs12_crlBag - asn1_oid_id_pkcs12_secretBag - oid_id_pkcs12_secretBag - asn1_oid_id_pkcs12_safeContentsBag - oid_id_pkcs12_safeContentsBag - encode_PKCS12_MacData - decode_PKCS12_MacData - free_PKCS12_MacData - length_PKCS12_MacData - copy_PKCS12_MacData - encode_PKCS12_PFX - decode_PKCS12_PFX - free_PKCS12_PFX - length_PKCS12_PFX - copy_PKCS12_PFX - encode_PKCS12_AuthenticatedSafe - decode_PKCS12_AuthenticatedSafe - free_PKCS12_AuthenticatedSafe - length_PKCS12_AuthenticatedSafe - copy_PKCS12_AuthenticatedSafe - encode_PKCS12_CertBag - decode_PKCS12_CertBag - free_PKCS12_CertBag - length_PKCS12_CertBag - copy_PKCS12_CertBag - encode_PKCS12_Attribute - decode_PKCS12_Attribute - free_PKCS12_Attribute - length_PKCS12_Attribute - copy_PKCS12_Attribute - encode_PKCS12_Attributes - decode_PKCS12_Attributes - free_PKCS12_Attributes - length_PKCS12_Attributes - copy_PKCS12_Attributes - encode_PKCS12_SafeBag - decode_PKCS12_SafeBag - free_PKCS12_SafeBag - length_PKCS12_SafeBag - copy_PKCS12_SafeBag - encode_PKCS12_SafeContents - decode_PKCS12_SafeContents - free_PKCS12_SafeContents - length_PKCS12_SafeContents - copy_PKCS12_SafeContents - encode_PKCS12_OctetString - decode_PKCS12_OctetString - free_PKCS12_OctetString - length_PKCS12_OctetString - copy_PKCS12_OctetString - encode_PKCS12_PBEParams - decode_PKCS12_PBEParams - free_PKCS12_PBEParams - length_PKCS12_PBEParams - copy_PKCS12_PBEParams - encode_DigestError - decode_DigestError - free_DigestError - length_DigestError - copy_DigestError - encode_DigestInit - decode_DigestInit - free_DigestInit - length_DigestInit - copy_DigestInit - encode_DigestInitReply - decode_DigestInitReply - free_DigestInitReply - length_DigestInitReply - copy_DigestInitReply - encode_DigestREP - decode_DigestREP - free_DigestREP - length_DigestREP - copy_DigestREP - encode_DigestREQ - decode_DigestREQ - free_DigestREQ - length_DigestREQ - copy_DigestREQ - encode_DigestRepInner - decode_DigestRepInner - free_DigestRepInner - length_DigestRepInner - copy_DigestRepInner - encode_DigestReqInner - decode_DigestReqInner - free_DigestReqInner - length_DigestReqInner - copy_DigestReqInner - encode_DigestRequest - decode_DigestRequest - free_DigestRequest - length_DigestRequest - copy_DigestRequest - encode_DigestResponse - decode_DigestResponse - free_DigestResponse - length_DigestResponse - copy_DigestResponse - encode_DigestTypes - decode_DigestTypes - free_DigestTypes - length_DigestTypes - copy_DigestTypes - DigestTypes2int - int2DigestTypes - asn1_DigestTypes_units - encode_NTLMInit - decode_NTLMInit - free_NTLMInit - length_NTLMInit - copy_NTLMInit - encode_NTLMInitReply - decode_NTLMInitReply - free_NTLMInitReply - length_NTLMInitReply - copy_NTLMInitReply - encode_NTLMRequest - decode_NTLMRequest - free_NTLMRequest - length_NTLMRequest - copy_NTLMRequest - encode_NTLMResponse - decode_NTLMResponse - free_NTLMResponse - length_NTLMResponse - copy_NTLMResponse - encode_Kx509Response - decode_Kx509Response - free_Kx509Response - length_Kx509Response - copy_Kx509Response - encode_Kx509Request - decode_Kx509Request - free_Kx509Request - length_Kx509Request - copy_Kx509Request - initialize_asn1_error_table_r - initialize_asn1_error_table + der_put_octet_string + der_put_oid + der_put_printable_string + der_put_tag + der_put_universal_string + der_put_unsigned + der_put_utctime + der_put_utf8string + der_put_visible_string diff --git a/windows/NTMakefile.w32 b/windows/NTMakefile.w32 index 19e2a6f27..fa57266db 100644 --- a/windows/NTMakefile.w32 +++ b/windows/NTMakefile.w32 @@ -277,6 +277,9 @@ prep:: show-cmds {$(OBJ)}.hx{$(INCDIR)}.h: $(CP) $< $@ +{$(OBJ)}.hx{$(OBJ)}.h: + $(CP) $< $@ + {}.rc{$(OBJ)}.res: $(RC2RES) From 251879f39e70421e498cb8b3d448cd0a138d9f7a Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 25 Nov 2009 12:37:40 -0500 Subject: [PATCH 097/134] Generate krb5-types.h instead of using a static one on Windows --- include/NTMakefile | 15 +++++++++++++-- include/bits.c | 8 +++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/NTMakefile b/include/NTMakefile index cd64a5275..e54b07138 100644 --- a/include/NTMakefile +++ b/include/NTMakefile @@ -43,8 +43,18 @@ INCFILES= \ $(INCDIR)\krb5-types.h \ $(INCDIR)\version.h +!ifdef USE_STATIC_KRB5_TYPES $(INCDIR)\krb5-types.h: krb5-types.h.w32 $(CP) $** $@ +!else +$(INCDIR)\krb5-types.h: $(OBJ)\bits.exe + $(OBJ)\bits.exe $(INCDIR)\krb5-types.h + +$(OBJ)\bits.exe: $(OBJ)\bits.obj + $(EXECONLINK) + $(EXEPREP_NODIST) + +!endif $(INCDIR)\config.h: config.h.w32 ..\windows\NTMakefile.config NTMakefile $(PERL) << < config.h.w32 > $@ @@ -73,9 +83,10 @@ while(<>) { } elsif (m/\@VERSION_OPTDEFS\@/) { if ("$(VER_PRERELEASE)") { print "#define VER_PRERELEASE 1\n"; } - if ("$(VER_PRIVATE)") { print "#define VER_PRIVATE \"$(VER_PRIVATE)\""; } - if ("$(VER_SPECIAL)") { print "#define VER_SPECIAL \"$(VER_SPECIAL)\""; } + if ("$(VER_PRIVATE)") { print "#define VER_PRIVATE \"$(VER_PRIVATE)\"\n"; } + if ("$(VER_SPECIAL)") { print "#define VER_SPECIAL \"$(VER_SPECIAL)\"\n"; } if ("$(BUILD)" =~ "dbg") { print "#define VER_DEBUG 1\n"; } + print "#define HOST \"$(COMPUTERNAME)\"\n"; } else { diff --git a/include/bits.c b/include/bits.c index e0348a504..f2ee2b9fa 100644 --- a/include/bits.c +++ b/include/bits.c @@ -39,6 +39,9 @@ RCSID("$Id$"); #include #include #include +#ifdef WIN32 +#include +#endif #define BITSIZE(TYPE) \ { \ @@ -157,7 +160,11 @@ int main(int argc, char **argv) fprintf(f, "#include \n"); #endif #ifdef HAVE_SOCKLEN_T +#ifndef WIN32 fprintf(f, "#include \n"); +#else + fprintf(f, "#include \n"); +#endif #endif fprintf(f, "\n"); @@ -236,7 +243,6 @@ int main(int argc, char **argv) fprintf(f, "\n"); #if defined(_WIN32) - #include fprintf(f, "typedef SOCKET krb5_socket_t;\n"); #else fprintf(f, "typedef int krb5_socket_t;\n"); From cb9fefd200c51e8ff2cca3c0d95eba2cf094b9fb Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 25 Nov 2009 12:38:10 -0500 Subject: [PATCH 098/134] (lib/asn1) Add asn1-template.h to NTMakefile --- lib/asn1/NTMakefile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/asn1/NTMakefile b/lib/asn1/NTMakefile index 113b0f9b6..7310238aa 100644 --- a/lib/asn1/NTMakefile +++ b/lib/asn1/NTMakefile @@ -696,12 +696,13 @@ $(gen_files_test) $(OBJ)\test_asn1.hx: $(BINDIR)\asn1_compile.exe test.asn1 || ($(RM) $(OBJ)\test_asn1.h ; exit /b 1) cd $(SRCDIR) -INCFILES= \ - $(INCDIR)\der.h \ - $(INCDIR)\heim_asn1.h \ - $(INCDIR)\der-protos.h \ - $(INCDIR)\der-private.h \ - $(INCDIR)\asn1-common.h \ +INCFILES= \ + $(INCDIR)\der.h \ + $(INCDIR)\heim_asn1.h \ + $(INCDIR)\der-protos.h \ + $(INCDIR)\der-private.h \ + $(INCDIR)\asn1-common.h \ + $(INCDIR)\asn1-template.h \ $(OBJ)\asn1_err.h $(INCDIR)\der-protos.h: $(OBJ)\der-protos.h From 4d923e766c6a49095c9e1c52b8cb92db65fc822f Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 25 Nov 2009 12:39:00 -0500 Subject: [PATCH 099/134] (lib/hcrypto) Add missing header files and update exports list --- lib/hcrypto/NTMakefile | 54 ++++++++++++++++-------------- lib/hcrypto/libhcrypto-exports.def | 42 ++++++++++++++++++----- 2 files changed, 63 insertions(+), 33 deletions(-) diff --git a/lib/hcrypto/NTMakefile b/lib/hcrypto/NTMakefile index de9b9ed84..887026f47 100644 --- a/lib/hcrypto/NTMakefile +++ b/lib/hcrypto/NTMakefile @@ -45,15 +45,19 @@ INCFILES= \ $(HCRYPTOINCLUDEDIR)\des.h \ $(HCRYPTOINCLUDEDIR)\dh.h \ $(HCRYPTOINCLUDEDIR)\dsa.h \ + $(HCRYPTOINCLUDEDIR)\ec.h \ + $(HCRYPTOINCLUDEDIR)\ecdh.h \ + $(HCRYPTOINCLUDEDIR)\ecdsa.h \ $(HCRYPTOINCLUDEDIR)\engine.h \ $(HCRYPTOINCLUDEDIR)\evp.h \ + $(HCRYPTOINCLUDEDIR)\evp-hcrypto.h \ + $(HCRYPTOINCLUDEDIR)\evp-cc.h \ $(HCRYPTOINCLUDEDIR)\hmac.h \ $(HCRYPTOINCLUDEDIR)\md2.h \ $(HCRYPTOINCLUDEDIR)\md4.h \ $(HCRYPTOINCLUDEDIR)\md5.h \ $(HCRYPTOINCLUDEDIR)\pkcs12.h \ $(HCRYPTOINCLUDEDIR)\rand.h \ - $(HCRYPTOINCLUDEDIR)\randi.h \ $(HCRYPTOINCLUDEDIR)\rc2.h \ $(HCRYPTOINCLUDEDIR)\rc4.h \ $(HCRYPTOINCLUDEDIR)\rsa.h \ @@ -74,8 +78,8 @@ all:: $(INCFILES) # libhcrypto -libhcrypt_OBJs = \ - $(OBJ)\imath.obj \ +libhcrypto_OBJs = \ + $(OBJ)\imath.obj \ $(OBJ)\iprime.obj \ $(OBJ)\aes.obj \ $(OBJ)\bn.obj \ @@ -87,13 +91,12 @@ libhcrypt_OBJs = \ $(OBJ)\dsa.obj \ $(OBJ)\evp.obj \ $(OBJ)\evp-hcrypto.obj \ - $(OBJ)\evp-aes-cts.obj \ $(OBJ)\engine.obj \ $(OBJ)\hmac.obj \ $(OBJ)\md2.obj \ $(OBJ)\md4.obj \ $(OBJ)\md5.obj \ - $(OBJ)\pkcs5.obj \ + $(OBJ)\pkcs5.obj \ $(OBJ)\pkcs12.obj \ $(OBJ)\rand-fortuna.obj \ $(OBJ)\rand-timer.obj \ @@ -113,13 +116,13 @@ libhcrypt_OBJs = \ $(LIBHCRYPTO): $(BINDIR)\libhcrypto.dll -$(BINDIR)\libhcrypto.dll: $(libhcrypt_OBJs) $(LIBROKEN) $(LIBASN1) +$(BINDIR)\libhcrypto.dll: $(libhcrypto_OBJs) $(LIBROKEN) $(LIBASN1) $(DLLGUILINK) -def:libhcrypto-exports.def -implib:$(LIBHCRYPTO) $(DLLPREP) !else -$(LIBHCRYPTO): $(libhcrypt_OBJs) +$(LIBHCRYPTO): $(libhcrypto_OBJs) $(LIBCON) !endif @@ -136,27 +139,28 @@ clean:: TESTLIB=$(OBJ)\libhctest.lib -$(TESTLIB): \ - $(OBJ)\imath.obj \ - $(OBJ)\des.obj \ +$(TESTLIB): \ + $(OBJ)\imath.obj \ + $(OBJ)\des.obj \ $(OBJ)\ui.obj $(LIBCON) -test-binaries: \ - $(OBJ)\destest.exe \ - $(OBJ)\mdtest.exe \ - $(OBJ)\rc2test.exe \ - $(OBJ)\rctest.exe \ - $(OBJ)\test_bn.exe \ - $(OBJ)\test_cipher.exe \ - $(OBJ)\test_engine_dso.exe \ - $(OBJ)\test_hmac.exe \ - $(OBJ)\test_imath.exe \ - $(OBJ)\test_pkcs5.exe \ - $(OBJ)\test_pkcs12.exe \ - $(OBJ)\test_rsa.exe \ - $(OBJ)\test_dh.exe \ - $(OBJ)\test_rand.exe \ +test-binaries: \ + $(OBJ)\destest.exe \ + $(OBJ)\example_evp_cipher.exe \ + $(OBJ)\mdtest.exe \ + $(OBJ)\rc2test.exe \ + $(OBJ)\rctest.exe \ + $(OBJ)\test_bn.exe \ + $(OBJ)\test_cipher.exe \ + $(OBJ)\test_engine_dso.exe \ + $(OBJ)\test_hmac.exe \ + $(OBJ)\test_imath.exe \ + $(OBJ)\test_pkcs5.exe \ + $(OBJ)\test_pkcs12.exe \ + $(OBJ)\test_rsa.exe \ + $(OBJ)\test_dh.exe \ + $(OBJ)\test_rand.exe \ $(OBJ)\test_crypto.sh $(OBJ)\destest.exe: $(OBJ)\destest.obj $(TESTLIB) $(LIBROKEN) diff --git a/lib/hcrypto/libhcrypto-exports.def b/lib/hcrypto/libhcrypto-exports.def index 1e32eace1..057b22ded 100644 --- a/lib/hcrypto/libhcrypto-exports.def +++ b/lib/hcrypto/libhcrypto-exports.def @@ -138,14 +138,6 @@ EXPORTS hc_EVP_aes_128_cbc hc_EVP_aes_192_cbc hc_EVP_aes_256_cbc - hc_EVP_hcrypto_aes_128_cbc - hc_EVP_hcrypto_aes_192_cbc - hc_EVP_hcrypto_aes_256_cbc - hc_EVP_hcrypto_aes_128_cts - hc_EVP_hcrypto_aes_256_cts -; hc_EVP_hcrypto_aes_cts_128_cbc -; hc_EVP_hcrypto_aes_cts_192_cbc -; hc_EVP_hcrypto_aes_cts_256_cbc hc_EVP_des_cbc hc_EVP_des_ede3_cbc hc_EVP_camellia_128_cbc @@ -165,6 +157,33 @@ EXPORTS hc_EVP_sha hc_EVP_sha1 hc_EVP_sha256 + +; hc_EVP_cc_md2 +; hc_EVP_cc_md4 +; hc_EVP_cc_md5 +; hc_EVP_cc_sha1 +; hc_EVP_cc_sha256 +; hc_EVP_cc_des_ede3_cbc +; hc_EVP_cc_aes_128_cbc +; hc_EVP_cc_aes_192_cbc +; hc_EVP_cc_aes_256_cbc + + hc_EVP_hcrypto_md2 + hc_EVP_hcrypto_md4 + hc_EVP_hcrypto_md5 + hc_EVP_hcrypto_sha1 + hc_EVP_hcrypto_sha256 + hc_EVP_hcrypto_des_ede3_cbc + hc_EVP_hcrypto_aes_128_cbc + hc_EVP_hcrypto_aes_192_cbc + hc_EVP_hcrypto_aes_256_cbc + hc_EVP_hcrypto_rc4 + hc_EVP_hcrypto_rc4_40 + +; hc_EVP_hcrypto_aes_128_cts +; hc_EVP_hcrypto_aes_192_cts +; hc_EVP_hcrypto_aes_256_cts + hc_HMAC hc_HMAC_CTX_cleanup hc_HMAC_CTX_init @@ -242,5 +261,12 @@ EXPORTS hc_d2i_RSAPrivateKey hc_i2d_RSAPrivateKey hc_i2d_RSAPublicKey + hc_d2i_RSAPublicKey hc_EVP_CIPHER_CTX_ctrl hc_EVP_CIPHER_CTX_rand_key + hc_EVP_CIPHER_CTX_set_key_length + hc_EVP_hcrypto_rc2_40_cbc + hc_EVP_hcrypto_camellia_128_cbc + hc_EVP_CipherUpdate + hc_EVP_CipherFinal_ex + From a3727d212635a5bdb419be4470634b139a7cf7c8 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 25 Nov 2009 12:39:42 -0500 Subject: [PATCH 100/134] (lib/hx509) Add missing header files and update exports --- lib/hx509/NTMakefile | 8 +++++--- lib/hx509/libhx509-exports.def | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/hx509/NTMakefile b/lib/hx509/NTMakefile index bed0dacc8..0a36acc50 100644 --- a/lib/hx509/NTMakefile +++ b/lib/hx509/NTMakefile @@ -191,7 +191,10 @@ INCFILES= \ $(INCDIR)\hx509_err.h \ $(INCDIR)\ocsp_asn1.h \ $(INCDIR)\pkcs10_asn1.h \ - $(INCDIR)\crmf_asn1.h + $(INCDIR)\crmf_asn1.h \ + $(OBJ)\ocsp_asn1-priv.h \ + $(OBJ)\pkcs10_asn1-priv.h \ + $(OBJ)\crmf_asn1-priv.h hxtool.c: $(OBJ)\hxtool-commands.h @@ -203,7 +206,7 @@ $(OBJ)\hxtool-commands.c $(OBJ)\hxtool-commands.h: hxtool-commands.in $(SLC) $(SLC) hxtool-commands.in cd $(SRCDIR) -$(BINDIR)\hxtool.exe: $(OBJ)\hxtool.obj $(OBJ)\hxtool-commands.obj $(LIBHX509) +$(BINDIR)\hxtool.exe: $(OBJ)\hxtool.obj $(OBJ)\hxtool-commands.obj $(LIBHX509) $(EXECONLINK) $(LIBASN1) $(LIBHCRYPTO) $(LIBROKEN) $(LIBSL) $(LIBVERS) $(LIBWIND) $(LIBCOMERR) $(_VC_MANIFEST_EMBED_EXE) $(_VC_MANIFEST_CLEAN) @@ -240,4 +243,3 @@ all:: $(INCFILES) $(LIBHX509) $(BINDIR)\hxtool.exe clean:: -$(RM) $(BINDIR)\hxtool.exe - diff --git a/lib/hx509/libhx509-exports.def b/lib/hx509/libhx509-exports.def index 6f32e492c..868bac724 100644 --- a/lib/hx509/libhx509-exports.def +++ b/lib/hx509/libhx509-exports.def @@ -81,12 +81,14 @@ EXPORTS hx509_certs_add hx509_certs_append hx509_certs_end_seq + hx509_certs_ref hx509_certs_filter hx509_certs_find hx509_certs_free hx509_certs_info hx509_certs_init - hx509_certs_iter +; hx509_certs_iter + hx509_certs_iter_f hx509_certs_merge hx509_certs_next_cert hx509_certs_start_seq @@ -176,6 +178,7 @@ EXPORTS hx509_pem_read hx509_pem_write hx509_print_stdout + hx509_print_cert hx509_prompt_hidden hx509_query_alloc hx509_query_free From 798d78e098f3abf7db52b0a32d84b61ac72a8529 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 25 Nov 2009 12:40:11 -0500 Subject: [PATCH 101/134] (lib/krb5/auth_context.c) Fix declaration --- lib/krb5/auth_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/krb5/auth_context.c b/lib/krb5/auth_context.c index db1833b4b..0f1d51e21 100644 --- a/lib/krb5/auth_context.c +++ b/lib/krb5/auth_context.c @@ -425,7 +425,7 @@ krb5_auth_con_setlocalseqnumber (krb5_context context, return 0; } -KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_FUNCTION +KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL krb5_auth_con_getremoteseqnumber(krb5_context context, krb5_auth_context auth_context, int32_t *seqnumber) From 72848585cda8e0d774f0187b5f82a7e9f9174863 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 25 Nov 2009 12:40:50 -0500 Subject: [PATCH 102/134] KRB5_DEPRECATED needs to be prefixed to the declaration on Windows --- lib/krb5/deprecated.c | 9 ++++++--- lib/krb5/error_string.c | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/krb5/deprecated.c b/lib/krb5/deprecated.c index ce755cdb8..93e7b53b6 100644 --- a/lib/krb5/deprecated.c +++ b/lib/krb5/deprecated.c @@ -631,8 +631,9 @@ krb5_get_cred_from_kdc(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED void KRB5_LIB_FUNCTION -krb5_free_unparsed_name(krb5_context context, char *str) KRB5_DEPRECATED +krb5_free_unparsed_name(krb5_context context, char *str) { krb5_xfree(str); } @@ -643,10 +644,11 @@ krb5_free_unparsed_name(krb5_context context, char *str) KRB5_DEPRECATED * @ingroup krb5_deprecated */ +KRB5_DEPRECATED krb5_error_code KRB5_LIB_FUNCTION krb5_generate_subkey(krb5_context context, const krb5_keyblock *key, - krb5_keyblock **subkey) KRB5_DEPRECATED + krb5_keyblock **subkey) { return krb5_generate_subkey_extended(context, key, ETYPE_NULL, subkey); } @@ -657,10 +659,11 @@ krb5_generate_subkey(krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED krb5_error_code KRB5_LIB_FUNCTION krb5_auth_getremoteseqnumber(krb5_context context, krb5_auth_context auth_context, - int32_t *seqnumber) KRB5_DEPRECATED + int32_t *seqnumber) { *seqnumber = auth_context->remote_seqnumber; return 0; diff --git a/lib/krb5/error_string.c b/lib/krb5/error_string.c index 076b7781d..adab6f5e8 100644 --- a/lib/krb5/error_string.c +++ b/lib/krb5/error_string.c @@ -279,8 +279,9 @@ krb5_free_error_message(krb5_context context, const char *msg) * @ingroup krb5 */ +KRB5_DEPRECATED KRB5_LIB_FUNCTION const char* KRB5_LIB_CALL -krb5_get_err_text(krb5_context context, krb5_error_code code) KRB5_DEPRECATED +krb5_get_err_text(krb5_context context, krb5_error_code code) { const char *p = NULL; if(context != NULL) From faa7dd7234b9e45864419f015c7482bd95160a92 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 25 Nov 2009 12:41:23 -0500 Subject: [PATCH 103/134] (lib/roken) Add ct.c to libroken on Windows --- lib/roken/NTMakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile index 05f01382e..0e0f4ccfc 100644 --- a/lib/roken/NTMakefile +++ b/lib/roken/NTMakefile @@ -38,6 +38,7 @@ libroken_la_OBJS = \ $(OBJ)\bswap.obj \ $(OBJ)\concat.obj \ $(OBJ)\cloexec.obj \ + $(OBJ)\ct.obj \ $(OBJ)\dirent.obj \ $(OBJ)\dlfcn_w32.obj \ $(OBJ)\dumpdata.obj \ From b397a69ca72722bf1c70f1501debf4b9bd96a7c9 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:26:41 -0500 Subject: [PATCH 104/134] Remove krb5-types.h.w32 We are generating krb5-types.h using bits.c. --- include/NTMakefile | 9 ++---- include/krb5-types.h.w32 | 61 ---------------------------------------- 2 files changed, 2 insertions(+), 68 deletions(-) delete mode 100644 include/krb5-types.h.w32 diff --git a/include/NTMakefile b/include/NTMakefile index e54b07138..01b805a8c 100644 --- a/include/NTMakefile +++ b/include/NTMakefile @@ -43,10 +43,6 @@ INCFILES= \ $(INCDIR)\krb5-types.h \ $(INCDIR)\version.h -!ifdef USE_STATIC_KRB5_TYPES -$(INCDIR)\krb5-types.h: krb5-types.h.w32 - $(CP) $** $@ -!else $(INCDIR)\krb5-types.h: $(OBJ)\bits.exe $(OBJ)\bits.exe $(INCDIR)\krb5-types.h @@ -54,8 +50,6 @@ $(OBJ)\bits.exe: $(OBJ)\bits.obj $(EXECONLINK) $(EXEPREP_NODIST) -!endif - $(INCDIR)\config.h: config.h.w32 ..\windows\NTMakefile.config NTMakefile $(PERL) << < config.h.w32 > $@ @@ -78,7 +72,8 @@ while(<>) { if ("$(HAVE_PTHREAD_H)") { print "#define HAVE_PTHREAD_H 1\n"; } if ("$(ENV_HACK)") { print "#define ENV_HACK 1\n"; } if ("$(HAVE_KCM)") { print "#define HAVE_KCM 1\n"; } - if ("$(DIR_hdbdir)") { print "#define HDB_DB_DIR \"$(DIR_hdbdir)\"\n"; } + if ("$(HAVE_SCC)") { print "#define HAVE_SCC 1\n"; } + if ("$(DIR_hdbdir)") { print "#define HDB_DB_DIR \"".'$(DIR_hdbdir)'."\"\n"; } } elsif (m/\@VERSION_OPTDEFS\@/) { diff --git a/include/krb5-types.h.w32 b/include/krb5-types.h.w32 deleted file mode 100644 index 4506983a0..000000000 --- a/include/krb5-types.h.w32 +++ /dev/null @@ -1,61 +0,0 @@ -/*********************************************************************** - * Copyright (c) 2009, Secure Endpoints Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - 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. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 - * COPYRIGHT HOLDER 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. - * - **********************************************************************/ - -#ifndef __krb5_types_h__ -#define __krb5_types_h__ - -#ifndef __BIT_TYPES_DEFINED__ -#define __BIT_TYPES_DEFINED__ - -typedef __int8 int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -typedef uint8_t u_int8_t; -typedef uint16_t u_int16_t; -typedef uint32_t u_int32_t; -typedef uint64_t u_int64_t; - -#endif /* __BIT_TYPES_DEFINED__ */ - -typedef int krb5_socklen_t; - -#ifdef _WIN64 -typedef __int64 krb5_ssize_t; -#else -typedef int krb5_ssize_t; -#endif - -#endif /* __krb5_types_h__ */ From a3a72a77e2b1f672857659aa7e5ecb38f506076e Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:28:35 -0500 Subject: [PATCH 105/134] Fix typo in configure.ac --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 5bca7c6c0..33631f4cc 100644 --- a/configure.ac +++ b/configure.ac @@ -167,7 +167,7 @@ AM_CONDITIONAL(SQLITE3, test "X$with_sqlite3" = Xyes) AC_ARG_ENABLE(sqlite-cache, AS_HELP_STRING([--disable-sqlite-cache],[if you want support for cache in sqlite])) if test "$enable_sqlite_cache" != no; then - AC_DEFINE(HAVE_SCC, 1, [Define if you want support for DCE/DFS PAG's.]) + AC_DEFINE(HAVE_SCC, 1, [Define if you want support for cache in sqlite.]) fi AM_CONDITIONAL(have_scc, test "$enable_sqlite_cache" != no) From 8f6d724979277f827e2a8492d8878b847a3c7bc4 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:37:11 -0500 Subject: [PATCH 106/134] (lib/com_err) Add missing exports --- lib/com_err/libcom_err-exports.def | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/com_err/libcom_err-exports.def b/lib/com_err/libcom_err-exports.def index 974ec2ae3..a4db1940a 100644 --- a/lib/com_err/libcom_err-exports.def +++ b/lib/com_err/libcom_err-exports.def @@ -1,5 +1,6 @@ EXPORTS com_right + com_right_r free_error_table initialize_error_table_r add_to_error_table @@ -10,3 +11,4 @@ EXPORTS init_error_table reset_com_err_hook set_com_err_hook + _et_list DATA From e3882ffc62951ded3d1739171992c9e715e822bf Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:38:43 -0500 Subject: [PATCH 107/134] (lib/hcrypto) Make w32crypto the default and only RAND method on Windows --- lib/hcrypto/NTMakefile | 6 +++--- lib/hcrypto/libhcrypto-exports.def | 3 ++- lib/hcrypto/rand.h | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/hcrypto/NTMakefile b/lib/hcrypto/NTMakefile index 887026f47..7f1a6fc72 100644 --- a/lib/hcrypto/NTMakefile +++ b/lib/hcrypto/NTMakefile @@ -31,7 +31,7 @@ RELDIR=lib\hcrypto -AUXCFLAGS=$(AUXCFLAGS) -DKRB5 -I$(INCDIR)\hcrypto +AUXCFLAGS=$(AUXCFLAGS) -DKRB5 -I$(HCRYPTOINCLUDEDIR) !include ../../windows/NTMakefile.w32 @@ -58,6 +58,7 @@ INCFILES= \ $(HCRYPTOINCLUDEDIR)\md5.h \ $(HCRYPTOINCLUDEDIR)\pkcs12.h \ $(HCRYPTOINCLUDEDIR)\rand.h \ + $(HCRYPTOINCLUDEDIR)\randi.h \ $(HCRYPTOINCLUDEDIR)\rc2.h \ $(HCRYPTOINCLUDEDIR)\rc4.h \ $(HCRYPTOINCLUDEDIR)\rsa.h \ @@ -98,8 +99,7 @@ libhcrypto_OBJs = \ $(OBJ)\md5.obj \ $(OBJ)\pkcs5.obj \ $(OBJ)\pkcs12.obj \ - $(OBJ)\rand-fortuna.obj \ - $(OBJ)\rand-timer.obj \ + $(OBJ)\rand-w32.obj \ $(OBJ)\rand.obj \ $(OBJ)\rc2.obj \ $(OBJ)\rc4.obj \ diff --git a/lib/hcrypto/libhcrypto-exports.def b/lib/hcrypto/libhcrypto-exports.def index 057b22ded..18efbca30 100644 --- a/lib/hcrypto/libhcrypto-exports.def +++ b/lib/hcrypto/libhcrypto-exports.def @@ -212,7 +212,7 @@ EXPORTS ; hc_RAND_egd_bytes ; hc_RAND_egd_method hc_RAND_file_name - hc_RAND_fortuna_method +; hc_RAND_fortuna_method hc_RAND_get_rand_method hc_RAND_load_file hc_RAND_pseudo_bytes @@ -222,6 +222,7 @@ EXPORTS hc_RAND_status ; hc_RAND_unix_method ; hc_RAND_timer_method + hc_RAND_w32crypto_method hc_RAND_write_file hc_RC2_cbc_encrypt hc_RC2_decryptc diff --git a/lib/hcrypto/rand.h b/lib/hcrypto/rand.h index 65800d6b9..f4e248516 100644 --- a/lib/hcrypto/rand.h +++ b/lib/hcrypto/rand.h @@ -62,6 +62,7 @@ typedef struct RAND_METHOD RAND_METHOD; #define RAND_fortuna_method hc_RAND_fortuna_method #define RAND_egd_method hc_RAND_egd_method #define RAND_unix_method hc_RAND_unix_method +#define RAND_w32crypto_method hc_RAND_w32crypto_method /* * From 49d28d3f3aed6c35b9b6eefe2884f83180be7a64 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:39:42 -0500 Subject: [PATCH 108/134] Thread safety for rand-w32 --- lib/hcrypto/rand-w32.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/lib/hcrypto/rand-w32.c b/lib/hcrypto/rand-w32.c index d3f7cf6f5..bc9d24f58 100644 --- a/lib/hcrypto/rand-w32.c +++ b/lib/hcrypto/rand-w32.c @@ -32,8 +32,8 @@ */ #include +#include -#include #include #include @@ -41,27 +41,37 @@ #include #include -#include - #include "randi.h" -static HCRYPTPROV cryptprovider = 0; +volatile static HCRYPTPROV g_cryptprovider = 0; static HCRYPTPROV _hc_CryptProvider(void) { BOOL res; + HCRYPTPROV cryptprovider = 0; + + if (g_cryptprovider != 0) + return g_cryptprovider; - if (cryptprovider != 0) - return cryptprovider; - res = CryptAcquireContext(&cryptprovider, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0); - if(!res) - CryptAcquireContext(&cryptprovider, NULL, - MS_ENHANCED_PROV, PROV_RSA_FULL, - CRYPT_NEWKEYSET); + + if (GetLastError() == NTE_BAD_KEYSET) { + if(!res) + res = CryptAcquireContext(&cryptprovider, NULL, + MS_ENHANCED_PROV, PROV_RSA_FULL, + CRYPT_NEWKEYSET); + } + + if (res && + InterlockedCompareExchange(&g_cryptprovider, cryptprovider, 0) != 0) { + + CryptReleaseContext(cryptprovider, 0); + cryptprovider = g_cryptprovider; + } + return cryptprovider; } @@ -79,7 +89,7 @@ w32crypto_seed(const void *indata, int size) static int w32crypto_bytes(unsigned char *outdata, int size) { - if (CryptGenRandom(_hc_CryptProvider(), size, outdata) == 0) + if (CryptGenRandom(_hc_CryptProvider(), size, outdata)) return 0; return 1; } @@ -97,12 +107,13 @@ w32crypto_add(const void *indata, int size, double entropi) static int w32crypto_pseudorand(unsigned char *outdata, int size) { + return 1; } static int w32crypto_status(void) { - if (_hc_CryptProvider() == NULL) + if (_hc_CryptProvider() == 0) return 0; return 1; } From 67c3295fcb29ff2fec989ae2dbcda1d65d19e8ae Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:41:57 -0500 Subject: [PATCH 109/134] KRB5_DEPRECATED should be prefixed to the declaration --- lib/krb5/config_file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/krb5/config_file.c b/lib/krb5/config_file.c index c185195c2..4eb4e12fa 100644 --- a/lib/krb5/config_file.c +++ b/lib/krb5/config_file.c @@ -1249,10 +1249,11 @@ krb5_config_get_int (krb5_context context, * @ingroup krb5_deprecated */ +KRB5_DEPRECATED krb5_error_code KRB5_LIB_FUNCTION krb5_config_parse_string_multi(krb5_context context, const char *string, - krb5_config_section **res) KRB5_DEPRECATED + krb5_config_section **res) { const char *str; unsigned lineno = 0; From 393a59785899f71a438db5311136a4ffa55d688f Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:42:57 -0500 Subject: [PATCH 110/134] SOCK_INIT/SOCK_EXIT -> rk_SOCK_INIT/rk_SOCK_EXIT and net_write_s() -> net_write() --- lib/krb5/context.c | 4 ++-- lib/krb5/send_to_kdc.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/krb5/context.c b/lib/krb5/context.c index d3dcb3064..3cc02f561 100644 --- a/lib/krb5/context.c +++ b/lib/krb5/context.c @@ -363,7 +363,7 @@ krb5_init_context(krb5_context *context) if (ret) goto out; #endif - if (SOCK_INIT()) + if (rk_SOCK_INIT()) p->flags |= KRB5_CTX_F_SOCKETS_INITIALIZED; out: @@ -534,7 +534,7 @@ krb5_free_context(krb5_context context) HEIMDAL_MUTEX_destroy(context->mutex); free(context->mutex); if (context->flags & KRB5_CTX_F_SOCKETS_INITIALIZED) { - SOCK_EXIT(); + rk_SOCK_EXIT(); } memset(context, 0, sizeof(*context)); diff --git a/lib/krb5/send_to_kdc.c b/lib/krb5/send_to_kdc.c index c539babb8..83f27ac36 100644 --- a/lib/krb5/send_to_kdc.c +++ b/lib/krb5/send_to_kdc.c @@ -80,7 +80,7 @@ recv_loop (krb5_socket_t fd, } else { void *tmp; - if (SOCK_IOCTL (fd, FIONREAD, &nbytes) < 0) { + if (rk_SOCK_IOCTL (fd, FIONREAD, &nbytes) < 0) { krb5_data_free (rep); return -1; } @@ -142,9 +142,9 @@ send_and_recv_tcp(krb5_socket_t fd, krb5_data len_data; _krb5_put_int(len, req->length, 4); - if(net_write_s(fd, len, sizeof(len)) < 0) + if(net_write(fd, len, sizeof(len)) < 0) return -1; - if(net_write_s(fd, req->data, req->length) < 0) + if(net_write(fd, req->data, req->length) < 0) return -1; if (recv_loop (fd, tmout, 0, 4, &len_data) < 0) return -1; @@ -194,7 +194,7 @@ send_and_recv_http(krb5_socket_t fd, free(str); if (request == NULL) return -1; - ret = net_write_s (fd, request, strlen(request)); + ret = net_write (fd, request, strlen(request)); free (request); if (ret < 0) return ret; From f065ca176f1c2a3416962e3e915c772bdfe90972 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:55:48 -0500 Subject: [PATCH 111/134] (lib/krb5) Update exports list --- lib/krb5/libkrb5-exports.def.in | 90 ++++++++++++++++++--------------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/lib/krb5/libkrb5-exports.def.in b/lib/krb5/libkrb5-exports.def.in index d6056e2db..20d27f2d6 100644 --- a/lib/krb5/libkrb5-exports.def.in +++ b/lib/krb5/libkrb5-exports.def.in @@ -57,7 +57,6 @@ EXPORTS krb5_auth_con_setuserkey krb5_auth_getremoteseqnumber krb5_build_ap_req - krb5_build_authenticator krb5_build_principal krb5_build_principal_ext krb5_build_principal_va @@ -96,6 +95,7 @@ EXPORTS krb5_cc_get_config krb5_cc_get_friendly_name krb5_cc_get_full_name + krb5_cc_get_kdc_offset krb5_cc_get_lifetime krb5_cc_get_name krb5_cc_get_ops @@ -115,8 +115,10 @@ EXPORTS krb5_cc_set_config krb5_cc_set_default_name krb5_cc_set_flags + krb5_cc_set_kdc_offset krb5_cc_start_seq_get krb5_cc_store_cred + krb5_cc_support_switch krb5_cc_switch krb5_cc_set_friendly_name krb5_change_password @@ -135,13 +137,11 @@ EXPORTS krb5_compare_creds krb5_config_file_free krb5_config_free_strings - krb5_config_get krb5_config_get_bool krb5_config_get_bool_default krb5_config_get_int krb5_config_get_int_default krb5_config_get_list - krb5_config_get_next krb5_config_get_string krb5_config_get_string_default krb5_config_get_strings @@ -150,13 +150,11 @@ EXPORTS krb5_config_parse_file krb5_config_parse_file_multi krb5_config_parse_string_multi - krb5_config_vget krb5_config_vget_bool krb5_config_vget_bool_default krb5_config_vget_int krb5_config_vget_int_default krb5_config_vget_list - krb5_config_vget_next krb5_config_vget_string krb5_config_vget_string_default krb5_config_vget_strings @@ -176,6 +174,7 @@ EXPORTS krb5_create_checksum krb5_create_checksum_iov krb5_crypto_destroy + krb5_crypto_fx_cf2 krb5_crypto_get_checksum_type krb5_crypto_getblocksize krb5_crypto_getconfoundersize @@ -293,6 +292,7 @@ EXPORTS krb5_free_principal krb5_free_salt krb5_free_ticket + krb5_free_unparsed_name krb5_fwd_tgt_creds krb5_generate_random_block krb5_generate_random_keyblock @@ -328,6 +328,7 @@ EXPORTS krb5_get_host_realm krb5_get_ignore_addresses krb5_get_in_cred + krb5_cccol_last_change_time krb5_get_in_tkt krb5_get_in_tkt_with_keytab krb5_get_in_tkt_with_password @@ -380,8 +381,8 @@ EXPORTS krb5_init_ets krb5_init_etype krb5_initlog - krb5_is_thread_safe krb5_is_config_principal + krb5_is_thread_safe krb5_kerberos_enctypes krb5_keyblock_get_enctype krb5_keyblock_init @@ -403,10 +404,10 @@ EXPORTS krb5_kt_close krb5_kt_compare krb5_kt_copy_entry_contents - krb5_kt_destroy krb5_kt_default krb5_kt_default_modify_name krb5_kt_default_name + krb5_kt_destroy krb5_kt_end_seq_get krb5_kt_free_entry krb5_kt_get_entry @@ -471,6 +472,7 @@ EXPORTS krb5_plugin_register krb5_prepend_config_files krb5_prepend_config_files_default + krb5_prepend_error_message krb5_princ_realm krb5_princ_set_realm krb5_principal_compare @@ -554,15 +556,15 @@ EXPORTS krb5_sendto_ctx_set_type krb5_sendto_kdc krb5_sendto_kdc_flags - krb5_set_home_dir_access krb5_set_config_files krb5_set_default_in_tkt_etypes krb5_set_default_realm krb5_set_dns_canonicalize_hostname - krb5_set_error_string krb5_set_error_message + krb5_set_error_string krb5_set_extra_addresses krb5_set_fcache_version + krb5_set_home_dir_access krb5_set_ignore_addresses krb5_set_kdc_sec_offset krb5_set_max_time_skew @@ -662,8 +664,9 @@ EXPORTS krb5_verrx krb5_vlog krb5_vlog_msg - krb5_vset_error_string + krb5_vprepend_error_message krb5_vset_error_message + krb5_vset_error_string krb5_vwarn krb5_vwarnx krb5_warn @@ -672,12 +675,11 @@ EXPORTS krb5_write_priv_message krb5_write_safe_message krb5_xfree - krb5_cccol_last_change_time krb5_cccol_cursor_new krb5_cccol_cursor_next krb5_cccol_cursor_free - ; com_err error tables +; com_err error tables initialize_krb5_error_table_r initialize_krb5_error_table initialize_krb_error_table_r @@ -687,36 +689,38 @@ EXPORTS initialize_k524_error_table_r initialize_k524_error_table - ; variables - krb5_mcc_ops DATA - krb5_acc_ops DATA - krb5_fcc_ops DATA - krb5_scc_ops DATA +; variables + krb5_mcc_ops DATA + krb5_acc_ops DATA + krb5_fcc_ops DATA +#ifdef HAVE_SCC + krb5_scc_ops DATA +#endif #ifdef HAVE_KCM - krb5_kcm_ops DATA + krb5_kcm_ops DATA #endif -#ifdef KRB4 -; krb4_fkt_ops DATA -#endif - krb5_wrfkt_ops DATA - krb5_mkt_ops DATA - krb5_akf_ops DATA - krb5_any_ops DATA - __heimdal_version DATA - __heimdal_long_version DATA - krb5_config_file DATA - krb5_defkeyname DATA - krb5_cc_type_api DATA - krb5_cc_type_file DATA - krb5_cc_type_memory DATA - krb5_cc_type_kcm DATA - krb5_cc_type_scc DATA +; krb4_fkt_ops DATA + krb5_wrfkt_ops DATA + krb5_mkt_ops DATA + krb5_akf_ops DATA + krb5_any_ops DATA + __heimdal_version DATA + __heimdal_long_version DATA + krb5_config_file DATA + krb5_defkeyname DATA + krb5_cc_type_api DATA + krb5_cc_type_file DATA + krb5_cc_type_memory DATA + krb5_cc_type_kcm DATA + krb5_cc_type_scc DATA - ; Shared with GSSAPI krb5 - _krb5_crc_init_table; - _krb5_crc_update; +; Shared with GSSAPI krb5 + _krb5_crc_init_table + _krb5_crc_update + _krb5_get_krbtgt + _krb5_build_authenticator - ; V4 compat glue +; V4 compat glue _krb5_krb_tf_setup _krb5_krb_dest_tkt _krb5_krb_life_to_time @@ -730,14 +734,13 @@ EXPORTS _krb5_krb_time_to_life _krb5_krb_cr_err_reply - ; Shared with libkdc +; Shared with libkdc _krb5_AES_string_to_default_iterator _krb5_dh_group_ok _krb5_get_host_realm_int _krb5_get_int _krb5_pac_sign _krb5_parse_moduli - _krb5_pk_enterprise_cert _krb5_pk_kdf _krb5_pk_load_id _krb5_pk_mk_ContentInfo @@ -750,9 +753,12 @@ EXPORTS _krb5_principalname2krb5_principal _krb5_put_int _krb5_s4u2self_to_checksumdata - _krb5_expand_path_tokens - ; testing +; kinit helper + _krb5_get_init_creds_opt_set_pkinit_user_certs + _krb5_pk_enterprise_cert + +; testing ; _krb5_aes_cts_encrypt _krb5_n_fold _krb5_expand_default_cc_name From eb3dc6fabd575ba101be3bb45d2e026842cca19d Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:56:50 -0500 Subject: [PATCH 112/134] (lib/roken) Use strerror_s() to emulate strerror_r() on Windows --- lib/roken/strerror_r.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/roken/strerror_r.c b/lib/roken/strerror_r.c index 60bf108d0..d3ef7d6be 100644 --- a/lib/roken/strerror_r.c +++ b/lib/roken/strerror_r.c @@ -37,6 +37,22 @@ #include #include +#ifdef _MSC_VER + +char * ROKEN_LIB_FUNCTION +strerror_r(int eno, char * strerrbuf, size_t buflen) +{ + errno_t err; + + err = strerror_s(strerrbuf, buflen, eno); + if (err != 0) + sprintf_s(strerrbuf, buflen, "Error % occurred.", eno); + + return strerrbuf; +} + +#else + extern int sys_nerr; extern char *sys_errlist[]; @@ -53,3 +69,5 @@ strerror_r(int eno, char *strerrbuf, size_t buflen) return ERANGE; return 0; } + +#endif From 405b7f530a5752a5adb3dbb63073c2b363ac7cd3 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:57:11 -0500 Subject: [PATCH 113/134] (lib/roken) fk_flock() -> rk_flock() --- lib/roken/flock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/roken/flock.c b/lib/roken/flock.c index 525ad8a83..068d09929 100644 --- a/lib/roken/flock.c +++ b/lib/roken/flock.c @@ -41,7 +41,7 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL -fk_flock(int fd, int operation) +rk_flock(int fd, int operation) { #if defined(HAVE_FCNTL) && defined(F_SETLK) struct flock arg; From 62454211c0099ec98cf1391b077e1c84bd96aa88 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:58:21 -0500 Subject: [PATCH 114/134] (lib/roken) Add strerror_r() along with some missing symbols --- lib/roken/NTMakefile | 1 + lib/roken/roken.h.in | 12 ++++++++++-- lib/roken/sendmsg.c | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile index 0e0f4ccfc..2ae2aa0f8 100644 --- a/lib/roken/NTMakefile +++ b/lib/roken/NTMakefile @@ -89,6 +89,7 @@ libroken_la_OBJS = \ $(OBJ)\socket.obj \ $(OBJ)\sockstartup_w32.obj \ $(OBJ)\strcollect.obj \ + $(OBJ)\strerror_r.obj \ $(OBJ)\strlcat.obj \ $(OBJ)\strlcpy.obj \ $(OBJ)\strpool.obj \ diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index 8694db53f..be0a187bb 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -63,6 +63,8 @@ typedef SOCKET rk_socket_t; +#define rk_closesocket(x) closesocket(x) +#define rk_INVALID_SOCKET INVALID_SOCKET #define rk_IS_BAD_SOCKET(s) ((s) == INVALID_SOCKET) #define rk_IS_SOCKET_ERROR(rv) ((rv) == SOCKET_ERROR) #define rk_SOCK_ERRNO WSAGetLastError() @@ -220,6 +222,10 @@ struct sockaddr_dl; #include #endif +#ifdef BACKSLASH_PATH_DELIM +#define rk_PATH_DELIM '\\' +#endif + #ifndef HAVE_SSIZE_T #ifdef _WIN64 typedef __int64 ssize_t; @@ -303,7 +309,7 @@ rk_vsnprintf (char *str, size_t sz, const char *format, va_list args); S_ISBLK(m) */ -#endif +#endif /* _MSC_VER */ #ifndef HAVE_PUTENV #define putenv rk_putenv @@ -827,8 +833,10 @@ struct msghdr { int msg_flags; }; +#define sendmsg sendmsg_w32 + ROKEN_LIB_FUNCTION ssize_t ROKEN_LIB_CALL -sendmsg(rk_socket_t s, const struct msghdr * msg, int flags); +sendmsg_w32(rk_socket_t s, const struct msghdr * msg, int flags); #endif diff --git a/lib/roken/sendmsg.c b/lib/roken/sendmsg.c index bbe5c303f..6e2eecd49 100644 --- a/lib/roken/sendmsg.c +++ b/lib/roken/sendmsg.c @@ -100,7 +100,7 @@ sendmsg(rk_socket_t s, const struct msghdr *msg, int flags) * **********************************************************************/ -/* +/** * Implementation of sendmsg() for WIN32 * * We are using a contrived definition of msghdr which actually uses From 1b6048561cab49366c83242fc510e8b16810e573 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Thu, 26 Nov 2009 01:59:18 -0500 Subject: [PATCH 115/134] Set HAVE_SCC=1 on Windows --- windows/NTMakefile.config | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/windows/NTMakefile.config b/windows/NTMakefile.config index d7f427958..4f49a3d5f 100644 --- a/windows/NTMakefile.config +++ b/windows/NTMakefile.config @@ -91,4 +91,7 @@ ENABLE_PTHREAD_SUPPORT=1 # Use the Kerberos Credentials Manager # HAVE_KCM=1 -DIR_hdbdir=%{COMMON_APPDATA}\heimdal\hdb +# Use the sqlite backend +HAVE_SCC=1 + +DIR_hdbdir=%{COMMON_APPDATA}/heimdal/hdb From 9227b99979a60067ec3d97a7e4403676b8f66928 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Dec 2009 01:50:44 -0500 Subject: [PATCH 116/134] (lib/gssapi) Add missing dependencies to NTMakefile --- lib/gssapi/NTMakefile | 343 ++++++++++++++++++++++-------------------- 1 file changed, 181 insertions(+), 162 deletions(-) diff --git a/lib/gssapi/NTMakefile b/lib/gssapi/NTMakefile index 61eb31ab8..4ed7ca5a6 100644 --- a/lib/gssapi/NTMakefile +++ b/lib/gssapi/NTMakefile @@ -42,6 +42,7 @@ krb5src = \ krb5/aeap.c \ krb5/arcfour.c \ krb5/canonicalize_name.c \ + krb5/creds.c \ krb5/ccache_name.c \ krb5/cfx.c \ krb5/cfx.h \ @@ -101,6 +102,7 @@ mechsrc = \ mech/gss_compare_name.c \ mech/gss_context_time.c \ mech/gss_create_empty_oid_set.c \ + mech/gss_cred.c \ mech/gss_decapsulate_token.c \ mech/gss_delete_sec_context.c \ mech/gss_display_name.c \ @@ -219,19 +221,15 @@ $(gssapi_files:.x=.c): $$(@R).x $(spnego_files:.x=.c): $$(@R).x -$(OBJ)\gssapi\gssapi_asn1.h: $(OBJ)\gssapi\gssapi_asn1.hx - $(CP) $** $@ - -$(OBJ)\spnego\spnego_asn1.h: $(OBJ)\spnego\spnego_asn1.hx - $(CP) $** $@ - -$(gssapi_files) $(OBJ)\gssapi\gssapi_asn1.hx: $(BINDIR)\asn1_compile.exe mech\gssapi.asn1 +$(gssapi_files) $(OBJ)\gssapi\gssapi_asn1.hx $(OBJ)\gssapi\gssapi_asn1-priv.hx: \ +$(BINDIR)\asn1_compile.exe mech\gssapi.asn1 cd $(OBJ)\gssapi $(BINDIR)\asn1_compile.exe $(SRCDIR)\mech\gssapi.asn1 gssapi_asn1 \ || ( $(RM) $(OBJ)\gssapi\gssapi_asn1.h ; exit /b 1 ) cd $(SRCDIR) -$(spnego_files) $(OBJ)\spnego\spnego_asn1.hx: $(BINDIR)\asn1_compile.exe spnego\spnego.asn1 +$(spnego_files) $(OBJ)\spnego\spnego_asn1.hx $(OBJ)\spnego\spnego_asn1-priv.hx: \ +$(BINDIR)\asn1_compile.exe spnego\spnego.asn1 cd $(OBJ)\spnego $(BINDIR)\asn1_compile --sequence=MechTypeList $(SRCDIR)\spnego\spnego.asn1 spnego_asn1 \ || ( $(RM) $(OBJ)\spnego\spnego_asn1.h ; exit /b 1 ) @@ -242,164 +240,168 @@ $(OBJ)\gkrb5_err.c $(OBJ)\gkrb5_err.h: krb5\gkrb5_err.et $(BINDIR)\compile_et.exe $(SRCDIR)\krb5\gkrb5_err.et cd $(SRCDIR) -INCFILES= \ - $(INCDIR)\gssapi.h \ - $(INCDIR)\gssapi\gssapi.h \ - $(INCDIR)\gssapi\gssapi_krb5.h \ - $(INCDIR)\gssapi\gssapi_ntlm.h \ - $(INCDIR)\gssapi\gssapi_spnego.h \ - $(OBJ)\ntlm\ntlm-private.h \ - $(OBJ)\spnego\spnego-private.h \ - $(OBJ)\krb5\gsskrb5-private.h \ - $(OBJ)\gkrb5_err.h \ - $(OBJ)\gssapi\gssapi_asn1.h \ - $(OBJ)\spnego\spnego_asn1.h +INCFILES= \ + $(INCDIR)\gssapi.h \ + $(INCDIR)\gssapi\gssapi.h \ + $(INCDIR)\gssapi\gssapi_krb5.h \ + $(INCDIR)\gssapi\gssapi_ntlm.h \ + $(INCDIR)\gssapi\gssapi_spnego.h \ + $(OBJ)\ntlm\ntlm-private.h \ + $(OBJ)\spnego\spnego-private.h \ + $(OBJ)\krb5\gsskrb5-private.h \ + $(OBJ)\gkrb5_err.h \ + $(OBJ)\gssapi\gssapi_asn1.h \ + $(OBJ)\gssapi\gssapi_asn1-priv.h \ + $(OBJ)\spnego\spnego_asn1.h \ + $(OBJ)\spnego\spnego_asn1-priv.h all:: $(INCFILES) -libgssapi_OBJs= \ - $(OBJ)\krb5\8003.obj \ - $(OBJ)\krb5\accept_sec_context.obj \ - $(OBJ)\krb5\acquire_cred.obj \ - $(OBJ)\krb5\add_cred.obj \ - $(OBJ)\krb5\address_to_krb5addr.obj \ - $(OBJ)\krb5\aeap.obj \ - $(OBJ)\krb5\arcfour.obj \ - $(OBJ)\krb5\canonicalize_name.obj \ - $(OBJ)\krb5\ccache_name.obj \ - $(OBJ)\krb5\cfx.obj \ - $(OBJ)\krb5\compare_name.obj \ - $(OBJ)\krb5\compat.obj \ - $(OBJ)\krb5\context_time.obj \ - $(OBJ)\krb5\copy_ccache.obj \ - $(OBJ)\krb5\decapsulate.obj \ - $(OBJ)\krb5\delete_sec_context.obj \ - $(OBJ)\krb5\display_name.obj \ - $(OBJ)\krb5\display_status.obj \ - $(OBJ)\krb5\duplicate_name.obj \ - $(OBJ)\krb5\encapsulate.obj \ - $(OBJ)\krb5\export_name.obj \ - $(OBJ)\krb5\export_sec_context.obj \ - $(OBJ)\krb5\external.obj \ - $(OBJ)\krb5\get_mic.obj \ - $(OBJ)\krb5\import_name.obj \ - $(OBJ)\krb5\import_sec_context.obj \ - $(OBJ)\krb5\indicate_mechs.obj \ - $(OBJ)\krb5\init.obj \ - $(OBJ)\krb5\init_sec_context.obj \ - $(OBJ)\krb5\inquire_context.obj \ - $(OBJ)\krb5\inquire_cred.obj \ - $(OBJ)\krb5\inquire_cred_by_mech.obj \ - $(OBJ)\krb5\inquire_cred_by_oid.obj \ - $(OBJ)\krb5\inquire_mechs_for_name.obj \ - $(OBJ)\krb5\inquire_names_for_mech.obj \ - $(OBJ)\krb5\inquire_sec_context_by_oid.obj \ - $(OBJ)\krb5\process_context_token.obj \ - $(OBJ)\krb5\prf.obj \ - $(OBJ)\krb5\release_buffer.obj \ - $(OBJ)\krb5\release_cred.obj \ - $(OBJ)\krb5\release_name.obj \ - $(OBJ)\krb5\sequence.obj \ - $(OBJ)\krb5\store_cred.obj \ - $(OBJ)\krb5\set_cred_option.obj \ - $(OBJ)\krb5\set_sec_context_option.obj \ - $(OBJ)\krb5\ticket_flags.obj \ - $(OBJ)\krb5\unwrap.obj \ - $(OBJ)\krb5\verify_mic.obj \ - $(OBJ)\krb5\wrap.obj \ - $(OBJ)\mech\context.obj \ - $(OBJ)\mech\doxygen.obj \ - $(OBJ)\mech\gss_accept_sec_context.obj \ - $(OBJ)\mech\gss_acquire_cred.obj \ - $(OBJ)\mech\gss_add_cred.obj \ - $(OBJ)\mech\gss_add_oid_set_member.obj \ - $(OBJ)\mech\gss_aeap.obj \ - $(OBJ)\mech\gss_buffer_set.obj \ - $(OBJ)\mech\gss_canonicalize_name.obj \ - $(OBJ)\mech\gss_compare_name.obj \ - $(OBJ)\mech\gss_context_time.obj \ - $(OBJ)\mech\gss_create_empty_oid_set.obj \ - $(OBJ)\mech\gss_decapsulate_token.obj \ - $(OBJ)\mech\gss_delete_sec_context.obj \ - $(OBJ)\mech\gss_display_name.obj \ - $(OBJ)\mech\gss_display_status.obj \ - $(OBJ)\mech\gss_duplicate_name.obj \ - $(OBJ)\mech\gss_duplicate_oid.obj \ - $(OBJ)\mech\gss_encapsulate_token.obj \ - $(OBJ)\mech\gss_export_name.obj \ - $(OBJ)\mech\gss_export_sec_context.obj \ - $(OBJ)\mech\gss_get_mic.obj \ - $(OBJ)\mech\gss_import_name.obj \ - $(OBJ)\mech\gss_import_sec_context.obj \ - $(OBJ)\mech\gss_indicate_mechs.obj \ - $(OBJ)\mech\gss_init_sec_context.obj \ - $(OBJ)\mech\gss_inquire_context.obj \ - $(OBJ)\mech\gss_inquire_cred.obj \ - $(OBJ)\mech\gss_inquire_cred_by_mech.obj \ - $(OBJ)\mech\gss_inquire_cred_by_oid.obj \ - $(OBJ)\mech\gss_inquire_mechs_for_name.obj \ - $(OBJ)\mech\gss_inquire_names_for_mech.obj \ - $(OBJ)\mech\gss_krb5.obj \ - $(OBJ)\mech\gss_mech_switch.obj \ - $(OBJ)\mech\gss_names.obj \ - $(OBJ)\mech\gss_oid_equal.obj \ - $(OBJ)\mech\gss_oid_to_str.obj \ - $(OBJ)\mech\gss_process_context_token.obj \ - $(OBJ)\mech\gss_pseudo_random.obj \ - $(OBJ)\mech\gss_release_buffer.obj \ - $(OBJ)\mech\gss_release_cred.obj \ - $(OBJ)\mech\gss_release_name.obj \ - $(OBJ)\mech\gss_release_oid.obj \ - $(OBJ)\mech\gss_release_oid_set.obj \ - $(OBJ)\mech\gss_seal.obj \ - $(OBJ)\mech\gss_set_cred_option.obj \ - $(OBJ)\mech\gss_set_sec_context_option.obj \ - $(OBJ)\mech\gss_sign.obj \ - $(OBJ)\mech\gss_store_cred.obj \ - $(OBJ)\mech\gss_test_oid_set_member.obj \ - $(OBJ)\mech\gss_unseal.obj \ - $(OBJ)\mech\gss_unwrap.obj \ - $(OBJ)\mech\gss_utils.obj \ - $(OBJ)\mech\gss_verify.obj \ - $(OBJ)\mech\gss_verify_mic.obj \ - $(OBJ)\mech\gss_wrap.obj \ - $(OBJ)\mech\gss_wrap_size_limit.obj \ - $(OBJ)\mech\gss_inquire_sec_context_by_oid.obj \ - $(OBJ)\ntlm\accept_sec_context.obj \ - $(OBJ)\ntlm\acquire_cred.obj \ - $(OBJ)\ntlm\add_cred.obj \ - $(OBJ)\ntlm\canonicalize_name.obj \ - $(OBJ)\ntlm\compare_name.obj \ - $(OBJ)\ntlm\context_time.obj \ - $(OBJ)\ntlm\crypto.obj \ - $(OBJ)\ntlm\delete_sec_context.obj \ - $(OBJ)\ntlm\display_name.obj \ - $(OBJ)\ntlm\display_status.obj \ - $(OBJ)\ntlm\duplicate_name.obj \ - $(OBJ)\ntlm\export_name.obj \ - $(OBJ)\ntlm\export_sec_context.obj \ - $(OBJ)\ntlm\external.obj \ - $(OBJ)\ntlm\import_name.obj \ - $(OBJ)\ntlm\import_sec_context.obj \ - $(OBJ)\ntlm\indicate_mechs.obj \ - $(OBJ)\ntlm\init_sec_context.obj \ - $(OBJ)\ntlm\inquire_context.obj \ - $(OBJ)\ntlm\inquire_cred.obj \ - $(OBJ)\ntlm\inquire_cred_by_mech.obj \ - $(OBJ)\ntlm\inquire_mechs_for_name.obj \ - $(OBJ)\ntlm\inquire_names_for_mech.obj \ - $(OBJ)\ntlm\process_context_token.obj \ - $(OBJ)\ntlm\release_cred.obj \ - $(OBJ)\ntlm\release_name.obj \ - $(OBJ)\ntlm\kdc.obj \ - $(OBJ)\spnego\accept_sec_context.obj \ - $(OBJ)\spnego\compat.obj \ - $(OBJ)\spnego\context_stubs.obj \ - $(OBJ)\spnego\cred_stubs.obj \ - $(OBJ)\spnego\external.obj \ - $(OBJ)\spnego\init_sec_context.obj \ +libgssapi_OBJs = \ + $(OBJ)\krb5/8003.obj \ + $(OBJ)\krb5/accept_sec_context.obj \ + $(OBJ)\krb5/acquire_cred.obj \ + $(OBJ)\krb5/add_cred.obj \ + $(OBJ)\krb5/address_to_krb5addr.obj \ + $(OBJ)\krb5/aeap.obj \ + $(OBJ)\krb5/arcfour.obj \ + $(OBJ)\krb5/canonicalize_name.obj \ + $(OBJ)\krb5/creds.obj \ + $(OBJ)\krb5/ccache_name.obj \ + $(OBJ)\krb5/cfx.obj \ + $(OBJ)\krb5/compare_name.obj \ + $(OBJ)\krb5/compat.obj \ + $(OBJ)\krb5/context_time.obj \ + $(OBJ)\krb5/copy_ccache.obj \ + $(OBJ)\krb5/decapsulate.obj \ + $(OBJ)\krb5/delete_sec_context.obj \ + $(OBJ)\krb5/display_name.obj \ + $(OBJ)\krb5/display_status.obj \ + $(OBJ)\krb5/duplicate_name.obj \ + $(OBJ)\krb5/encapsulate.obj \ + $(OBJ)\krb5/export_name.obj \ + $(OBJ)\krb5/export_sec_context.obj \ + $(OBJ)\krb5/external.obj \ + $(OBJ)\krb5/get_mic.obj \ + $(OBJ)\krb5/import_name.obj \ + $(OBJ)\krb5/import_sec_context.obj \ + $(OBJ)\krb5/indicate_mechs.obj \ + $(OBJ)\krb5/init.obj \ + $(OBJ)\krb5/init_sec_context.obj \ + $(OBJ)\krb5/inquire_context.obj \ + $(OBJ)\krb5/inquire_cred.obj \ + $(OBJ)\krb5/inquire_cred_by_mech.obj \ + $(OBJ)\krb5/inquire_cred_by_oid.obj \ + $(OBJ)\krb5/inquire_mechs_for_name.obj \ + $(OBJ)\krb5/inquire_names_for_mech.obj \ + $(OBJ)\krb5/inquire_sec_context_by_oid.obj \ + $(OBJ)\krb5/process_context_token.obj \ + $(OBJ)\krb5/prf.obj \ + $(OBJ)\krb5/release_buffer.obj \ + $(OBJ)\krb5/release_cred.obj \ + $(OBJ)\krb5/release_name.obj \ + $(OBJ)\krb5/sequence.obj \ + $(OBJ)\krb5/store_cred.obj \ + $(OBJ)\krb5/set_cred_option.obj \ + $(OBJ)\krb5/set_sec_context_option.obj \ + $(OBJ)\krb5/ticket_flags.obj \ + $(OBJ)\krb5/unwrap.obj \ + $(OBJ)\krb5/verify_mic.obj \ + $(OBJ)\krb5/wrap.obj \ + $(OBJ)\mech/context.obj \ + $(OBJ)\mech/doxygen.obj \ + $(OBJ)\mech/gss_accept_sec_context.obj \ + $(OBJ)\mech/gss_acquire_cred.obj \ + $(OBJ)\mech/gss_add_cred.obj \ + $(OBJ)\mech/gss_add_oid_set_member.obj \ + $(OBJ)\mech/gss_aeap.obj \ + $(OBJ)\mech/gss_buffer_set.obj \ + $(OBJ)\mech/gss_canonicalize_name.obj \ + $(OBJ)\mech/gss_compare_name.obj \ + $(OBJ)\mech/gss_context_time.obj \ + $(OBJ)\mech/gss_create_empty_oid_set.obj \ + $(OBJ)\mech/gss_cred.obj \ + $(OBJ)\mech/gss_decapsulate_token.obj \ + $(OBJ)\mech/gss_delete_sec_context.obj \ + $(OBJ)\mech/gss_display_name.obj \ + $(OBJ)\mech/gss_display_status.obj \ + $(OBJ)\mech/gss_duplicate_name.obj \ + $(OBJ)\mech/gss_duplicate_oid.obj \ + $(OBJ)\mech/gss_encapsulate_token.obj \ + $(OBJ)\mech/gss_export_name.obj \ + $(OBJ)\mech/gss_export_sec_context.obj \ + $(OBJ)\mech/gss_get_mic.obj \ + $(OBJ)\mech/gss_import_name.obj \ + $(OBJ)\mech/gss_import_sec_context.obj \ + $(OBJ)\mech/gss_indicate_mechs.obj \ + $(OBJ)\mech/gss_init_sec_context.obj \ + $(OBJ)\mech/gss_inquire_context.obj \ + $(OBJ)\mech/gss_inquire_cred.obj \ + $(OBJ)\mech/gss_inquire_cred_by_mech.obj \ + $(OBJ)\mech/gss_inquire_cred_by_oid.obj \ + $(OBJ)\mech/gss_inquire_mechs_for_name.obj \ + $(OBJ)\mech/gss_inquire_names_for_mech.obj \ + $(OBJ)\mech/gss_krb5.obj \ + $(OBJ)\mech/gss_mech_switch.obj \ + $(OBJ)\mech/gss_names.obj \ + $(OBJ)\mech/gss_oid_equal.obj \ + $(OBJ)\mech/gss_oid_to_str.obj \ + $(OBJ)\mech/gss_process_context_token.obj \ + $(OBJ)\mech/gss_pseudo_random.obj \ + $(OBJ)\mech/gss_release_buffer.obj \ + $(OBJ)\mech/gss_release_cred.obj \ + $(OBJ)\mech/gss_release_name.obj \ + $(OBJ)\mech/gss_release_oid.obj \ + $(OBJ)\mech/gss_release_oid_set.obj \ + $(OBJ)\mech/gss_seal.obj \ + $(OBJ)\mech/gss_set_cred_option.obj \ + $(OBJ)\mech/gss_set_sec_context_option.obj \ + $(OBJ)\mech/gss_sign.obj \ + $(OBJ)\mech/gss_store_cred.obj \ + $(OBJ)\mech/gss_test_oid_set_member.obj \ + $(OBJ)\mech/gss_unseal.obj \ + $(OBJ)\mech/gss_unwrap.obj \ + $(OBJ)\mech/gss_utils.obj \ + $(OBJ)\mech/gss_verify.obj \ + $(OBJ)\mech/gss_verify_mic.obj \ + $(OBJ)\mech/gss_wrap.obj \ + $(OBJ)\mech/gss_wrap_size_limit.obj \ + $(OBJ)\mech/gss_inquire_sec_context_by_oid.obj \ + $(OBJ)\spnego/accept_sec_context.obj \ + $(OBJ)\spnego/compat.obj \ + $(OBJ)\spnego/context_stubs.obj \ + $(OBJ)\spnego/cred_stubs.obj \ + $(OBJ)\spnego/external.obj \ + $(OBJ)\spnego/init_sec_context.obj \ + $(OBJ)\ntlm/accept_sec_context.obj \ + $(OBJ)\ntlm/acquire_cred.obj \ + $(OBJ)\ntlm/add_cred.obj \ + $(OBJ)\ntlm/canonicalize_name.obj \ + $(OBJ)\ntlm/compare_name.obj \ + $(OBJ)\ntlm/context_time.obj \ + $(OBJ)\ntlm/crypto.obj \ + $(OBJ)\ntlm/delete_sec_context.obj \ + $(OBJ)\ntlm/display_name.obj \ + $(OBJ)\ntlm/display_status.obj \ + $(OBJ)\ntlm/duplicate_name.obj \ + $(OBJ)\ntlm/export_name.obj \ + $(OBJ)\ntlm/export_sec_context.obj \ + $(OBJ)\ntlm/external.obj \ + $(OBJ)\ntlm/import_name.obj \ + $(OBJ)\ntlm/import_sec_context.obj \ + $(OBJ)\ntlm/indicate_mechs.obj \ + $(OBJ)\ntlm/init_sec_context.obj \ + $(OBJ)\ntlm/inquire_context.obj \ + $(OBJ)\ntlm/inquire_cred.obj \ + $(OBJ)\ntlm/inquire_cred_by_mech.obj \ + $(OBJ)\ntlm/inquire_mechs_for_name.obj \ + $(OBJ)\ntlm/inquire_names_for_mech.obj \ + $(OBJ)\ntlm/process_context_token.obj \ + $(OBJ)\ntlm/release_cred.obj \ + $(OBJ)\ntlm/release_name.obj \ + $(OBJ)\ntlm/kdc.obj \ $(OBJ)\gkrb5_err.obj \ - $(spnego_files:.x=.obj) \ + $(spnego_files:.x=.obj) \ $(gssapi_files:.x=.obj) GCOPTS=-I$(SRCDIR) -I$(OBJ) -Igssapi -DBUILD_GSSAPI_LIB @@ -446,6 +448,12 @@ GCOPTS=-I$(SRCDIR) -I$(OBJ) -Igssapi -DBUILD_GSSAPI_LIB {gssapi}.h{$(INCDIR)\gssapi}.h: $(CP) $** $@ +{$(OBJ)\gssapi}.hx{$(OBJ)\gssapi}.h: + $(CP) $** $@ + +{$(OBJ)\spnego}.hx{$(OBJ)\spnego}.h: + $(CP) $** $@ + LIBGSSAPI_LIBS=\ $(LIBROKEN) \ $(LIBASN1) \ @@ -516,3 +524,14 @@ clean:: -$(RM) $(OBJ)\spnego\*.* -$(RM) $(OBJ)\mech\*.* -$(RM) $(OBJ)\gssapi\*.* + +!ifdef ELISP +# This macro invocation is used to update the libgssapi_OBJs +# definition below (generate-obj-macro is defined in NTMakefile.w32): + +(generate-obj-macro "libgssapi_OBJs" + (concat "\t$(OBJ)\\gkrb5_err.obj \\\n" + "\t$(spnego_files:.x=.obj) \\\n" + "\t$(gssapi_files:.x=.obj)") + "krb5src" "mechsrc" "spnegosrc" "ntlmsrc") +!endif From b7fe2d3647293db42146ce90b9c3f43eccfb4f12 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Dec 2009 01:51:08 -0500 Subject: [PATCH 117/134] (lib/hdb) Add missing dependencies to NTMakefile --- lib/hdb/NTMakefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/hdb/NTMakefile b/lib/hdb/NTMakefile index 963e136c3..dd5dd3b9d 100644 --- a/lib/hdb/NTMakefile +++ b/lib/hdb/NTMakefile @@ -52,7 +52,7 @@ gen_files_hdb = \ $(OBJ)\asn1_hdb_entry_alias.x \ $(OBJ)\asn1_hdb_keyset.x -$(gen_files_hdb) $(OBJ)\hdb_asn1.hx: $(BINDIR)\asn1_compile.exe hdb.asn1 +$(gen_files_hdb) $(OBJ)\hdb_asn1.hx $(OBJ)\hdb_asn1-priv.hx: $(BINDIR)\asn1_compile.exe hdb.asn1 cd $(OBJ) $(BINDIR)\asn1_compile.exe $(SRCDIR)\hdb.asn1 hdb_asn1 cd $(SRCDIR) @@ -90,6 +90,8 @@ dist_libhdb_la_SOURCES = \ $(ldap_c) \ hdb.c \ hdb-sqlite.c \ + hdb-keytab.c \ + hdb-mitdb.c \ hdb_locl.h \ keys.c \ keytab.c \ @@ -98,7 +100,7 @@ dist_libhdb_la_SOURCES = \ ndbm.c \ print.c -libhdb_OBJs= \ +libhdb_OBJs = \ $(OBJ)\common.obj \ $(OBJ)\db.obj \ $(OBJ)\db3.obj \ @@ -106,6 +108,8 @@ libhdb_OBJs= \ $(ldap) \ $(OBJ)\hdb.obj \ $(OBJ)\hdb-sqlite.obj \ + $(OBJ)\hdb-keytab.obj \ + $(OBJ)\hdb-mitdb.obj \ $(OBJ)\keys.obj \ $(OBJ)\keytab.obj \ $(OBJ)\dbinfo.obj \ @@ -128,12 +132,13 @@ $(OBJ)\hdb-private.h: $(dist_libhdb_la_SOURCES) $(PERL) ../../cf/make-proto.pl -q -P remote -p $@ $(dist_libhdb_la_SOURCES) \ || $(RM) $@ -INCFILES=\ - $(INCDIR)\hdb.h \ - $(INCDIR)\hdb-protos.h \ +INCFILES= \ + $(INCDIR)\hdb.h \ + $(INCDIR)\hdb-protos.h \ $(OBJ)\hdb-private.h \ - $(INCDIR)\hdb_err.h \ - $(INCDIR)\hdb_asn1.h + $(INCDIR)\hdb_err.h \ + $(INCDIR)\hdb_asn1.h \ + $(INCDIR)\hdb_asn1-priv.h !ifndef STATICLIBS From 0a43d2b3cf4571a0d7d89caf590c62c8edfe124e Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Dec 2009 02:56:58 -0500 Subject: [PATCH 118/134] (kdc) Add missing export --- kdc/libkdc-exports.def | 1 + 1 file changed, 1 insertion(+) diff --git a/kdc/libkdc-exports.def b/kdc/libkdc-exports.def index b3ace1c1a..a7db0c7e8 100644 --- a/kdc/libkdc-exports.def +++ b/kdc/libkdc-exports.def @@ -10,3 +10,4 @@ EXPORTS krb5_kdc_process_request krb5_kdc_save_request krb5_kdc_update_time + krb5_kdc_pk_initialize From 0ad290b500430f571045ca197a9561da1a83e541 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Dec 2009 16:42:28 -0500 Subject: [PATCH 119/134] Fix missing #endif --- kdc/connect.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kdc/connect.c b/kdc/connect.c index af78fd02b..b126ed591 100644 --- a/kdc/connect.c +++ b/kdc/connect.c @@ -883,6 +883,7 @@ loop(krb5_context context, #ifdef FD_SETSIZE if (max_fd >= FD_SETSIZE) krb5_errx(context, 1, "fd too large"); +#endif #endif FD_SET(d[i].s, &fds); } else if(min_free < 0 || i < min_free) From a4acca45eca5bcd059b186a3e6b3530ec77752de Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Dec 2009 16:43:12 -0500 Subject: [PATCH 120/134] (kdc/hpropd.c) inetd_flag is used even when NO_INETD is defined --- kdc/hpropd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kdc/hpropd.c b/kdc/hpropd.c index 6fe84b23a..625fec5b9 100644 --- a/kdc/hpropd.c +++ b/kdc/hpropd.c @@ -35,9 +35,7 @@ RCSID("$Id$"); -#ifndef NO_INETD static int inetd_flag = -1; -#endif static int help_flag; static int version_flag; static int print_dump; From 6f22fb3bb1bfcf81a478e75196fd9f5b405ad260 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Dec 2009 16:43:39 -0500 Subject: [PATCH 121/134] (kdc/kerberos5.c) VC isn't C99 --- kdc/kerberos5.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kdc/kerberos5.c b/kdc/kerberos5.c index c564f33e3..87162d5f9 100644 --- a/kdc/kerberos5.c +++ b/kdc/kerberos5.c @@ -286,8 +286,9 @@ _kdc_encode_reply(krb5_context context, ret = krb5_crypto_init(context, skey, etype, &crypto); if (ret) { + const char *msg; free(buf); - const char *msg = krb5_get_error_message(context, ret); + msg = krb5_get_error_message(context, ret); kdc_log(context, config, 0, "krb5_crypto_init failed: %s", msg); krb5_free_error_message(context, msg); return ret; From 0346adf7f681e6a995ad599d82d835cfc2c46833 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 1 Dec 2009 16:44:08 -0500 Subject: [PATCH 122/134] (kdc/NTMakefile) Fix dependencies --- kdc/NTMakefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/kdc/NTMakefile b/kdc/NTMakefile index c1636d719..2c681e047 100644 --- a/kdc/NTMakefile +++ b/kdc/NTMakefile @@ -37,7 +37,11 @@ BINPROGRAMS=$(BINDIR)\string2key.exe SBINPROGRAMS=$(SBINDIR)\kstash.exe -LIBEXECPROGRAMS=$(LIBEXECDIR)\hprop.exe $(LIBEXECDIR)\hpropd.exe $(LIBEXECDIR)\kdc.exe +LIBEXECPROGRAMS= \ + $(LIBEXECDIR)\hprop.exe \ + $(LIBEXECDIR)\hpropd.exe \ + $(LIBEXECDIR)\kdc.exe \ +# $(LIBEXECDIR)\digest-service.exe NOINST_PROGRAMS=$(OBJ)\kdc-replay.exe @@ -90,7 +94,14 @@ $(BINDIR)\string2key.exe: $(OBJ)\string2key.obj $(BIN_LIBS) $(_VC_MANIFEST_CLEAN) $(_CODESIGN) -$(LIBEXECDIR)\kdc.exe: $(OBJ)\connect.obj $(OBJ)\config.obj $(OBJ)\main.obj $(LIBKDC) $(BIN_LIBS) +$(BINDIR)\digest-service.exe: $(OBJ)\digest-service.obj $(BIN_LIBS) + $(EXECONLINK) + $(_VC_MANIFEST_EMBED_EXE) + $(_VC_MANIFEST_CLEAN) + $(_CODESIGN) + +$(LIBEXECDIR)\kdc.exe: \ +$(OBJ)\connect.obj $(OBJ)\config.obj $(OBJ)\announce.obj $(OBJ)\main.obj $(LIBKDC) $(BIN_LIBS) $(EXECONLINK) $(_VC_MANIFEST_EMBED_EXE) $(_VC_MANIFEST_CLEAN) From 349915e43811d49367a65ae6e6ed737b7e4d6d21 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 21 Dec 2009 13:09:26 -0500 Subject: [PATCH 123/134] Fix comment --- lib/gssapi/NTMakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gssapi/NTMakefile b/lib/gssapi/NTMakefile index 4ed7ca5a6..6f321b732 100644 --- a/lib/gssapi/NTMakefile +++ b/lib/gssapi/NTMakefile @@ -527,7 +527,7 @@ clean:: !ifdef ELISP # This macro invocation is used to update the libgssapi_OBJs -# definition below (generate-obj-macro is defined in NTMakefile.w32): +# definition below (generate-obj-macro is defined in maint.el): (generate-obj-macro "libgssapi_OBJs" (concat "\t$(OBJ)\\gkrb5_err.obj \\\n" From 630e89e357c892637cc97a007a2aa85308b1194b Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 21 Dec 2009 13:09:54 -0500 Subject: [PATCH 124/134] Add LIBHEIMIPCC and LIBHEIMIPCS to NTMakefile.w32 --- windows/NTMakefile.w32 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/windows/NTMakefile.w32 b/windows/NTMakefile.w32 index fa57266db..3da293f7f 100644 --- a/windows/NTMakefile.w32 +++ b/windows/NTMakefile.w32 @@ -447,6 +447,8 @@ LIBHCRYPTO =$(LIBDIR)\libhcrypto.lib LIBHX509 =$(LIBDIR)\libhx509.lib LIBKRB5 =$(LIBDIR)\libkrb5.lib LIBHEIMNTLM =$(LIBDIR)\libheimntlm.lib +LIBHEIMIPCC =$(LIBDIR)\libheim-ipcc.lib +LIBHEIMIPCS =$(LIBDIR)\libheim-ipcs.lib LIBGSSAPI =$(LIBDIR)\libgssapi.lib LIBHDB =$(LIBDIR)\libhdb.lib LIBKADM5SRV =$(LIBDIR)\libkadm5srv.lib From 94bf68aaaef1929afb42657506e3a235f8a471cc Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 21 Dec 2009 13:10:23 -0500 Subject: [PATCH 125/134] Add maint.el helper script for maintaining ported dependencies --- windows/maint.el | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 windows/maint.el diff --git a/windows/maint.el b/windows/maint.el new file mode 100644 index 000000000..a76179d85 --- /dev/null +++ b/windows/maint.el @@ -0,0 +1,34 @@ + + +(defun generate-obj-macro (mname &optional postfix &rest slist) + "Generates a macro definition for an OBJs dependency based on a list of source definitions" + + (let* + ((replist (apply 'append (mapcar (lambda (sdef) + (goto-char 0) + (let* + ((def (buffer-substring-no-properties + (search-forward (concat sdef " = \\\n") nil t) + (search-forward "\n\n" nil t))) + (st (split-string + (replace-regexp-in-string "^.*\\.h.*\n" "" def) + "\\s-+\\\\?\\|\n" t))) + st)) slist))) + (def-start (search-forward (concat mname " = \\\n") nil t)) + (def-end (search-forward "\n\n" nil t)) + + (repl (mapconcat + (lambda (s) + (concat "\t" + (replace-regexp-in-string + "\\(\\s-*\\)\\(.*\\)\\.c" "\\1$(OBJ)\\\\\\2.obj" s) + " \\")) + replist "\n")) + (erepl (if postfix + (concat repl "\n" postfix "\n\n") + (concat repl "\n\n"))) + ) + (delete-region def-start def-end) + (insert erepl)) + ) + From 4eb90e1c8cb57c6cb784e74307915f6f4f39c904 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 21 Dec 2009 18:02:32 -0500 Subject: [PATCH 126/134] Use correct socket glue --- kadmin/kadm_conn.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/kadmin/kadm_conn.c b/kadmin/kadm_conn.c index 598c22ea7..c7a93346c 100644 --- a/kadmin/kadm_conn.c +++ b/kadmin/kadm_conn.c @@ -131,8 +131,8 @@ spawn_child(krb5_context context, int *socks, size_t buf_len; s = accept(socks[this_sock], sa, &sa_size); - if(IS_BAD_SOCKET(s)) { - krb5_warn(context, SOCK_ERRNO, "accept"); + if(rk_IS_BAD_SOCKET(s)) { + krb5_warn(context, rk_SOCK_ERRNO, "accept"); return 1; } e = krb5_sockaddr2address(context, sa, &addr); @@ -195,9 +195,9 @@ wait_for_connection(krb5_context context, while (term_flag == 0) { read_set = orig_read_set; e = select(max_fd + 1, &read_set, NULL, NULL, NULL); - if(IS_SOCKET_ERROR(e)) { - if(SOCK_ERRNO != EINTR) - krb5_warn(context, SOCK_ERRNO, "select"); + if(rk_IS_SOCKET_ERROR(e)) { + if(rk_SOCK_ERRNO != EINTR) + krb5_warn(context, rk_SOCK_ERRNO, "select"); } else if(e == 0) krb5_warnx(context, "select returned 0"); else { @@ -260,21 +260,21 @@ start_server(krb5_context context) socks = tmp; for(ap = ai; ap; ap = ap->ai_next) { SOCKET s = socket(ap->ai_family, ap->ai_socktype, ap->ai_protocol); - if(IS_BAD_SOCKET(s)) { - krb5_warn(context, SOCK_ERRNO, "socket"); + if(rk_IS_BAD_SOCKET(s)) { + krb5_warn(context, rk_SOCK_ERRNO, "socket"); continue; } socket_set_reuseaddr(s, 1); socket_set_ipv6only(s, 1); - if (IS_SOCKET_ERROR(bind (s, ap->ai_addr, ap->ai_addrlen))) { - krb5_warn(context, SOCK_ERRNO, "bind"); + if (rk_IS_SOCKET_ERROR(bind (s, ap->ai_addr, ap->ai_addrlen))) { + krb5_warn(context, rk_SOCK_ERRNO, "bind"); closesocket(s); continue; } - if (IS_SOCKET_ERROR(listen (s, SOMAXCONN))) { - krb5_warn(context, SOCK_ERRNO, "listen"); + if (rk_IS_SOCKET_ERROR(listen (s, SOMAXCONN))) { + krb5_warn(context, rk_SOCK_ERRNO, "listen"); closesocket(s); continue; } From 16faee892ec5e0c1ffe219f0fdba061b32084ab2 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 21 Dec 2009 18:05:39 -0500 Subject: [PATCH 127/134] Use correct socket glue and try to maintain constness --- lib/krb5/context.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/krb5/context.c b/lib/krb5/context.c index 81a5d296c..b9512c413 100644 --- a/lib/krb5/context.c +++ b/lib/krb5/context.c @@ -245,22 +245,25 @@ cc_ops_register(krb5_context context) static krb5_error_code cc_ops_copy(krb5_context context, const krb5_context src_context) { + krb5_cc_ops **cc_ops; + context->cc_ops = NULL; context->num_cc_ops = 0; if (src_context->num_cc_ops == 0) return 0; - context->cc_ops = malloc(sizeof(context->cc_ops[0]) * src_context->num_cc_ops); - if (context->cc_ops == NULL) { + cc_ops = malloc(sizeof(cc_ops[0]) * src_context->num_cc_ops); + if (cc_ops == NULL) { krb5_set_error_message(context, KRB5_CC_NOMEM, N_("malloc: out of memory", "")); return KRB5_CC_NOMEM; } + memcpy(cc_ops, src_context->cc_ops, + sizeof(cc_ops[0]) * src_context->num_cc_ops); + context->cc_ops = cc_ops; context->num_cc_ops = src_context->num_cc_ops; - memcpy(context->cc_ops, src_context->cc_ops, - sizeof(context->cc_ops[0]) * src_context->num_cc_ops); return 0; } @@ -537,17 +540,9 @@ krb5_free_context(krb5_context context) HEIMDAL_MUTEX_destroy(context->mutex); free(context->mutex); -<<<<<<< HEAD if (context->flags & KRB5_CTX_F_SOCKETS_INITIALIZED) { rk_SOCK_EXIT(); } -======= -#ifdef NEED_SOCK_INIT - if (context->flags & KRB5_CTX_F_SOCKETS_INITIALIZED) { - SOCK_EXIT; - } -#endif ->>>>>>> h-github/master memset(context, 0, sizeof(*context)); free(context); From 7f5b105fd6dee53b56ba0eaef3bd8fbdd20cc619 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 21 Dec 2009 18:06:05 -0500 Subject: [PATCH 128/134] Fix exports --- lib/krb5/libkrb5-exports.def.in | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/krb5/libkrb5-exports.def.in b/lib/krb5/libkrb5-exports.def.in index 7feaad1e7..9286841b2 100644 --- a/lib/krb5/libkrb5-exports.def.in +++ b/lib/krb5/libkrb5-exports.def.in @@ -57,7 +57,6 @@ EXPORTS krb5_auth_con_setuserkey krb5_auth_getremoteseqnumber krb5_build_ap_req - krb5_build_authenticator krb5_build_principal krb5_build_principal_ext krb5_build_principal_va @@ -138,13 +137,13 @@ EXPORTS krb5_compare_creds krb5_config_file_free krb5_config_free_strings - krb5_config_get + _krb5_config_get krb5_config_get_bool krb5_config_get_bool_default krb5_config_get_int krb5_config_get_int_default krb5_config_get_list - krb5_config_get_next + _krb5_config_get_next krb5_config_get_string krb5_config_get_string_default krb5_config_get_strings @@ -153,13 +152,13 @@ EXPORTS krb5_config_parse_file krb5_config_parse_file_multi krb5_config_parse_string_multi - krb5_config_vget + _krb5_config_vget krb5_config_vget_bool krb5_config_vget_bool_default krb5_config_vget_int krb5_config_vget_int_default krb5_config_vget_list - krb5_config_vget_next + _krb5_config_vget_next krb5_config_vget_string krb5_config_vget_string_default krb5_config_vget_strings @@ -712,8 +711,8 @@ EXPORTS krb5_mkt_ops DATA krb5_akf_ops DATA krb5_any_ops DATA - __heimdal_version DATA - __heimdal_long_version DATA + heimdal_version DATA + heimdal_long_version DATA krb5_config_file DATA krb5_defkeyname DATA krb5_cc_type_api DATA @@ -723,8 +722,8 @@ EXPORTS krb5_cc_type_scc DATA ; Shared with GSSAPI krb5 - _krb5_crc_init_table - _krb5_crc_update + _krb5_crc_init_table + _krb5_crc_update _krb5_get_krbtgt _krb5_build_authenticator From 27115dea15bf9ebbc6c4652de4a2172f81913229 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Mon, 21 Dec 2009 18:06:23 -0500 Subject: [PATCH 129/134] Correct whitespace errors --- lib/roken/dirent.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/roken/dirent.h b/lib/roken/dirent.h index c9a86c63f..33ae5eb3e 100644 --- a/lib/roken/dirent.h +++ b/lib/roken/dirent.h @@ -1,19 +1,19 @@ /*********************************************************************** * Copyright (c) 2009, Secure Endpoints Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * - 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. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -26,7 +26,7 @@ * 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. - * + * **********************************************************************/ #ifndef __DIRENT_H__ From ecf9e3c989d289d839f4a758b4b654374454639a Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Tue, 22 Dec 2009 13:36:58 +0100 Subject: [PATCH 130/134] Clean kadm5-pwcheck.h --- include/kadm5/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/kadm5/Makefile.am b/include/kadm5/Makefile.am index c7bb38524..19d782e13 100644 --- a/include/kadm5/Makefile.am +++ b/include/kadm5/Makefile.am @@ -2,4 +2,5 @@ include $(top_srcdir)/Makefile.am.common -CLEANFILES = admin.h kadm5_err.h private.h kadm5-private.h kadm5-protos.h +CLEANFILES = admin.h kadm5_err.h private.h +CLEANFILES += kadm5-private.h kadm5-protos.h kadm5-pwcheck.h From 33f3be4d52984b6914536509d4c915091b056960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 22 Dec 2009 17:45:15 +0100 Subject: [PATCH 131/134] Don't free the hx509ctx otherwise we crash if we fail to init certs (e.g. due to missing smartcard). Signed-off-by: Love Hornquist Astrand --- autogen.sh | 0 lib/krb5/pkinit.c | 1 - 2 files changed, 1 deletion(-) mode change 100644 => 100755 autogen.sh diff --git a/autogen.sh b/autogen.sh old mode 100644 new mode 100755 diff --git a/lib/krb5/pkinit.c b/lib/krb5/pkinit.c index 1d3845435..9239ee6ad 100644 --- a/lib/krb5/pkinit.c +++ b/lib/krb5/pkinit.c @@ -1959,7 +1959,6 @@ _krb5_pk_load_id(krb5_context context, hx509_certs_free(&id->anchors); hx509_certs_free(&id->certpool); hx509_revoke_free(&id->revokectx); - hx509_context_free(&context->hx509ctx); free(id); } else *ret_id = id; From 68cfbb7e199230aa12c4afd1dd81f27dab60c470 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Tue, 22 Dec 2009 14:03:39 -0500 Subject: [PATCH 132/134] Add rk_cloexec_dir() to lib/roken --- lib/hx509/ks_dir.c | 4 +--- lib/krb5/plugin.c | 4 +--- lib/roken/cloexec.c | 8 ++++++++ lib/roken/roken-common.h | 3 +++ lib/roken/roken.h.in | 4 ++++ lib/roken/version-script.map | 1 + 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/hx509/ks_dir.c b/lib/hx509/ks_dir.c index 0d07aa95c..8c8c6e50c 100644 --- a/lib/hx509/ks_dir.c +++ b/lib/hx509/ks_dir.c @@ -113,9 +113,7 @@ dir_iter_start(hx509_context context, free(d); return errno; } -#ifndef _WIN32 - rk_cloexec(dirfd(d->dir)); -#endif + rk_cloexec_dir(d->dir); d->certs = NULL; d->iter = NULL; diff --git a/lib/krb5/plugin.c b/lib/krb5/plugin.c index 9118ade67..aa71e29b3 100644 --- a/lib/krb5/plugin.c +++ b/lib/krb5/plugin.c @@ -205,9 +205,7 @@ load_plugins(krb5_context context) d = opendir(*di); if (d == NULL) continue; -#ifdef HAVE_DIRFD - rk_cloexec(dirfd(d)); -#endif + rk_cloexec_dir(d); while ((entry = readdir(d)) != NULL) { char *n = entry->d_name; diff --git a/lib/roken/cloexec.c b/lib/roken/cloexec.c index 901512a9d..0f2ef2f65 100644 --- a/lib/roken/cloexec.c +++ b/lib/roken/cloexec.c @@ -56,3 +56,11 @@ rk_cloexec_file(FILE *f) rk_cloexec(fileno(f)); #endif } + +void ROKEN_LIB_FUNCTION +rk_cloexec_dir(DIR * d) +{ +#ifdef HAVE_DIRFD + rk_cloexec(dirfd(d)); +#endif +} diff --git a/lib/roken/roken-common.h b/lib/roken/roken-common.h index ac7a92d15..a437d8a34 100644 --- a/lib/roken/roken-common.h +++ b/lib/roken/roken-common.h @@ -480,6 +480,9 @@ rk_cloexec(int); ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL rk_cloexec_file(FILE *); +ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL +rk_cloexec_dir(DIR *); + ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL ct_memcmp(const void *, const void *, size_t); diff --git a/lib/roken/roken.h.in b/lib/roken/roken.h.in index d495b3462..b84e8c1e0 100644 --- a/lib/roken/roken.h.in +++ b/lib/roken/roken.h.in @@ -222,6 +222,10 @@ struct sockaddr_dl; #include #endif +#ifdef HAVE_DIRENT_H +#include +#endif + #ifdef BACKSLASH_PATH_DELIM #define rk_PATH_DELIM '\\' #endif diff --git a/lib/roken/version-script.map b/lib/roken/version-script.map index 9f192ec35..0b2bdbec3 100644 --- a/lib/roken/version-script.map +++ b/lib/roken/version-script.map @@ -42,6 +42,7 @@ HEIMDAL_ROKEN_1.0 { rk_cgetstr; rk_cloexec; rk_cloexec_file; + rk_cloexec_dir; rk_closefrom; rk_copyhostent; rk_dns_free_data; From 160ddd0e43df5e2e7dedf10f0d9b6757aa974f25 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Wed, 23 Dec 2009 14:06:37 +0100 Subject: [PATCH 133/134] use rk_closesocket --- kadmin/kadm_conn.c | 10 +++++----- lib/kadm5/destroy_s.c | 2 +- lib/kadm5/ipropd_master.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/kadmin/kadm_conn.c b/kadmin/kadm_conn.c index c7a93346c..f2124b9d3 100644 --- a/kadmin/kadm_conn.c +++ b/kadmin/kadm_conn.c @@ -151,14 +151,14 @@ spawn_child(krb5_context context, int *socks, pid = fork(); if(pid == 0) { for(i = 0; i < num_socks; i++) - closesocket(socks[i]); + rk_closesocket(socks[i]); dup2(s, STDIN_FILENO); dup2(s, STDOUT_FILENO); if(s != STDIN_FILENO && s != STDOUT_FILENO) - closesocket(s); + rk_closesocket(s); return 0; } else { - closesocket(s); + rk_closesocket(s); } return 1; } @@ -270,12 +270,12 @@ start_server(krb5_context context) if (rk_IS_SOCKET_ERROR(bind (s, ap->ai_addr, ap->ai_addrlen))) { krb5_warn(context, rk_SOCK_ERRNO, "bind"); - closesocket(s); + rk_closesocket(s); continue; } if (rk_IS_SOCKET_ERROR(listen (s, SOMAXCONN))) { krb5_warn(context, rk_SOCK_ERRNO, "listen"); - closesocket(s); + rk_closesocket(s); continue; } socks[num_socks++] = s; diff --git a/lib/kadm5/destroy_s.c b/lib/kadm5/destroy_s.c index 393ffb914..cacbec752 100644 --- a/lib/kadm5/destroy_s.c +++ b/lib/kadm5/destroy_s.c @@ -56,7 +56,7 @@ static void destroy_kadm5_log_context (kadm5_log_context *c) { free (c->log_file); - closesocket (c->socket_fd); + rk_closesocket (c->socket_fd); #ifndef NO_UNIX_SOCKETS if (c->socket_info) { freeaddrinfo(c->socket_info); diff --git a/lib/kadm5/ipropd_master.c b/lib/kadm5/ipropd_master.c index 17d19a8f5..490574003 100644 --- a/lib/kadm5/ipropd_master.c +++ b/lib/kadm5/ipropd_master.c @@ -196,7 +196,7 @@ slave_dead(krb5_context context, slave *s) krb5_warnx(context, "slave %s dead", s->name); if (!rk_IS_BAD_SOCKET(s->fd)) { - closesocket (s->fd); + rk_closesocket (s->fd); s->fd = rk_INVALID_SOCKET; } s->flags |= SLAVE_F_DEAD; @@ -209,7 +209,7 @@ remove_slave (krb5_context context, slave *s, slave **root) slave **p; if (!rk_IS_BAD_SOCKET(s->fd)) - closesocket (s->fd); + rk_closesocket (s->fd); if (s->name) free (s->name); if (s->ac) From be73fa468784d22e3d7c3ee23401d083cda8dfe5 Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Wed, 23 Dec 2009 14:12:38 +0100 Subject: [PATCH 134/134] use krb5_socket_t --- kadmin/kadm_conn.c | 8 ++++---- kadmin/kadmind.c | 2 +- kadmin/rpc.c | 2 +- kadmin/server.c | 6 +++--- lib/roken/test-mini_inetd.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/kadmin/kadm_conn.c b/kadmin/kadm_conn.c index f2124b9d3..f7f765935 100644 --- a/kadmin/kadm_conn.c +++ b/kadmin/kadm_conn.c @@ -124,7 +124,7 @@ spawn_child(krb5_context context, int *socks, struct sockaddr_storage __ss; struct sockaddr *sa = (struct sockaddr *)&__ss; socklen_t sa_size = sizeof(__ss); - SOCKET s; + krb5_socket_t s; pid_t pid; krb5_address addr; char buf[128]; @@ -165,7 +165,7 @@ spawn_child(krb5_context context, int *socks, static int wait_for_connection(krb5_context context, - SOCKET *socks, unsigned int num_socks) + krb5_socket_t *socks, unsigned int num_socks) { unsigned int i; int e; @@ -226,7 +226,7 @@ start_server(krb5_context context) int e; struct kadm_port *p; - SOCKET *socks = NULL, *tmp; + krb5_socket_t *socks = NULL, *tmp; unsigned int num_socks = 0; int i; @@ -259,7 +259,7 @@ start_server(krb5_context context) } socks = tmp; for(ap = ai; ap; ap = ap->ai_next) { - SOCKET s = socket(ap->ai_family, ap->ai_socktype, ap->ai_protocol); + krb5_socket_t s = socket(ap->ai_family, ap->ai_socktype, ap->ai_protocol); if(rk_IS_BAD_SOCKET(s)) { krb5_warn(context, rk_SOCK_ERRNO, "socket"); continue; diff --git a/kadmin/kadmind.c b/kadmin/kadmind.c index c74ab1661..c3711b170 100644 --- a/kadmin/kadmind.c +++ b/kadmin/kadmind.c @@ -95,7 +95,7 @@ main(int argc, char **argv) int i; krb5_log_facility *logfacility; krb5_keytab keytab; - SOCKET sfd = INVALID_SOCKET; + krb5_socket_t sfd = rk_INVALID_SOCKET; setprogname(argv[0]); diff --git a/kadmin/rpc.c b/kadmin/rpc.c index de818c0a5..ced88d66d 100644 --- a/kadmin/rpc.c +++ b/kadmin/rpc.c @@ -1091,7 +1091,7 @@ process_stream(krb5_context context, int -handle_mit(krb5_context context, void *buf, size_t len, SOCKET sock) +handle_mit(krb5_context context, void *buf, size_t len, krb5_socket_t sock) { krb5_storage *sp; diff --git a/kadmin/server.c b/kadmin/server.c index 5068b36b6..79bab5edf 100644 --- a/kadmin/server.c +++ b/kadmin/server.c @@ -440,7 +440,7 @@ v5_loop (krb5_context context, krb5_auth_context ac, krb5_boolean initial, void *kadm_handle, - SOCKET fd) + krb5_socket_t fd) { krb5_error_code ret; krb5_data in, out; @@ -476,7 +476,7 @@ match_appl_version(const void *data, const char *appl_version) static void handle_v5(krb5_context context, krb5_keytab keytab, - SOCKET fd) + krb5_socket_t fd) { krb5_error_code ret; krb5_ticket *ticket; @@ -539,7 +539,7 @@ handle_v5(krb5_context context, krb5_error_code kadmind_loop(krb5_context context, krb5_keytab keytab, - SOCKET sock) + krb5_socket_t sock) { u_char buf[sizeof(KRB5_SENDAUTH_VERSION) + 4]; ssize_t n; diff --git a/lib/roken/test-mini_inetd.c b/lib/roken/test-mini_inetd.c index 0e58fdbfd..89571cd5b 100644 --- a/lib/roken/test-mini_inetd.c +++ b/lib/roken/test-mini_inetd.c @@ -82,7 +82,7 @@ get_connected_socket(rk_socket_t * s_ret) goto done; *s_ret = s; - s = INVALID_SOCKET; + s = rk_INVALID_SOCKET; rv = 0; done: @@ -105,7 +105,7 @@ const char * test_strings[] = { static int test_simple_echo_client(void) { - rk_socket_t s = INVALID_SOCKET; + rk_socket_t s = rk_INVALID_SOCKET; int rv; char buf[81]; int i; @@ -165,7 +165,7 @@ test_simple_echo_socket(void) return test_simple_echo_client(); } else { - rk_socket_t s = INVALID_SOCKET; + rk_socket_t s = rk_INVALID_SOCKET; fprintf (stderr, "[%s] Listening for connections...\n", prog); mini_inetd(htons(PORT), &s);