Debugging fd/client removal.

src/dest reversed in here caused issues, but this is now
correct. Adding an assert as to why we're still not
getting the right fd back from the LIST_FOREACH over
client_list, because that is where the problem now
lies.
Don't do math if you suck at it.
Clean out revents for new fds.

We have to make sure we don't enter new pollfds with random
values for revents as it will cause the client to immediately
disconnect if we forget to initialize. To make sure we don't
accept and immediately look for data, also force a new poll()
after accepting.
Read and cache client socket SMACK label

Signed-off-by: Shane Bryan <shane.bryan@intel.com>
Smack: clean up this code

- use a #define for the smack label thing we're using twice
- smack label retrieval is done when packets arrive, not before
- actually store cred info in the client struct
- check return value of malloc()
- unwind code and terminate if problems exist
- free client resources manually
Make 'client' local, rename it.
Rename new_client to cl, ->credentials to ->cred

Mostly reduces the tediously long and awkward names here.
exit with EXIT_FAILURE, not 1.
Always use true/false in bool comparisons
beginings of daemon test

The test is disabled now.  When it is enabled, it fails.  I'm merging
this so that we can pivot to how we deal with configuration to make
testing easier.

Signed-off-by: Michael Leibowitz <michael.leibowitz@intel.com>
Config: add --with-smack-load-file option

Signed-off-by: Shane Bryan <shane.bryan@intel.com>
Add serialiazation methods to Buxton

We'll use serialization internally from now on, this commit adds the helper
methods to serialize and deserialize a BuxtonData struct

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Convert gdbm to use serialized data

GDBM no longer stores the entire struct (with missing value for pointers)
in its database, rather it serializes the data first, and converts them
on the fly for set and get value, so the process is entirely transparent.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Fix accidental free of non-allocated memory

Currently retrieving a value that doesn't exist can result in a
free of d_string, which isn't actually allocated. This commit
ensures that we got a value from buxton before attempting
to free a string (if the type was indeed STRING)

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Add test to retrieve values from buxton

This test runs after buxton_client_set_value_check, and checks
whether the retrieved value and type are the same as the ones set,
and that we indeed did get a value back.

Confirmed to be working.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Update TODO list

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Fix possible memory corruption in gdbm module

There is the possibility that data corruption could cause the
buxton_deserialize function to fail for a value in the gdbm backend.
However, we must also ensure we still free the dptr which is malloc()d
by gdbm even if we're not going to convert the data.

Signed-off-by: Michael Ikey Doherty <michael.i.doherty@intel.com>
Merge branch 'master' of github.com:ikeydoherty/buxton