Commit Graph

1887 Commits

Author SHA1 Message Date
Roland C. Dowdeswell
e8779d5d4a Add -Wshadow and deal with the warnings. 2012-02-21 11:17:55 +00:00
Roland C. Dowdeswell
cc47c8fa7b Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
We turn on a few extra warnings and fix the fallout that occurs
when building with --enable-developer.  Note that we get different
warnings on different machines and so this will be a work in
progress.  So far, we have built on NetBSD/amd64 5.99.64 (which
uses gcc 4.5.3) and Ubuntu 10.04.3 LTS (which uses gcc 4.4.3).

Notably, we fixed

	1.  a lot of missing structure initialisers,

	2.  unchecked return values for functions that glibc
	    marks as __attribute__((warn-unused-result)),

	3.  made minor modifications to slc and asn1_compile
	    which can generate code which generates warnings,
	    and

	4.  a few stragglers here and there.

We turned off the extended warnings for many programs in appl/ as
they are nearing the end of their useful lifetime, e.g.  rsh, rcp,
popper, ftp and telnet.

Interestingly, glibc's strncmp() macro needed to be worked around
whereas the function calls did not.

We have not yet tried this on 32 bit platforms, so there will be
a few more warnings when we do.
2012-02-20 19:45:41 +00:00
Nicolas Williams
8ce8cb509a Fix a compiler warning in lib/roken/snprintf.c on 32-bit Ubuntu 2012-02-16 18:47:58 -06:00
Roland C. Dowdeswell
88d3a31c17 make check fails if USER environment variable unset.
getxxyyy.c uses the USER environment variable to determine a user
to test getpwnam_r().  If this variable is unset then the test will
seg fault.  We work around this issue by defaulting to ``root'' if
USER is not set.  This is not perfect as root may not exist on the
system but given that user does exist on most systems, this is the
best default that we can choose if we have no other options available.
2012-02-14 09:30:05 +00:00
Nicolas Williams
f4ba41ebdd Pluggable libheimbase interface for DBs and misc libheimbase enhancements
[Code reviewed by Love Hörnquist Åstrand <lha@kth.se>]

    Added heim_db_*() entry points for dealing with databases, and
    make krb5_aname_to_localname() use it.

    The following enhancements to libheimbase are included:

     - Add heim_data_t and heim_string_t "reference" variants to
       avoid memory copies of potentially large data/strings.

       See heim_data_ref_create() and heim_string_ref_create().

     - Added enhancements to heim_array_t to allow their use for
       queues and stacks, and to improve performance.  See
       heim_array_insert_value().

     - Added XPath-like accessors for heim_object_t.  See
       heim_path_get(), heim_path_copy(), heim_path_create(), and
       heim_path_delete().  These are used extensively in the DB
       framework's generic composition of ACID support and in the
       test_base program

     - Made libheimbase more consistent with Core Foundation naming
       conventions.  See heim_{dict, array}_{get, copy}_value() and
       heim_path_{get, copy}().

     - Added functionality to and fixed bugs in base/json.c:
        - heim_serialize();
        - depth limit for JSON parsing (for DoS protection);
        - pretty-printing;
        - JSON compliance (see below);
        - flag options for parsing and serializing; these are needed
          because of impedance mismatches between heim_object_t and
          JSON (e.g., heim_dict_t allows non-string keys, but JSON
          does not; heimbase supports binary data, while JSON does
          not).

     - Added heim_error_enomem().

     - Enhanced the test_base program to test new functionality and
       to use heim_path*() to better test JSON encoding.  This
       includes some fuzz testing of JSON parsing, and running the
       test under valgrind.

     - Started to add doxygen documentation for libheimbase (but doc
       build for libheimbase is still incomplete).

    Note that there's still some incomplete JSON support:

     - JSON string quoting is not fully implemented;

     - libheimbase lacks support for real numbers, while JSON has
       it -- otherwise libheimbase is a superset of JSON,
       specifically in that any heim_object_t can be a key for an
       associative array.

    The following DB backends are supported natively:

     - "sorted-text", a binary search of sorted (in C locale), flat
       text files;

     - "json", a backend that stores DB contents serialized as JSON
       (this is intended for configuration-like contents).

    The DB framework supports:

     - multiple key/value tables per-DB
     - ACID transactions

    The DB framework also natively implements ACID transactions for
    any DB backends that a) do not provide transactions natively, b)
    do provide lock/unlock/sync methods (even on Windows).  This
    includes autocommit of DB updates outside transactions.

    Future DB enhancements may include:

     - add backends for various DB types (BDB, CDB, MDB, ...);

     - make libhdb use heim_db_t;

     - add a command-line tool for interfacing to databases via
       libheimbase (e.g., to get/set/delete values, create/copy/
       backup DBs, inspect history, check integrity);

     - framework-level transaction logging (with redo and undo
       logging), for generic incremental replication;

     - framework-level DB integrity checking.

       We could store a MAC of the XOR of a hash function applied to
       {key, value} for every entry in the DB, then use this to check
       DB integrity incrementally during incremental replication, as
       well as for the whole DB.
