Refactor userinfo test suite

Separate the tests into a function so that we will later be able
to call them twice, once using JSON and once without.

Change-Id: I6717e864f3a8b714e38f3e209dd0eba74a812b71
Reviewed-on: https://gerrit.stanford.edu/1590
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Enable JSON testing and fix one minor bug

Enable testing of the new JSON support in the user information
service, and fix one minor bug that surfaced in that testing.
The JSON code now produces results equivalent to the non-JSON
code.

Change-Id: If037f546d0e7a61f6707a28601e9fd4443d92adb
Reviewed-on: https://gerrit.stanford.edu/1591
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Close memory leak on user information service failure

Make sure that we free the JSON-encoded argument before returning
the error.

Change-Id: Ic3f9942896022a7b979b3eb63f4cc674c9bbea87
Reviewed-on: https://gerrit.stanford.edu/1592
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Ignore a memory leak in MIT Kerberos mechlist initialization

This is a real, if small, leak, but it's in the MIT Kerberos GSS-API
implementation, so there's nothing other code can do about it.

Change-Id: Iaa41282508b809eeca4bf2c40c583a7ddbd0a371
Reviewed-on: https://gerrit.stanford.edu/1593
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Remove unused JSON test files

I never ended up using the generic success and failure test files.

Change-Id: Ia15fd11eb503e19d807c85ab2143552ea01f3926
Reviewed-on: https://gerrit.stanford.edu/1594
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Fix userinfo test suite for JSON, fix various issues revealed

The test suite wasn't actually being run due to a logic error.
Correct that issue and fix various issues uncovered by the test
suite.

Change-Id: I64d21e33456db1c64ddf0db82be8b3fabe507530
Reviewed-on: https://gerrit.stanford.edu/1595
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Attempt multifactor tests twice, with and without JSON

For further testing of the JSON user information service, run all
the multifactor login tests twice, once with XML and once with
JSON.

Change-Id: I08c06a174e1eaa657cb70828ad62b8506d12c470
Reviewed-on: https://gerrit.stanford.edu/1596
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Fix skipped test count in userinfo tests

When userinfo tests failed, the number of tests skipped was often
not correct.  Fix most (but possibly not all) of the counts.

Change-Id: Iacd908be23c095f399634b4c37346f7a3a205804
Reviewed-on: https://gerrit.stanford.edu/1597
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Refactor userinfo code

Separate the remctl support, XML parsing, and JSON parsing into
separate source files to make each source file more comprehensible.

While doing this, stop always sending ip to the user information
service in the JSON protocol.  Now that we have a protocol that can
handle optional arguments easily, don't send ip if we don't have an
IP address.

Change-Id: I956e926dbaee5a742d80b0d5a27ffeda1456a7bf
Reviewed-on: https://gerrit.stanford.edu/1598
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Make perltidy happy with cmd-webkdc-json formatting

Change-Id: Ibe8880aa047c28feaddc82038589de0cf5878041
Reviewed-on: https://gerrit.stanford.edu/1599
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Use macros to clean up JSON parsing

Add a set of macros that do proper return status checking, and
make use of those to make the JSON parsing code less horrible
and more succinct.

Change-Id: I5fbee0733d1320e94212c9ea78f58dbef505545e
Reviewed-on: https://gerrit.stanford.edu/1600
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Refactor JSON argument construction with macros

Add macros that wrap the error checking when building JSON objects
and that correctly free temporary objects.  Use that to restructure
the command construction so that it shouldn't leak memory and is
much easier to read.

Change-Id: Ic60d73a9c2b6646740528feb9aca6215d492ba6e
Reviewed-on: https://gerrit.stanford.edu/1601
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Refactor JSON command construction

Avoid some duplicate code by pulling out the mechanics of building
the argv vector into a separate function.

Change-Id: I7c2716140cb305dd99febbb2118cf6a9f9dd9236
Reviewed-on: https://gerrit.stanford.edu/1602
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Bump shared library versioning

The addition of the new json flag in the user information service
configuration will force this, and I plan on changing the API for
the user information service calls as well.

Change-Id: I0617dd16d8a0e55049916e449c8050d1dfa48b99
Reviewed-on: https://gerrit.stanford.edu/1603
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Update HACKING with further steps in the release process

Document bumping the shared library versioning and the Debian
package build step.

Change-Id: I5abe7939a34d02f0b0336b462f034f1b6de1cdaf
Reviewed-on: https://gerrit.stanford.edu/1604
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Add a note about possible Kerberos APIs for ticket serialization

Peter Mogensen pointed out MIT Kerberos APIs that can be used to
serialize a ticket in a native format, which would be a nice
replacement for our home-grown serialization format.  Add a note
about that to TODO.

Change-Id: I3474b97b71e46c23e92a735427f6e6887925d412
Reviewed-on: https://gerrit.stanford.edu/1605
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>
Fix the title of the Libtool versioning chapter in HACKING

Change-Id: Idd00dfaa3078fbb6ccc9a93c198e57c1cd2d75cd
Reviewed-on: https://gerrit.stanford.edu/1606
Reviewed-by: Russ Allbery <rra@stanford.edu>
Tested-by: Russ Allbery <rra@stanford.edu>