From b1063ea8fcfe5f8b0bbdc8d98dbeb7e186d70890 Mon Sep 17 00:00:00 2001 From: Asanka Herath Date: Wed, 22 Jul 2009 15:55:45 -0400 Subject: [PATCH] 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