2012-02-05 16:26:32 -06:00
Nicolas Williams
6dd66df594 Make master build on Windows
Add strtoll()/strtoull() to lib/roken
    Add stdint.h to lib/roken (Windows only)
    Add logic to detect whether to use lib/roken's stdint.h based on
        Visual Studio version
    Add include of stdint.h in generated ASN.1 code
    Export missing symbols for 64-bit integers in lib/asn1
    Export missing symbols for FAST
    Add missing sources to kdc/NTMakefile
    Fix issue in kuserok
    Fix bsearch issues
2012-01-17 12:10:14 -06:00
Love Hornquist Astrand
0f9f9d3ab6 add strtoll.c 2012-01-10 22:54:16 +01:00
Love Hornquist Astrand
a11ca3cb1b add rk_getpwnam_r 2011-12-12 21:55:06 -08:00
Jeffrey Altman
269cf69f42 roken: posix errnos for windows
Several additional posix errnos are now used within Heimdal.
Add definitions for them.

With the introduction of VS2010 VC errno.h now includes definitions
for the full posix error number list.  Instead of mapping errno values
to Winsock errors, use the new VS2010 assignments.

Change-Id: Ieb7c5efbcbedb1c10d56e5c8a63ddd58a15df9b1
2011-09-23 09:06:02 -04:00
Love Hornquist Astrand
8e455dc774 dont use initstate/setstate 2011-09-21 17:38:21 +02:00
Love Hornquist Astrand
8badb652c6 drop __restrict to please old compilers 2011-09-21 17:34:51 +02:00
Love Hornquist Astrand
d931fd0a22 Free handle when done so that we don't leak memory
Memory leak reported by Craig Ruff
2011-08-31 11:46:37 -07:00
Love Hornquist Astrand
8861329d81 loop so that we can capture memory leaks 2011-08-31 11:45:47 -07:00
Love Hörnquist Åstrand
c26da364e8 drop dependency since we need the autoconf to overwrite this 2011-07-24 18:06:33 -07:00
Linus Nordberg
2e35198908 Add version-script.map to _DEPENDENCIES.
Added to 11 out of 14 directories with map files.  Not lib/ntlm,
lib/hcrypto and kdc which have the map file as an explicit dependency
to _OBBJECTS.

Signed-off-by: Love Hörnquist Åstrand <lha@h5l.org>
2011-07-24 14:07:59 -07:00
Jeffrey Altman
b7df4f8bb3 dirent: fix filespec_from_dir_path
If the path does not begin with a separator, do not advance
skip the first character in the component referred to by 'comp'.

Change-Id: Ide184ba2065bd8b2075be27b8e1f4cae11026fdd
2011-07-21 11:40:04 -04:00
Love Hörnquist Åstrand
7aaba443bc add NTMakefile and windows directories 2011-07-17 12:16:59 -07:00
Love Hörnquist Åstrand
4337582a64 add missing break, quiet clang analyzer 2011-06-19 10:28:51 -07:00
Love Hörnquist Åstrand
63565137d3 don't set i = 0, its never read 2011-06-14 21:57:34 -07:00
Love Hornquist Astrand
0879b9831a remove trailing whitespace 2011-05-21 11:57:31 -07:00
Thomas Klausner
97df66c0a0 Put Nd argument after Nd macro.
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2011-05-21 11:54:27 -07:00
Thomas Klausner
db8e287e41 Use "Fl Fl" for long options.
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2011-05-21 11:54:14 -07:00
Love Hornquist Astrand
5774dcfbd8 actually return datum with real content 2011-05-17 21:54:32 -07:00
Love Hornquist Astrand
f78cb2ca4b Only include myflags if we use HAVE_DB3 2011-05-17 21:48:33 -07:00
Love Hornquist Astrand
01f0a1f509 move tsearch.c to autodetection for libroken.la 2011-05-17 21:47:02 -07:00
Jeffrey Altman
e5bc391f2e roken: declare IN_LOOPBACKNET if necessary
Not all platforms provide a definition of
IN_LOOPBACKNET.  Let roken define it if it is otherwise
undeclared.

