pkgdb2client: Allow low-level API calls
pkgdb2client: Support on-demand authentication

Login only when required by pkgdb, support specifying a callback to get
user name and password.