Change-Id: Ibbac2fc4045671237fae23119746b37afb3b83fb
2011-05-17 12:02:09 -04:00
Jeffrey Altman
e8aea380be Fix get_windows_size() on Windows
The committed implementation of get_windows_size() failed
to compile on the Windows platform.

'int ret' declaration is moved to avoid unused variable
warning.

Change-Id: I0f6ea4524db736d539b10c6bd7836a770a5e7058
2011-05-17 12:02:08 -04:00
Love Hornquist Astrand
b1909b2daa Fixes from NetBSD via Thomas Klausner and Roland C. Dowdeswell 2011-05-04 21:31:10 -07:00
Love Hornquist Astrand
9a1a5e5da6 Mandoc and spelling fixes from Thomas Klausner 2011-04-29 20:37:33 -07:00
Love Hornquist Astrand
f5f9014c90 Warning fixes from Christos Zoulas
- shadowed variables
- signed/unsigned confusion
- const lossage
- incomplete structure initializations
- unused code
2011-04-29 20:25:05 -07:00
Love Hornquist Astrand
81a03fafd2 is rk, not rx 2011-04-14 13:08:16 -07:00
Derrick Brashear
988355d9d0 roken: Make tsearch build on windows
no sys/cdefs.h on windows
2011-04-10 21:49:48 +01:00
Love Hornquist Astrand
36f9851a4e remove tsearch manpage 2011-04-09 18:30:58 -07:00
Derrick Brashear
2a32bf67f0 Add tsearch and friends, and a test program
tsearch is missing from windows. use the netbsd version as it's
license-compatible.
2011-04-08 15:15:36 +01:00
Simon Wilkinson
a597ccdde6 roken: Rename gettimeofday replacement
All replacement roken functions are named rk_blah to avoid symbol
collisions. gettimeofday wasn't being renamed in the header, so fix
that.

This doesn't change the soname of the resulting library, as gettimeofday
isn't currently exported.
2011-04-05 19:44:11 +01:00
Love Hornquist Astrand
3c241aef9e don't undefined SLIST 2010-12-12 11:45:53 -08:00
Asanka C. Herath
e4d2d78a21 Condition roken's ssize_t definition for compatibility
If SSIZE_T_DEFINED macro is defined, assume we already have ssize_t.
2010-12-03 01:12:32 -05:00
Asanka C. Herath
d4f1d0e900 Canonicalize the program name if necessary in setprogname() 2010-11-29 13:32:24 -05:00
Love Hornquist Astrand
987faedb80 add random abstraction 2010-11-29 09:31:07 -08:00
Love Hornquist Astrand
bad0e733c5 less exit with failures 2010-11-29 09:31:07 -08:00
Love Hornquist Astrand
a2b45360c2 add random_init 2010-11-29 09:31:07 -08:00
Love Hornquist Astrand
a2345c5159 remove debug printing 2010-11-27 18:59:17 -08:00
Love Hornquist Astrand
beedb73f80 print roken.h so we ca see what's happening 2010-11-27 18:21:16 -08:00
Asanka C. Herath
e412b8c511 Don't override build environment with header files in roken 2010-11-25 23:51:42 -05:00
Asanka C. Herath
d4379e27de Windows: Interlocked ops work on LONGs
Therefore change the type of the TLS slot id to LONG.
2010-11-24 15:33:35 -05:00
Asanka C. Herath
bd6e3ff7c9 Provide a stdbool.h in roken 2010-11-24 15:33:34 -05:00
Asanka C. Herath
0ae44152b7 Windows: Set error mode before calling LoadLibrary()
Unless SEM_FAILCRITICALERRORS is set, Windows may pop-up a dialog box
if the specified module cannot be loaded.  This is not appropriate for
unattended or batch processes.
2010-11-24 15:33:20 -05:00
Asanka C. Herath
538c7ce29c More compatibility macros
Undefine SLIST_ENTRY to avoid conflict with WinNT.h

Define AI_NUMERICSERV for platforms that don't define it.
2010-11-24 15:33:15 -05:00
Asanka C. Herath
d11917211b Windows: Older Windows SDKs need <winsock2.h>
Older SDKs need <winsock2.h> to be included before <ws2tcpip.h>
2010-11-24 15:33:06 -05:00
Asanka C. Herath
1e365190d0 Windows: Manage thread local storage manually in dlfcn_w32 2010-11-24 15:32:51 -05:00