2003-02-13  Tambet Ingo  <tambet@ximian.com>

	* rcd-package-locks.c: Add locking sequnece number.
	(rcd_package_locks_get_sequence_number): Implement.
	(rcd_package_locks_save): Implement, increase seq. number.

	* rcd-rpc-packsys.c (rcd_rpc_packsys_register_methods): Register
	packsys.lock_sequence_number method.
	(packsys_lock_sequence_number): Implement.

2003-02-11  Joe Shaw  <joe@ximian.com>

	* rcd-transfer-http.c (map_soup_error_to_rcd_transfer_error): Get
	the error phrase from message->errorphrase instead of calling
	soup_error_get_phrase() because we'll get more detailed info from
	it.  (Like "Unable to resolve hostname" instead of "Can't
	connect").

2003-02-11  Joe Shaw  <joe@ximian.com>

	* rcd-query-packages.c (summary_match, description_match,
	text_match): Guard against the possibility of NULL summaries and
	descriptions.  I actually have a package installed without a
	description tag which was causing rcd to crash.

2003-02-11  Joe Shaw  <joe@ximian.com>

	* rcd-transfer-http.c (map_soup_error_to_rcd_transfer_error): Fix
	a buglet where if a transfer failed it would print the proxy URL
	(or "(null)") instead of the real URL.

2003-02-04  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c (rcd_cache_entry_set_modification_time,
	rcd_cache_entry_set_entity_tag): Free the old one, fix a leak.

2003-02-04  Jon Trowbridge  <trow@ximian.com>

	* rcd-fetch.c (rcd_fetch_news): Clear the cached news before
	fetching.
	(rcd_fetch_news_local): Clear the cached news before fetching.
	(fetch_icon_cb): Don't leak the icon's local filename.

	* rcd-news.c (rcd_news_clear): g_slist_free after the loop
	finishes, not inside the loop.  This would have been a crasher,
	but luckily this function was never called.

	* rcd-transaction.c (rcd_transaction_status_ref): Add a paranoid
	check of status->refs.
	(rcd_transaction_status_unref): Add a paranoid check of
	status->refs.

2003-01-31  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (rcd_transaction_status_unref): g_slist_free()
	the package lists after unreffing them.
	(rcd_transaction_begin, rcd_transaction_log_to_server):
	g_slist_copy() the install_packages and remove_packages lists
	coming in so they don't get freed from out underneath us.

2003-01-29  Joe Shaw  <joe@ximian.com>

	* rcd-privileges.c (rcd_privileges_init): Add a "lock" privilege
	to the base privileges.

	* rcd-rpc-packsys.c (rcd_rpc_packsys_register_methods): Make
	rcd.packsys.add_lock() and rcd.packsys.remove_lock() require the
	"lock" privilege, not the "subscribe" privilege.

2003-01-29  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (verify_packages): Check our trusted privilege
	before we send a message to the client.  If we're trusted, tell
	the user that when we say that the package is unsigned or we
	cannot verify.

2003-01-28  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.c: If the user can't be authenticated over HTTP, we
	should send an HTTP 401 code back instead of an XML-RPC fault.
	(soup_auth_callback): Move the authentication code into here.  If
	we fail, return FALSE which will reissue the HTTP auth challenge
	to a client.
	(soup_rpc_callback): This function becomes a lot simpler since it
	doesn't handle authentication any longer.  If we get the MID as
	the user, set up an identity with name "server" and superuser
	privileges, otherwise get it from the password file and assert
	that an identity exists.  (It must, since we passed
	authentication).

2003-01-28  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-users.c (users_get_current_user): Return the current
	user, so clients don't have to muck around with the transport.
	(users_update): Fix a mis-pointered RCDPrivileges declaration.
	(rcd_rpc_users_register_methods): Register
	rcd.users.get_current_user.

2003-01-28  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-users.c (users_update): Handle our own privilege
	authorization here, so we can allow users to change their own
	passwords.  Throw a permission denied fault if the user isn't a
	superuser and the usernames don't match or a user tries to change
	his own privileges.
	(rcd_rpc_users_register_methods): Change the required privs to
	NULL, since we handle them in the method itself.

2003-01-25  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (packsys_find_dangling_requires): Added a new
	method that walks across the requirements list of every package
	and checks to make sure that some other package provides that
	requirement.  We return a list of packages and requirements for
	which this is not the case.

	* rcd-about.c (rcd_about_copyright): Updated copyright string.

2003-01-24  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (packsys_rollback_dependencies): Make the
	rollback channel silent.

	* rcd-rpc-users.c (users_sequence_number): Added.  A method for
	returning the identity sequence number.
	(rcd_rpc_users_register_methods): Register the
	rcd.users_sequence_number method.

	* rcd-identity.c: Added a static guint for storing the
	identity-change sequence number, which can be used to detect
	changes to users and permissions.
	(rcd_identity_update_password_file): Increment the identity
	sequence number.
	(rcd_identity_remove_from_password_file): Increment the identity
	sequence number.
	(rcd_identity_get_sequence_number): Added.  Returns the identity
	sequence number.

2003-01-23  Jon Trowbridge  <trow@ximian.com>

	* rcd-identity.c (write_identity): Oops!  -1 (aka
	(gint64)~(guint64)0) is already used internally by the
	RCDPrivileges code to represent superuser privileges.  So that
	means that due to the last change, it is no longer possible to
	make anyone a superuser.  Fixed by replacing -1 with a magic
	symbol, RCD_PRIVILEGES_UNCHANGED.
	
	* rcd-rpc-users.c (users_update): Set id->privileges to
	RCD_PRIVILEGES_UNCHANGED.

	* rcd-privileges.h: #define RCD_PRIVILEGES_UNCHANGED to be
	a something safe (i.e. != -1).

2003-01-22  Joe Shaw  <joe@ximian.com>

	* rcd-identity.c (write_identity): Make -1, not 0, mean "no
	changes" when writing out the password file to disk.  Fixes
	#36257, in which you couldn't take all users' privileges away.

	* rcd-rpc-users.c (users_update): Set id->privileges to -1, not 0.

2003-01-20  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c: Added 'channels_to_install' field to RCDAutopull
	struct.
	(install_whole_channel_cb): Added.  Iterator function for
	installing entire channel.
	(rcd_autopull_find_targets): Process the list of channels to
	install.
	(rcd_autopull_unref): Free the list of channels to install.
	(rcd_autopull_new): Initialize the list of channels to install.
	(channel_from_xml_props): Support check for the
	'install_everything' property.
	(channel_from_xml_props): Fix some out-of-order debug spew.
	(We were spewing a value before computing it, which was not
	particularly helpful.)
	(channel_from_xml_node): Support checking for the
	'install_everything' property.
	(package_from_xml_node): Pass NULL as the second argument
	to channel_from_xml_props, explicitly ignoring the
	'install_everything' property.
	(rcd_autopull_xml_contains_unknown_channels): Ditto.
	(autopull_from_session_xml_node): Check for the 'install_everything'
	property in a channel tag.  If it is present, add the channel
	to our list of channels to install.  (The channel will also be
	updated.)

2003-01-20  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c, rcd-transfer-http.c: If we ever have problems
	with the URL returned from rcd_prefs_get_proxy(), show the URL to
	the user from rcd_prefs_get_proxy_url().

2003-01-15  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-util.c (rcd_rc_channel_to_xmlrpc): Export the
	"transient" flag so it's easier for clients to determine what
	channels can be unmounted.

2003-01-14  Joe Shaw  <joe@ximian.com>

	* rcd-module.c (load_module): Add module versioning.  Read the
	rcd_module_major_version and (optionally) rcd_module_minor_version
	symbols out of the module and complain if they're not there or
	insufficient.

	* rcd-rpc-sample.c, rcd-autopull.c: Add rcd_module_major_version
	and rcd_module_minor_version symbols and assign them to
	RCD_MODULE_MAJOR_VERSION and RCD_MODULE_MINOR_VERSION
	respectively.

	* rcd-rpc-prefs.c (rcd_rpc_prefs_register_pref): Add a category
	argument which helps clients categorize the various daemon
	options.

2003-01-10  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c (rcd_prefs_set_require_verified_certificates): Use
	soup_set_ssl_ca_file() instead of _ca_dir() because the latter
	sucks.

	* rcd.c (main): Ditto.

2002-12-20  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (refresh_channels_cb): We don't want to
	recurse refreshing channels during multiple heartbeats due to a
	time warp.

	* rcd-rpc.c (rcd_rpc_server_start): Get the host to bind to first
	from the command-line, then from rcd.conf.

	* rcd.c (option_parsing): Add -i for binding to only one network
	interface and --version because we didn't have it before.
	(main): If --version is passed, print out version and copyright
	info and exit happily.

2002-12-17  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c (rcd_autopull_resolve_and_transact): We need to
	send a log message back to the server, even if no action is
	necessary.  (Fixes bug #35743)

	* rcd-transaction.c (rcd_transaction_begin): If the transaction is
	empty, just send a success message back to the server.

	* rcd-recurring.c (rcd_recurring_execute): Removed an unused
	variable's declaration.

	* rcd-autopull.c: Include rcd-rpc.h to get rid of a compiler
	warning.

2002-12-14  Jon Trowbridge  <trow@ximian.com>

	* rcd-recurring.c (rcd_recurring_execute): If the RCDRecurring
	doesn't have a 'next' method, treat it as a non-recurring
	action.

2002-12-12  Joe Shaw  <joe@ximian.com>

	* rcd-autopull.c (rcd_module_load): Register an
	rcd.autopull.refresh RPC method.
	(autopull_refresh): Implement the method.

2002-12-10  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c (rcd_prefs_set_repackage): Added.

	* rcd-rpc-prefs.c (rcd_rpc_prefs_register_pref): Check to see if
	our packman handles repackaging and register the repackage pref if
	so.

	* rcd-transaction.c (run_transaction): Get whether we can
	repackage before we can transact and use it throughout to avoid a
	minor race.

	* rcd-rpc-packsys.c (dep_get_package_info_cb): Change "replaces"
	to "replaced by" and "depends on" to "depended on".

2002-12-10  Frank Belew  <frb@ximian.com>

	* rcd.c: added #ifdef NEED_KERNEL_FD_WORKAROUND and appropriate line
	of code

2002-12-09  Joe Shaw  <joe@ximian.com>

	* rcd.c: Add a --no-modules flag which does what you think it does.

2002-12-09  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c (rcd_autopull_fetch_channel_list): Re-load
	our subscriptions after fetching the channel list.  (Fixes
	bug #33387)

2002-12-06  Joe Shaw  <joe@ximian.com>

	* rcd-transfer.[ch]: Add a new transfer error,
	RCD_TRANSFER_ERROR_NETWORK_DISABLED.

	* rcd-transfer-http.c (http_open): If no_network is set, immediate
	set an error of NETWORK_DISABLED.

	* rcd.c (option_parsing): Add a no-networking command-line option.
	(initialize_data): Check to make sure no_network is not set before
	getting channel list, channel data, and news from the local cache.

2002-12-06  Joe Shaw  <joe@ximian.com>

	* rcd.c (daemonize): Write out the pidfile to /var/run/rcd.pid and
	set up a shutdown handler to remove it when we quit.

2002-12-05  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (refresh_channels_cb): I've changed the order
	that things happen.  First we refresh the transient channels.
	Next we download the channel list from the server, and the finally
	we refresh the persistent channels.  This insures that the
	transient channels (i.e. the mounted channels) get refreshed
	even if the network is not available.  (Fixes #34702)

	* rcd-fetch.c (rcd_fetch_some_channels): Added.  Allow
	finer-grained selection of the channels to be fetched.
	(rcd_fetch_all_channels_local): Changed to just call
	rcd_fetch_some_channels w/ the appropriate flags.
	(rcd_fetch_all_channels): Ditto.

2002-12-05  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_rollback_dependencies): Create the
	temporary rollback channel with a very high priority so that
	dependencies are pulled from that channel first.  Add a lame hack
	which sets the "package_filename" field on the XML-RPC struct,
	since the rollback channel is temporary only for dependency
	resolution and the XML-RPC struct references the channel by id
	which won't exist when it comes time to install the packages.

2002-12-04  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_register): Also enable premium mode when
	activating and getting the X-RC-Host header.

2002-12-04  Jon Trowbridge  <trow@ximian.com>

	* rcd-unix-server.c (read_data): If our iochannel has an error
	condition set, free our handle and stop watching the channel.
	(conn_accept): Watch for non-standard conditions (G_IO_ERR,
	G_IO_HUP, G_IO_NVAL) on our iochannel.

2002-12-03  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_register): After activating, if the
	X-RC-Host header is set, set the machine's host to that value.

2002-12-03  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-util.c (rcd_rc_package_from_xmlrpc_package): Don't
	bother looking at the installed bit at all.  If the channel id is
	set, always look for the package in that channel.  Otherwise, fall
	back onto the system packages.  Should fix a crash when you try to
	install a package from a channel that's already installed.

2002-12-03  Joe Shaw  <joe@ximian.com>

	* rcd.c (daemonize): Change our CWD to / after forking.  Spotted
	my Mike MacDonald.

2002-12-03  Jon Trowbridge  <trow@ximian.com>

	* rcd-transaction.c (rcd_transaction_begin): If we don't need to
	download anything, launch an idle function to call verify_packages
	instead of calling it directly.  This allows the call to
	rcd_transaction_begin to return immediately, instead of making us
	wait for the (sometimes lengthy) verification process to finish.

2002-12-02  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Install a bunch of headers that might be useful to
	modules.

	* rcd-module.c (rcd_module_debug): Added.  Thin wrapper around
	rc_debug() so modules don't need to pull in libredcarpet.

	* rcd-prefs.c (rcd_prefs_{get|set}_{string|int|boolean}): Added.
	Generic functions for modules to use rcd.conf.

	* rcd-query.h: Include <glib.h>, not "libredcarpet.h"

	* rcd-rpc-prefs.h: Kill the _full function for registering prefs;
	they don't seem all that useful and it keeps modules from needing
	to link against xmlrpc-c.

	* rcd.c (main): Initialize modules before initializing the data.

2002-11-22  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (add_rollback_packages): Initialize the GError
	to NULL.  Set the dirty flag on the directory if there's an
	invalid package file in there.

2002-11-22  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-util.c (rcd_rc_package_from_xmlrpc_package): Always deal
	with package_data and package_filename fields first, so that we
	always return a package created with rc_packman_query_file() and
	not potentially a system package.  This will fix a crash when
	trying to install packages that are already installed on the system.

2002-11-22  Jon Trowbridge  <trow@ximian.com>

	* rcd-transaction.c (fail_transaction): Send the log, even if
	flags are set.
	(download_completed): Send the log in the event of a download
	failure, even if flags are set.
	(run_transaction): Send the log, even if this is a dry run.

2002-11-20  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c: (struct _RCDAutopull): Added the "dry_run" flag.
	(get_removal_failure_info): Broke up a few lines to keep the
	source code < 80 chars/line.
	(rcd_autopull_resolve_and_transact): If this is a dry run, set the
	appropriate flags and pass them into any calls to
	rcd_transaction_log_to_server (when reporting dependency failures)
	and rcd_transaction_begin (when actually doing the transaction).
	(autopull_from_session_xml_node): If the dry_run property is set
	to a non-zero value in the session tag, set the dry_run flag
	in the RCDAutopull struct.

	* rcd-transaction.c (transaction_xml): When constructing the XML
	to pass back to the server, report whether or not the
	RCD_TRANSACTION_FLAGS_DRY_RUN flag is set.
	(rcd_transaction_log_to_server): Add an argument for passing
	in the RCDTransactionFlags.

2002-11-20  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c (rcd_prefs_get_host): Get rid of RCX_MAGIC and
	RC_MAGIC.  Everyone should just use the host preference instead.
	(rcd_prefs_get_proxy): If the proxy URL is invalid, return the
	invalid string instead of NULL so rcd-transfer can handle it and
	abort properly.

	* rcd-transfer-http.c (http_open): If we have a proxy_url but
	can't get a proxy_context from Soup, then the URI is invalid and
	set an error as such.

	* rcd-transfer.c (rcd_transfer_begin_blocking): If
	rcd_transfer_begin() returns -1, don't run the main loop.

2002-11-14  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-util.c (rcd_xmlrpc_to_rc_package_dep): Sniff out debian
	or-deps and pass them to rc_package_dep_new_from_spec().

2002-11-13  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c (rcd_cache_entry_close, rcd_cache_entry_cancel):
	Reset the fd field back to -1 after closing.
	(rcd_cache_entry_open): Add a precondition requiring the fd field
	be -1.

	* rcd-transfer-http.c (http_info): Change the conditional for
	opening a cache entry to only do it on a 200-class (Sucessful)
	response.  Before we were opening a cache entry on things that we
	shouldn't have been (like 302 Found) and occasionally leaking fds
	(for things like 302 Found and then 200 OK)

2002-11-11  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.c (rcd_rpc_init): Tune the maximum size of the XML-RPC
	requests so we can handle extremely large requests better.

2002-11-08  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (run_transaction): Remove the lock check and
	lock call from here.
	(verify_packages): Move it into here.  Instead of doing it
	manually, call fail_transaction() whenever anything goes wrong and
	unlock the transaction lock

	* rcd.c (rehash_data): If the transaction isn't locked, call
	initialize_data().  Otherwise, (if not already there) set a
	timeout to call itself again until we can successfully rehash our
	data.  Prevents nasty reentrancy during transactions.

2002-11-08  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_get_channel_icon): If the channel
	just doesn't have an icon, throw a fault before we go around
	dereferencing NULL pointers.  Also fix a potential leak.
	(parse_rollback_package_array): Fix the formatting of a thrown
	fault.

2002-11-06  Joe Shaw  <joe@ximian.com>

	* rcd.c (debug_message_handler): When logging rcd-messages,
	prepend a timestamp.  When logging to syslog, add the pid to the
	name when calling openlog() to be more consistent with other apps,
	and don't put it in the message itself.

2002-11-06  Joe Shaw  <joe@ximian.com>

	* rcd.c (option_parsing): Move debug_level and syslog_level out of
	here and make them global options.  Don't call
	rcd_prefs_set_{debug|syslog}_level() since we don't want the
	command-line option to get saved to disk.

	* rcd-prefs.c (rcd_prefs_get_{debug|syslog}_level): If the global
	debug_level or syslog_level option isn't -1, return its value,
	otherwise get it from the config file.
	(rcd_prefs_set_{debug|syslog}_level): Reset the global debug_level
	or syslog_level option, so that setting the level overrides the
	level passed in at the command-line.

2002-11-05  Joe Shaw  <joe@ximian.com>

	* rcd-query.c (rcd_query_match_string, rcd_query_match_string_ci):
	Allow globbing in string equality searches.

2002-11-01  Jon Trowbridge  <trow@ximian.com>
 
 	* rcd-rpc-system.c (system_get_recurring): Added.  An xml-rpc
 	function that returns a list of all of the pending recurring
 	actions.
 	(rcd_rpc_system_register_methods): Register our new method.
 
 	* rcd-heartbeat.c (rcd_heartbeat_start): Set the recurring's label
 	function to NULL.
 
 	* rcd-autopull.c (rcd_autopull_new): Set the recurring's label
 	function to NULL.
 	(recurring_autopull_xml_fetch_init): Ditto.
 
 	* rcd-recurring.c (rcd_recurring_get_label): Added.
 	(rcd_recurring_execute): Store last execution time and increment
	execution counter.

2002-11-01  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-prefs.c: Fix up some sucky descriptions

2002-10-24  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_rollback_dependencies): After we tear
	down our temporary rollback channel, reset the channel field on
	all its packages to NULL.

2002-10-23  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (refresh_channels_cb): If the distro isn't
	supported or deprecated, don't refresh channel data.

2002-10-22  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (transaction_step_cb): Update the
	transaction_pending with the sequence number.

2002-10-21  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_packages_abort): Unref all of the queued
	transfers before the running transfers.  Don't free the closure,
	that'll be done after the last running transfer is cancelled.

	* rcd-rpc-util.c (rcd_rc_package_from_xmlrpc_package): If the
	installed bit is set on the package, get it out of the system
	packages in the world.

	* rcd-transaction.c (rcd_transaction_status_unref): Set the
	"status" field on the download_pending to NULL so we don't point
	at a junk pointer.

2002-10-22  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-util.c (assemble_spec): When processing an xmlrpc struct
	into a RCPackageSpec, check for a "version_str" field.  If it is
	found, use rc_packman_parse_version to extract the EVR from that
	string.

2002-10-18  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (packsys_search_by_package_match): Initialize
	an uninitialized variable.

2002-10-17  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (initialize_data): Move the call to rcd_package_locks_load
	here from in initialize_rc_world... if we load the packages before
	the channel data has been fetched, we are unable to resolve the
	channel IDs in the locks to RCChannel objects and things go
	downhill from there.

	* rcd-rpc-packsys.c (packsys_search_by_package_match): Added.
	(packsys_remove_lock): Added.
	(rcd_rpc_packsys_register_methods): Register our new methods.

2002-10-16  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c: Remove the Soup crash workarounds.
	(package_completed_cb): Only remove from the hash table and free the
	closure if we have no more running or queued transfers.
	(rcd_fetch_packages_abort): Remove from the hash table and free
	the closure after we're done aborting transfers.

	* rcd-transaction.c (download_packages): Start the download
	pending object before checking disk space, so we can fail it if we
	don't have enough.  Don't unref the packages_to_download list, as
	that's done by cleanup_after_transaction() via fail_transaction().

2002-10-16  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c: RCX_ACTIVATION_ROOT should be https.

	* rcd-prefs.c (rcd_prefs_{set|get}_require_verified_certificates):
	New preference for whether we need to verify SSL certificates.
	Defaults to on (obviously).

	* rcd-rpc-prefs.c: Allow the above to be get/set by superuser.

	* rcd-transfer-http.c (http_open): If we're in HTTP 1.0 mode, set
	Connection: close explicitly.

	* rcd.c (main): If we require verified certificates, set the Soup
	CA dir.

2002-10-15  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-users.c (users_update): Allow the "-*-unchanged-*-"
	token through, even though it isn't a well-formed md5ified
	password.

2002-10-15  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_register): Make this return a gboolean,
	TRUE on success.  Take two arguments: the activation code and
	email address for handling activation as well as registration.
	If we're already in premium mode, connect to the current server.
	Otherwise connect to activation.rc.ximian.com.  Don't send out a
	(nonexistent) org id if we're activating.  Do send out the
	activation code and email, however.

	* rcd-rpc-system.c (system_activate): Added.  Takes an activation
	code and email and activates the system with them.
	(rcd_rpc_system_register_methods): Register rcd.system.activate.

	* rcd.c (initialize_data): Call rcd_fetch_register() with NULL for
	the activation code and email.

2002-10-15  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.c (soup_rpc_callback): Allow the server to call to the
	client by authenticating with the mid and the shared secret.

2002-10-11  Joe Shaw  <joe@ximian.com>

	* rcd-heartbeat.c (rcd_heartbeat_start): Don't start the heartbeat
	if it's disabled.

	* rcd-prefs.c (rcd_prefs_set_heartbeat_interval): Allow a value of
	0, which means that the heartbeat is disabled.  Start or stop the
	heartbeat if necessary.

	* rcd-rpc-users.c (users_has_privilege): Add a
	rcd.users.has_privilege() method which checks to see if the user
	making the call has the specified privilege.

2002-10-10  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Add rcd-rollback.[ch] to the build.

	* rcd-fetch.c (package_completed_cb): If the "is_signature" flag
	is set, set the signature_filename field instead of the
	package_filename.
	(download_package_file): If is_signature is set on the func, set
	it on the transfer object.
	(rcd_fetch_packages): Set is_signature appropriately.

	* rcd-prefs.c (rcd_prefs_get_repackage): Add a pref for
	repackaging.

	* rcd-rollback.[ch]: Added.  Maintains a manifest of the available
	packages to rollback.

	* rcd-rpc-packsys.c (packsys_rollback_dependencies): Added.
	Creates a temporary channel for the rollback packages, looks up
	the packages specified, and does a dependency resolution on them.
	(packsys_get_rollback_packages): Returns a list of the rollback
	packages.
	(rcd_rpc_packsys_register_methods): Add in the rollback functions.

	* rcd-rpc-util.c (rcd_xmlrpc_array_copy): Copies (and
	concatenates) xmlrpc arrays.

	* rcd-transaction.c (run_transaction): If the repackaging
	capability is set and repackaging is enabled, create and set up a
	temporary directory to put the repackaged packages.  After the
	transaction has finished, add the repackaged packages to the
	rollback list.
	(check_package_integrity): Call rc_packman_get_error() after
	verifying since that's the right thing to do.  Shuffle things
	around a little bit to deal with broken repackaged rpms.

2002-10-10  Jon Trowbridge  <trow@ximian.com>

	* Makefile.am: Add rcd-package-locks.h and rcd-package-locks.c to
	the build.

	* rcd-package-locks.h:
	* rcd-package-locks.c: Added.  Contains code to load/save lists
	of locks as XML.

	* rcd-fetch.c (remove_channel_cb): Don't remove channels that have
	refresh magic.
	(rcd_fetch_channel): If a channel has refresh magic, use it.
	(rcd_fetch_channel_local): Ditto.

	* rcd-rpc-packsys.c (packsys_get_locks): Added.
	(packsys_add_lock): Added.
	(packsys_mount_directory): Added.
	(packsys_unmount_directory): Added.
	(rcd_rpc_packsys_register_methods): Register our new xmlrpc
	methods.

	* rcd-rpc-util.c (rcd_rc_package_match_to_xmlrpc): Added.
	(rcd_xmlrpc_to_rc_package_match): Added.
	(rcd_rc_package_to_xmlrpc): Set the "locked" attribute indicating
	whether or not the package is locked.

2002-10-08  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_distro): Make this return a gboolean,
	TRUE on success.

	* rcd.c (main): If rcd_fetch_distro() returns FALSE, throw an
	error and abort.

2002-10-01  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c (rcd_cache_entry_get_modification_time): Use %Z
	instead of %z so we get "GMT" instead of "+0000" to be truly RFC
	1123 compliant.
	(rcd_cache_lookup): If our initial lookup in our in-memory cache
	fails, create an entry if the file exists on the local disk and
	use it.

2002-10-01  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c: Get rid of the HAVE_STATVFS conditionals.
	Linux has it too, and it works just as we expect it, so just use
	it everywhere since that's what Solaris has too.

	* rcd-unix-server.c: Add conditionals for HAVE_SO_PEERCRED, so we
	don't try to verify credentials on Solaris, which doesn't have
	them.  Also work around Solaris's crappiness by moving the socket
	from /var/run/rcd to /var/run/rcd/rcd, since Solaris lets anyone
	write to unix domain sockets they can see, regardless of
	filesystem permissions.

	* rcd.c: Define POPT_TABLEEND if it isn't already.  Fix a compiler
	warning on Solaris.

2002-09-30  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (extra_dump_info): Also dump out the host URL,
	whether it's a premium server, and the proxy URL.

2002-09-26  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_channel_list_local): Clean out the
	world's channels before we add our own.

2002-09-25  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (fail_transaction): Make this call
	cleanup_after_transaction() so we don't leak RCDTransactionStatus
	objects.
	(download_packages): If the package we're installing is a local
	one and the integrity of a package can't be confirmed, we have to
	fail the transaction, since we can't fallback to one from the
	'net.  Fix a refcount leak in the case where we fail due to
	insufficient disk space.
	(rcd_transaction_begin): Because fail_transaction() calls
	cleanup_after_transaction() which unrefs the status, we have to
	ref it before we actually start the transaction and unref it after
	we're done using it.

2002-09-24  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c (rcd_autopull_fetch_channel_list): Pass along the
	return value from the call to rcd_fetch_channel_list.
	(process_xml_cb): Fix the signature of this function so we don't
	get a type warning.
	(rcd_autopull_xml_contains_unknown_packages): Scan the autopull
	XML for unknown packages.
	(rcd_autopull_process_xml): Check if the XML mentions unknown
	packages.  If it does, re-fetch all of the package info.

2002-09-23  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c (rcd_autopull_fetch_all_channels): We don't use
	the RCDAutopull we were passing in, so that argument has been
	removed.
	(rcd_autopull_fetch_channel_list): Added.  Re-fetch the channel
	list and then call rcd_autopull_fetch_all_channels.
	(rcd_autopull_xml_contains_unknown_channels): A renamed
	rcd_autopull_check_xml_for_unknown_channels that returns a
	boolean.
	(process_xml_cb): The code that actually processes the autopull
	XML.  This used to be in rcd_autopull_process_xml, but is now in a
	callback that can be executed after the channel info is refreshed.
	(rcd_autopull_process_xml): If the XML contains unknown channels,
	reload the channel info before proceeding.
	(rcd_autopull_get_xml_from_file): rcd_autopull_process_xml now takes
	an xmlDoc, which it frees.
	(rcd_autopull_download_xml): Ditto.

2002-09-20  Joe Shaw  <joe@ximian.com>

	* rcd-autopull.c (rcd_autopull_resolve_and_transact): Call
	rcd_transaction_log_to_server() and rcd_transaction_begin() with
	the autopull session name.

	* rcd-rpc-packsys.c (packsys_transact): Send along a NULL
	transaction name to rcd_transaction_begin().

	* rcd-transaction.c: Add a "name" field to the
	RCDTransactionStatus struct.
	(rcd_transaction_unref): Free it here.
	(transaction_xml): Serialize the name, if it's set, for the
	logging.
	(rcd_transaction_log_to_server, rcd_transaction_begin): Take the
	transaction name as the first argument and copy it into the
	struct.

2002-09-20  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c (rcd_autopull_fetch_all_channels): Added.
	Downloads package info for all channels and executes a callback
	when finishes.
	(rcd_autopull_ref): Added.
	(rcd_autopull_unref): Added.  RCDAutopull objects are now
	reference-counted.
	(ap_rec_destroy): Changed to just unref the RCDAutopull.
	(ap_rec_execute): Refresh all channels, then execute a callback
	which actually does the autopull.
	(ap_rec_execute_part_two): Added.  This is the callback that gets
	executed post-refresh.
	(ap_rec_first): Add 0-14 minutes of fuzz to our start time.
	(rcd_autopull_new): Initialize ->refs to 1.
	(rcd_autopull_check_xml_for_unknown_channels): Walk the XML
	looking for unknown channels.  If we find one we need to re-load
	the channel list, but this is not implemented yet.
	(rcd_autopull_process_xml): Call
	rcd_autopull_check_xml_for_unknown_channels.
	(rcd_module_load): Seed the random number generator, so that all
	clients don't get the same amount of fuzz added to their start
	time.  That would be bad.

2002-09-18  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (verify_packages): Check for an RCPackman
	error immediately after calling rc_packman_verify(), since we
	could have gotten an error and a NULL list of verifications if,
	say, the package were truncated.

2002-09-17  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c (get_removal_failure_info): Added.  Generates an
	error message if we need to remove more packages than those we
	explicitly requested.
	(rcd_autopull_resolve_and_transact): Write out the dependency
	failure info using rc_debug.  Check to see if the number of
	packages to be removed is greater than the number we explicitly
	asked to have removed.  If so, fail.
	(autopull_from_session_xml_node): If the 'remove' property is
	set on a package tag, schedule it for removal.

2002-09-17  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_packages_abort): Add a workaround for the
	Soup cancel crasher.

2002-09-16  Joe Shaw  <joe@ximian.com>

	* rcd-autopull.c: Use the normal log for autopull.php.

	* rcd-transaction.c (verify_packages): Distinguish between an
	unverified package signature and a non-existent signature.

2002-09-16  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (packsys_world_sequence_numbers): Renamed from
	packsys_world_sequence_number.  Now returns a tuple of our three
	sequence numbers (package, channel and subscriptions) instead of
	just an integer.
	(rcd_rpc_packsys_register_methods): Change the registration of our
	sequence number method.

2002-09-13  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-prefs.c: Add a description field to the pref table
	struct.
	(prefs_list_prefs): Set the description on the XML-RPC struct.
	(rcd_rpc_prefs_register_pref_full, rcd_rpc_prefs_register_pref):
	Add description parameter to these functions.
	(rcd_rpc_prefs_register_methods): Add descriptions for all the
	prefs.

2002-09-13  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-util.c (rcd_rc_package_to_xmlrpc): When checking our
	installed status, handle the (broken!) case of multiply-installed
	packages with the same name. (Actually fixes bug #30194)

	* rcd-query-packages.c (package_installed_match): Ditto.

2002-09-13  Joe Shaw  <joe@ximian.com>

	* rcd-autopull.c (rcd_autopull_resolve_and_transact): Don't set
	the "trusted" privilege for autopull transactions.

	* rcd-prefs.c (rcd_prefs_get_require_signed_packages): Renamed
	from _verified_packages.  Now defaults to TRUE.
	(rcd_prefs_set_require_signed_packages): Added.

	* rcd-rpc-prefs.c (rcd_rpc_prefs_register_methods): Added
	require-signatures.

	* rcd-transaction.c (verify_packages): Flush the main loop before
	each iteration.  Mark whether we have tried to verify a
	signature.  If checking the signature was indeterministic or
	wasn't there at all, flag a warning and send it to the client.  If
	we require signed packages and the user doesn't have the "trusted"
	privilege, abort.  (Previously, if you required signed packages,
	even trusted users couldn't install unsigned packages)

2002-09-13  Joe Shaw  <joe@ximian.com>

	* rcd.c (option_parsing): Add an -f option, which specifies the
	config file to use.
	(main): Check to make sure the config file passed in is valid.

	* rcd-autopull.c (rcd_autopull_resolve_and_transact): Update call
	to rcd_transaction_begin().

	* rcd-cache.c (rcd_cache_entry_close, rcd_cache_new): Revert my
	last change as it wasn't really needed.
	(rcd_cache_entry_invalidate): Fix the real bug, which was that I
	was trying to remove from the hash table by using the data and not
	the key.
	(rcd_cache_lookup): Did the same thing, now just calls
	rcd_cache_entry_invalidate().

	* rcd-prefs.c: Get the config_file out of rcd.c and use it instead
	of the default if it's set.

	* rcd-rpc-packsys.c (packsys_transact): Change the dry_run bool to
	a flags integer which specifies things like whether this is a dry
	run or download only transaction.  Pass that through to
	rcd_transaction_begin().

	* rcd-transaction.c: Replace dry_run with flags everywhere, and
	update the checks accordingly.
	(rcd_transaction_status_unref): Only unref the pendings if they're
	set.
	(cleanup_after_transaction): Don't cleanup temp files if the user
	is doing a download only transaction.
	(download_completed): Don't call verify_packages() if we're in a
	download only transaction.
	(rcd_transaction_begin): Don't create the transaction and step
	pending objects if we're in download only.  Set their IDs to -1 if
	they're NULL.  Don't call verify_packages() if we're in a download
	only transaction.

2002-09-12  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (main): Copy argv[0] into a static global char *,
	rcd_executable_name, for the crash handler to use when invoking
	rcd-buddy.
	(crash_handler): Pass rcd_executable_name (which contains argv[0])
	and the PID as arguments when we run rcd-buddy. (Bug #29460)

	* rcd-buddy.in (gdb_cmd): Invoke gdb by passing the program and
	pid as arguments, instead of using the --pid option. (Also bug
	#29460)

2002-09-11  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c (package_from_xml_node): Removed some left-over
	debug spew.

	* rcd-rpc-util.c (rcd_rc_package_to_xmlrpc): If name_installed >
	0, this package has a greater version number than the installed
	package with the same name.  If name_installed < 0, the installed
	version is newer.

2002-09-11  Joe Shaw  <joe@ximian.com>

	* rcd.c (initialize_data): We always have to register before we
	ever download any channel data.  Don't know what crack I was
	smoking.

2002-09-11  Jon Trowbridge  <trow@ximian.com>

	* rcd-query-packages.c (package_installed_match): Added.  This is
	a query method that returns true if the package is a system
	package or is an in-channel package that has the same EVR as a
	system package.
	Also created an entry in the query_packages_engine array for
	"package-installed".

	* rcd-rpc-util.c (rcd_rc_package_to_xmlrpc): Added a name_installed
	field to the package xml-rpc struct.  It is a flag that gets set
	if a package of the same name is installed on the system.

2002-09-10  Joe Shaw  <joe@ximian.com>

	* rcd-autopull.c (rcd_autopull_resolve_and_transact): Update for
	the rcd_transaction_begin() API change.

	* rcd-cache.c (rcd_cache_entry_close): g_strdup() the filename
	before adding it as the key to the hash table.
	(rcd_cache_new): Call g_hash_table_new_full() and pass in g_free()
	as the key destroy func.

	* rcd-fetch.c: Get rid of package_transfer_id, we'll be using the
	download pending id now instead.
	(rcd_fetch_packages): Don't return a download id, take in the
	pending_id as an argument.

	* rcd-pending.c (rcd_pending_get_error_msg): Added.

	* rcd-rpc-packsys.c (packsys_transact): Update for the new
	rcd_transaction_begin() API.  Return a tuple of download pending
	id, transaction pending id, and transaction step pending id.
	(packsys_abort_download): Offload the work into
	rcd-transaction.c where it should be.

	* rcd-rpc-system.c (system_poll_pending): Set error_msg on the
	xmlrpc struct if it's set on the pending object.

	* rcd-transaction.c (RCDTransactionStatus): Use three pendings
	instead of one and a generic download id.
	(rcd_transaction_status_unref): Unref all of our pendings.
	(transaction_step_cb): Reset the transaction_size to 0.  Add
	messages to the transaction_pending.
	(transact_progress_cb): Update the transaction_step_pending
	progress.
	(transact_done_cb): Get rid of the "finish" message.  Set
	transaction_pending and transaction_step_pending to "finished".
	(fail_transaction): Take an RCDPending to use in the
	rcd_pending_fail() call.  Get rid of the "failed" message.
	(run_transaction): Pass transaction_pending into
	fail_transaction().
	(verify_packages): Start transaction_pending.  Get rid
	of the "failed" message; rcd_pending_fail() is sufficient.
	(download_completed): call rcd_pending_finished() on
	download_pending if we're successful.  Otherwise abort or fail it.
	(download_packages): Create download_pending and begin
	it if we have packages to download.  Pass the id into
	rcd_fetch_packages().
	(rcd_transaction_begin): Make it a void function, take three out
	parameters which are for the download_pending id,
	transaction_pending id, and transaction_step_pending id.
	(check_install_auth): Takes an RCDTransactionStatus object and an
	RCDIdentity and determines if the identity has the authorization
	to cancel the download for the transaction.
	(rcd_transaction_abort): Added.  Given a download_id and an
	identity, abort the transaction if we can.

2002-09-10  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c: Added name field to RCDAutopull struct.
	(rcd_autopull_resolve_and_transact): Log the name of the autpull
	session we are executing.
	(ap_rec_destroy): Free the name.
	(rcd_autopull_new): Add a name argument.  If NULL, set the name to
	"Unnamed".
	(autopull_from_session_xml_node): Get the name from the session
	XML, pass it to rcd_autopull_new.

2002-09-06  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c (rcd_prefs_set_host): Added.  Sets the server URL.
	(rcd_prefs_set_premium): Added.  Sets whether this is a premium
	server or a regular free one.
	(rcd_prefs_get_org_id): Use "org-id" instead of "org_id" to match
	all the other prefs.

	* rcd-rpc-prefs.c (rcd_rpc_prefs_register_methods): Register the
	prefs so clients can set them.

2002-09-06  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c: Key all cache entries by the local cache filename,
	not the URL.  This way we can do lookups based on the local
	filename, and files should be cached across hosts in the same
	session.
	(rcd_cache_entry_invalidate): Added.  Invalidates a cache entry.

	* rcd-privileges.c (rcd_privileges_init): Added a "trusted"
	privilege to the base privileges.

	* rcd-transaction.c (RCDTransactionStatus): Replace a client_user
	field with an RCDIdentity field.
	(verify_packages): Check to see if we have the trusted privilege
	before we install packages without (or with an inconclusive) GPG
	signature.
	(rcd_transaction_begin): We need to call verify_packages() even if
	we're not downloading anything.  Take an RCDIdentity argument
	instead of a const char * for the username.
	(check_package_integrity): Added.  Runs a size and md5sum
	verification on a package in the attempt to see if it's a valid
	package file.
	(dowwnload_packages): If the file already exists on the local
	filesystem, run a integrity check on it.  If it fails, invalidate
	it from the cache (if appropriate) and require it be downloaded
	again.

	* rcd-rpc-packsys.c (packsys_transact): Pass in the identity
	instead of just the identity's username to
	rcd_transaction_begin().

	* rcd-autopull.c (rcd_autopull_resolve_and_transact): Create a
	dummy identity to pass into rcd_transaction_begin().

2002-09-05  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.c (rcd_rpc_server_start): Use HTTP digest authentication
	for client-daemon TCP connections.

2002-09-05  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (what_requires_or_conflicts_cb): Don't do
	anything if a fault has occured.
	(packsys_what_requires): Be more careful about checking for xmlrpc
	faults.
	(packsys_what_conflicts): Ditto.
	(what_provides_cb): Don't do anything if a fault has occured.
	(packsys_what_provides): Be more careful about checking for xmlrpc
	faults.

	* rcd-pending.c (rcd_pending_lookup_by_id): Silently return NULL
	if the passed-in ID is <= 0.

2002-09-04  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-util.c (rcd_rc_channel_to_xmlrpc): Add the channel's
	description to the xml-rpc struct.

2002-09-03  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c: The config file is now rcd.conf, to be more
	consistent with every other daemon configuration file.

	* rcd-identity.c: The ACL/password file is now rcd.passwd, to be more
	consistent with rcd.conf.

2002-09-03  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-util.c (rcd_rc_package_to_xmlrpc): Include the file
	size, installed size, and section info when we map an RCPackage to
	an xml-rpc struct.
	(rcd_rc_package_to_xmlrpc): We also need the section's user
	string.

2002-08-29  Joe Shaw  <joe@ximian.com>

	* rcd.c (is_supported_distro): Added.  Checks to see if we're on a
	supported distro and prints a warning to the logs if we're not.
	(initialize_data): Don't try to download a channel list or channel
	data if we're on an unsupported distribution.

2002-08-29  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c (rcd_prefs_set_proxy_url,
	rcd_prefs_get_proxy_username, rcd_prefs_get_proxy_password): If
	the string coming in is NULL, unset the key rather than trying to
	set it to NULL (which doesn't work).

	* rcd-rpc-prefs.c (get_string_func): Use RC_STRING_TO_XMLRPC() so
	we don't pass in NULL to xmlrpc_build_value().
	(set_string_func): Use XMLRPC_STRING_TO_RC() so we get back NULL
	if the string is empty.

2002-08-28  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (prepend_pkg): Use the
	rc_package_status_is_to_be_installed macro.

	* rcd-autopull.c (pkg_install): Use the
	rc_package_status_is_to_be_installed macro.

2002-08-28  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c: Add get/set preferences for the three proxy
	elements: URL, username, password.

	* rcd-rpc-prefs.c: Add privileges for getting and setting
	individual preferences.
	(RCDPrefTable): Add RCDPrivileges fields for getting and setting
	prefs.
	(get_pref): Get the method data and approve the get against the
	user's identity.
	(prefs_set_pref): Get the method data and approve the set against
	the user's identity.
	(prefs_list_prefs): Do a get_pref() on each pref and add it to the
	list if the user has privileges to see it.  When we're done, if it
	turns out the list of preferences the user can see is empty, throw
	a permission denied fault instead of returning an empty list.
	(rcd_rpc_prefs_register_pref_full, rcd_rpc_prefs_register_pref):
	Take a list of privileges for getting and setting a pref.
	(rcd_rpc_prefs_register_methods): Register the proxy prefs, and
	fix up all of the other prefs to have individual privileges.  Make
	the RPC calls approve anyone (since handling is done inside the
	calls now).

2002-08-28  Ian Peters  <itp@ximian.com>

	* rcd-rpc-packsys.c (build_updates_list): use
	rc_packman_version_compare, not rc_package_spec_compare

	* rcd.c (initialize_rc_world): no more rc_packman_set_packman or
	rc_world_register_packman, rc_world_new needs a packman, and
	rc_set_world that

2002-08-27  Joe Shaw  <joe@ximian.com>

	* rcd-transfer-http.c
	(rcd_transfer_protocol_http_get_response_body): Removed.  It's not
	used anywhere anymore, and since we overwrite chunks, it'll never
	work the way we want it to.

2002-08-27  Joe Shaw  <joe@ximian.com>

	* rcd-autopull.c (rcd_autopull_resolve_and_transact): If we had
	failed deps, stringify the failure and send it as the reason
	instead of a generic "resolution failed" message.

	* rcd-rpc-packsys.c (append_dep_info, dep_get_failure_info): Use a
	GString instead of allocating a bunch of temporary strings.

2002-08-26  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_distro): Added.  Downloads
	"distributions.xml" from the server, so we can dynamically change
	things like what distributions are supported, which are
	deprecated, etc.

	* rcd.c (main): Fix the rc_distro_parse_xml() FIXME; add a call to
	rcd_fetch_distro() to immediately before initializing the RCWorld.

	* rcd-transfer.c: Remove some errant FIXMEs.

2002-08-26  Joe Shaw  <joe@ximian.com>

	* rcd-log.c (rcd_log_init): Remove the SIGHUP handler from here.

	* rcd.c (daemonize): Add some asserts so we can be sure that we're
	reopening std* correctly.
	(main): Add a SIGHUP handler.
	(sighup_handler): Added.  Closes and reopens stdout and stderr,
	reinitializes the log, and adds a reload of all the channel data
	to an idle loop.

2002-08-26  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_register): Get the contents of the transfer
	from the GByteArray returned from rcd_transfer_begin_blocking()
	instead of from the protocol backend.

2002-08-23  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_get_channel_icon): Um, close the file
	after we're done with it.

2002-08-23  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c (RCDCache): Add a user_data field.
	(icon_cache_filename_func): Added.  Munges an icon filename.
	(rcd_cache_get_icon_cache): Added.  Gets the icon cache and sets
	the channel_id as the cache's user_data.

	* rcd-fetch.c (rcd_fetch_channel): Fix a leak when downloading
	channel data fails.
	(rcd_fetch_channel_icon): Fetches the channel icon.
	(rcd_fetch_all_channel_icons): Fetches all of the channel icons,
	or only the ones that need to be fetched.

	* rcd-rpc-packsys.c (packsys_refresh_channel): Also refresh the
	channel's icon.
	(refresh_channels_cb): Refresh all of the channel icons.
	(packsys_get_channel_icon): Added.  Sends the channel icon down
	the wire.
	(rcd_rpc_packsys_register_methods): Register get_channel_icon().

	* rcd-rpc-system.c: Add an #include to avoid a warning.

	* rcd-rpc-util.h: Add RCD_RPC_FAULT_NO_ICON fault.

	* rcd.c (initialize_data): Download the channel icons that we
	don't already have on disk.

2002-08-23  Jon Trowbridge  <trow@ximian.com>

	* rcd-unix-server.c: Include sys/time.h, which is needed so that
	we pick up the definition of struct timeval on machines running an
	older glibc (like RH62).

	* rcd.c (option_parsing): Don't use the POPT_TABLEEND macro, since
	it isn't in the version of popt that comes with RH62.

2002-08-22  Joe Shaw  <joe@ximian.com>

	* rcd-unix-server.c (SOCKET_PATH): Change from /tmp/rcd to
	/var/run/rcd to conform to the FHS.

2002-08-22  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (rcd_transaction_send_log): Drop the
	logversion from the URL, Aidan says we don't need it.

2002-08-22  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Remove rcd-transact-log.[ch].

	* rcd-transaction.c: Fold in the transaction logging into here,
	where it belongs.  Greatly simplify so it only makes one trip to
	the server instead of two.  Will depend on new logging code on the
	servers, though.  Make RCDTransactionStatus refcounted.

	* rcd-transact-log.[ch]: Removed.

	* rcd-autopull.c (rcd_autopull_resolve_and_transact): If we have
	failed dependencies, log it to the server.

	* rcd-fetch.c (rcd_fetch_register): Plug a leak.

2002-08-22  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-system.c (system_ping): Set server_url and
	server_premium.

	* rcd-transact-log.c (manifest_xml_node): Send the name of the
	old_pkg along as well as the EVR.

2002-08-21  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (rcd_transaction_begin): Require client_id and
	client_version arguments which identify the client requesting the
	transaction.
	(cleanup_after_transaction): Free the client_id and client_version
	when we're done.

	* rcd-transact-log.c (rcd_transact_log_send_transaction): Take the
	client_id and client_version as arguments, pass them into
	transaction_xml().
	(transaction_xml): Take the client_id and client_version and add
	them to the XML.

	* rcd-rpc-packsys.c (packsys_transact): Take the client ID and
	client version as the fourth and fifth arguments and pass them
	into rcd_transaction_begin().

	* rcd-autopull.c (rcd_autopull_resolve_and_transact): Add
	client_id and client_version arguments to rcd_transaction_begin.

2002-08-21  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c: (rcd_autopull_resolve_and_transact): Actually
	handle the transaction.
	(rcd_autopull_process_xml): Try to get the check-in interval from
	the XML.
	(xml_fetch_next): Use the check-in interval.
	(rcd_autopull_download_xml): Actually download the autopull XML.
	(xml_fetch_execute): Disable the file override.
	(rcd_autopull_resolve_and_transact): Be a bit more verbose in our
	logging.

2002-08-21  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_channel_list): Return a gboolean
	indicating success.  Before we add the channels from the XML,
	remove all of the previous channels.  Before, this was done before
	every call to rcd_fetch_channel_list().  Now, if we fail, we can
	just continue using what we already had in memory.

	* rcd-rpc-packsys.c (refresh_channels_cb): Don't remove the
	channels from the world here, that's now done in
	rcd_fetch_channel_list() on success.  If fetching the channel list
	fails, set an invalid indicator.
	(packsys_refresh_all_channels): If we get an invalid list back
	from refresh_channels_cb(), set a fault.

	* rcd-rpc-util.h: Added RCD_RPC_FAULT_CANT_REFRESH.

	* rcd-transfer-http.c (http_read_data): If the HTTP response isn't
	in the 200 class, don't try to append data to the (unopened) cache
	entry.  Fixes a g_warning().

2002-08-21  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c: Further hacking.  We are now pretty close to
	having autopull actually work.

2002-08-20  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (main): Fixed memory leak.

	* rcd-rpc-packsys.c (resolve_deps): OK, I didn't fully understand
	the semantics of the resolve_deps function before I lumbered in
	and started changing stuff.  We now properly filter the original
	install/remove requests out of the list of installs/removals that
	we return.

2002-08-20  Joe Shaw  <joe@ximian.com>

	* rcd.c (initialize_data): Don't check to see if we've registered
	previously.  Always try to register.
	(crash_handler): We can't just set SIG_DFL as the second argument;
	we have to create a struct sigaction with SIG_DFL as the
	sa_handler.

	* rcd-fetch.c (rcd_fetch_register): If we couldn't successfully
	register, send a warning out to the logs with a reason.

	* rcd-prefs.c (rcd_prefs_{get|set}_registered): Removed.

	* rcd-transfer-http.c (http_done): Set the protocol's response
	body to whatever the server sends back.
	(http_free): Free the response_body.
	(rcd_transfer_protocol_http_get_response_body): Added.

2002-08-20  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c: Ugh... there was some deeply broken code in
	here.
	(prepend_pkg): Go back to just appending packages to a list,
	instead of trying to do fancy hash stuff.  Use the
	rc_package_status_is_to_be_uninstalled and rc_package_is_installed
	functions to check the status... looking directly inside of the
	structs is unreliable and will give you the wrong answer in some
	cases.
	(prepend_pkg_pair): Just append packages to a list, instead of
	trying to do fancy hash stuff.
	(remove_duplicate_packages): Given a list of packages, remove any
	duplicates.  Yes, this function is O(N^2)... but it has the
	decided advantage of actually being correct. :)
	(resolve_deps): Remove all of the hash cleverness, and just go
	back to accumulating our packages in lists.  The main problem was
	that the hashes were keyed on the package spec's quark...  but
	that is dangerously broken, since multiple packages with the same
	name can appear in the install/remove lists in some cases.

	* rcd.c (crash_handler): Restore the default SIGSEGV, SIGFPE and
	SIGBUS handlers after we enter our crash handler.  This makes our
	crash handling somewhat less flaky.

2002-08-19  Jon Trowbridge  <trow@ximian.com>

	* rcd-autopull.c: Further hacking.

2002-08-17  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (packsys_world_sequence_number): A method that
	returns the world's sequence number.
	(rcd_rpc_packsys_register_methods): Register the seqno method.

2002-08-14  Ian Peters  <itp@ximian.com>

	* rcd-rpc-packsys.c (resolve_packages): get rid of all of the
	virtual conflicts stuff

2002-08-14  Jon Trowbridge  <trow@ximian.com>

	* Makefile.am: Don't make rcd-buddy executable in the
	install-data-hook.

	* rcd.c (crash_handler): Invoke rcd-buddy as "python
	SHAREDIR/rcd-buddy".  Don't stat to check if the rcd-buddy is
	there, since we now do that check before seting up the crash
	handler.
	(main): Don't set up the crash handler if we can't find python in
	the path.

2002-08-13  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (packsys_transact): Expire the package
	cache before every transaction.

	* rcd-expire.c (rcd_expire_unlink): Added.  A static function that
	just wraps unlink and produces some debug spew.
	(expire_by_age_cb): Use rcd_expire_unlink.
	(rcd_expire_by_size): Use rcd_expire_unlink.

	* rcd-cache.c (rcd_cache_expire_package_cache): A convenience
	function to expire the package cache using the cache-related
	preferences as parameters.
	(rcd_cache_get_package_cache): When we create the package cache,
	register a shutdown handler that expires the cache.

2002-08-13  Ian Peters  <itp@ximian.com>

	* rcd-log-entry.c (rcd_log_entry_parse): fix a crash, argh

2002-08-12  Jon Trowbridge  <trow@ximian.com>

	* rcd-cache.c (rcd_cache_expire): Added.  Finds the directory the
	RCDCache stores files in and cleans them up by age and size.

	* rcd-rpc-prefs.c (rcd_rpc_prefs_register_methods): Register our
	cache expiration preferences.

	* rcd-prefs.c (rcd_prefs_get_cache_cleanup_enabled): Added.
	(rcd_prefs_set_cache_cleanup_enabled): Added.
	(rcd_prefs_get_cache_max_age_in_days): Added.
	(rcd_prefs_set_cache_max_age_in_days): Added.
	(rcd_prefs_get_cache_max_size_in_mb): Added.
	(rcd_prefs_set_cache_max_size_in_mb): Added.

	* rcd-expire.c: Added.  Some general code for cleaning up cached
	files by size and age.

2002-08-12  Joe Shaw  <joe@ximian.com>

	* rcd-query-packages.c (name_installed_match): Added.  Returns
	TRUE if any package matching a name is installed.
	(query_packages_engine): Added "name-installed".

2002-08-12  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.c (download_packages): Return an int instead of
	a gboolean.  If we have packages to download, check to make sure
	we have the disk space to store them.  Otherwise, lose it.
	Returns the number of packages to download now.

2002-08-12  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c (rcd_prefs_get_cache_dir): Change the cache dir to
	/var/cache/redcarpet.

	* rcd-rpc-packsys.c (refresh_channels_cb): Move the transaction
	lock call here so the heartbeat locks it and we don't get
	transaction lock warnings.
	(packsys_refresh_all_channels): Remove the lock call from here.

2002-08-09  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c (rcd_cache_lookup): If the file isn't there anymore,
	remove the cache entry from the cache before freeing it.  Duh.

	* rcd-transact-log.c (rcd_transact_log_send_transaction): Since
	it's very possible for a transaction to finish before the
	transaction manifest is even sent to the server, we need to
	allocate the transaction id slot on the heap.  Change this
	function to return a newly allocated slot for it.  God, this code
	is really nasty.  It should be integrated with rcd-transaction.c.
	(transaction_sent): If rcd_transact_log_send_success() got called
	before we did, free the tid slot.
	(success_sent): Free the tid and the slot.
	(rcd_transact_log_send_success): If there's no tid available,
	don't send the success info, set a special value so we don't leak.

	* rcd-transaction.c (RCDTransactionStatus): log_tid is a char **
	now.
	(rcd_transaction_begin): Assign status->log_tid to the result of
	rcd_transact_log_send_transaction().

2002-08-09  Jon Trowbridge  <trow@ximian.com>

	* rcd-fetch.c (download_package_file): Fixed memory leak.

2002-08-09  Joe Shaw  <joe@ximian.com>

	* rcd-transaction.[ch]: Added.  Splits out all of the directly
	package-transaction related stuff from rcd-rpc-packsys.c.

	* rcd-rpc-packsys.c: Most out all of the transaction
	stuff. Replace packsys_lock with
	rcd_transaction_[lock|unlock|is_locked]().
	(packsys_tranact): Make dry_run an xmlrpc_bool instead of a
	pointer to one.  Call rcd_transaction_begin().
	(packsys_abort_download): Call a bunch of rcd_transaction
	functions to see if we can abort this download.

	* Makefile.am: Add rcd-transaction.[ch].

2002-08-09  Ian Peters  <itp@ximian.com>

	* rcd-log-entry.c (spec_to_str): RCPackageSpec GQuark fixup
	(spec_from_str): GQuark fixup.  This function is so screwed.  It
	claims to take const char * parameters, and then uses those to
	populate a structure that, when freed, will free them.  Odd.
	(rcd_log_entry_parse): GQuark fixup.

	* rcd-log.c (package_name_match): GQuark fixup

	* rcd-query-packages.c (name_match): GQuark fixup
	(text_match): GQuark fixup

	* rcd-rpc-log.c (rcd_log_entry_to_xmlrpc): GQuark fixup

	* rcd-rpc-packsys.c (update_log): GQuark fixup
	(verify_packages): GQuark fixup
	(prepend_pkg): hash by GQuark
	(prepend_pkg_pair): hash by GQuark
	(resolve_deps): create my hash tables NULL, NULL, and hash things
	by GQuark

	* rcd-rpc-util.c (rcd_rc_package_spec_to_xmlrpc): GQuark fixup
	(rcd_rc_package_to_xmlrpc): GQuark fixup

	* rcd-transact-log.c (manifest_xml_node): GQuark fixup

2002-08-08  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_resolve_dependencies,
	packsys_verify_dependencies): decref the xmlrpc_resolution_info
	values.  Fixes a leak.

2002-08-08  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c: Fix some cache contention issues...
	(rcd_cache_entry_new): Don't insert the cache entry into the cache
	immediately.
	(rcd_cache_entry_open): Instead of saving to package.tmp, use
	g_mkstemp(), and save the temporary filename in the cache entry.
	(rcd_cache_entry_close): Rename the file into place and insert it
	into the cache.
	(rcd_cache_entry_free): Free the temp filename.

	* rcd-rpc-packsys.c (fail_transaction): Added.  Split out of
	run_transaction().
	(run_transaction): If the transaction lock is held, fail out with
	a locking error.

2002-08-08  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (resolve_deps): Added an argument for passing
	out an xmlrpc array containing the xmlrpcified RCResolverInfo
	items generated during this resolution.  It is taken from the best
	context if our resolution succeeded, and from the first failed
	queue otherwise.
	(packsys_verify_dependencies): Get the resolution info from the
	call to resolve_deps, then pass it back as the third element of
	our returned tuple.
	(packsys_resolve_dependencies): Ditto.

	* rcd-rpc-util.c (rcd_rc_resolver_info_to_xmlrpc): Actually store
	the contents of the RCResolverInfo message in the "message" field
	of the xmlrpc struct.

	* rcd-rpc-packsys.c (append_dep_info): Call
	rc_resolver_info_type_to_string instead of _to_str.
	(dep_get_package_info_cb): Call
	rc_resolver_info_packages_to_string instead of to_str.

	* rcd-rpc-util.c (rcd_rc_resolver_info_to_xmlrpc): Changed to call
	rc_resolver_info_type_to_string instead of _to_str.

2002-08-08  Ian Peters  <itp@ximian.com>

	* rcd-rpc-util.c (rcd_rc_package_dep_to_xmlrpc): opaque
	RCPackageDeps
	(rcd_xmlrpc_to_rc_package_dep): ditto

2002-08-08  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c (rcd_prefs_get_proxy): We can get back a NULL
	SoupUri from soup_uri_new(), so we need to check for that.  Blah.

2002-08-08  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-util.c (rcd_rc_resolver_info_to_xmlrpc): Added.

2002-08-07  Ian Peters  <itp@ximian.com>

	* rcd-rpc-packsys.c (packsys_what_provides): unref a dep, don't
	free
	(packsys_what_requires): ditto
	(packsys_what_conflicts): ditto

	* rcd-rpc-util.c (rcd_rc_package_dep_array_to_xmlrpc): change the
	way we iterate over RCPackageDepArrays
	(rcd_xmlrpc_to_rc_package_dep): add FALSE, FALSE to
	rc_package_dep_new_from_spec

2002-08-07  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (option_parsing): If the RCD_NON_DAEMON environment
	variable is set, act as if the --non-daemon option was used.

	* rcd-identity.c (rcd_identity_update_password_file): When I fixed
	this bug the other day, I only fixed it half-way... we need to
	also handle the case of an file that is empty or contains only
	comments.

2002-08-07  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (cleanup_after_transaction): Don't free
	log_tid since rcd_transact_log_send_success() will free it.

	* rcd-transact-log.c (rcd_transact_log_send_transaction,
	rcd_transact_log_send_success): Fix memory leaks.

2002-08-07  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-util.c (rcd_rc_package_from_xmlrpc_package): Memory
	leak.

2002-08-07  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (process_channel_cb): Unref the transfer.  Fixes a
	leak.

	* rcd-rpc-packsys.c (cleanup_after_transaction): Free the
	RCDTransactionStatus struct and free/unref its members.
	(run_transaction): Move the call of cleanup_after_transaction()
	after rc_world_get_system_packages().
	(download_packages): Ref the package before we add it to the
	packages_to_download list.

2002-08-07  Joe Shaw  <joe@ximian.com>

	* rcd-about.c (rcd_about_copyright): Removed "All rights reserved"
	as we're not reserving all of our rights (since it's licensed
	under the GPL).

2002-08-07  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-system.c (system_ping): Send the server's major, minor
	and micro version information back in response to the ping.  This
	way clients don't need to parse the "name" field to figure out
	what version of rcd they are talking to.

2002-08-06  Jon Trowbridge  <trow@ximian.com>

	* rcd-privileges.c (rcd_privileges_from_string): Properly handle
	the case of a superuser privileges mixed in with lower-level
	privileges.  This lets us actually add superuser-level users
	through rc.

2002-08-06  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (verify_packages): Set the keyring.

2002-08-06  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-system.c (system_poll_pending): Fixed memory leak.

	* rcd-pending.c (rcd_pending_cleanup): Don't cleanup pending items
	if the environment variable RCD_NO_PENDING_CLEANUP is set.  (We
	seem to need to do this when valgrinding, because the daemon runs
	so slowly.)

2002-08-06  Ian Peters  <itp@ximian.com>

	* Makefile.am: remove references to libredcarpet, red_carpet_libs,
	etc

2002-08-06  Jon Trowbridge  <trow@ximian.com>
	
	* rcd.c (daemonize): Reopen stdout and stderr to
	/var/log/rcd/rcd-messages.  If /var/log/rcd doesn't exist, create
	it.

	* rcd-log.c: Changed default logfile to
	/var/log/rcd/rcd-package-history.
	(rcd_open_log_file): If /var/log/rcd doesn't exist, create it.

2002-08-06  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c: Split out a bunch of the transfer queuing and
	beginning to smaller functions.
	(package_completed_cb): Unref the transfer afterward.
	(rcd_fetch_packages_abort): Unref all of the queued transfers.

2002-08-06  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (download_package_file): If we want to download more
	packages than we allow concurrently, queue the additional ones up.
	(package_completed_cb): If we have any queued up
	packages to download, pop one off and begin it.

	* rcd-prefs.c (rcd_prefs_get_max_downloads,
	rcd_prefs_set_max_downloads): Added.  The maximum number of
	packages that can be downloaded at one time.  0 means unlimited.
	(rcd_prefs_get_debug_level): Set the default level to 4
	(LEVEL_MESSAGE).

	* rcd-rpc-prefs.c (rcd_rpc_prefs_register_methods): Register the
	max-downloads pref.

	* rcd-pending.c:
	* rcd-rpc.c:
	* rcd-unix-server.c:
	* rcd.c: Change around a lot of the debug levels so that our
	/tmp/rcd-messages file isn't hundreds and hundreds of megs by
	default.

2002-08-05  Joe Shaw  <joe@ximian.com>

	* rcd-recurring.[ch]: Fix the license.

2002-08-05  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-prefs.c (pref_table): Make this dynamically allocated.
	(get_pref, prefs_set_pref, prefs_set_pref): Update for the
	dynamically allocated array.
	(rcd_rpc_prefs_register_pref): Added.  Public function which
	allows modules to register preferences.
	(rcd_rpc_prefs_register_pref_full): Added.  Like above, but allows
	the user to specify conversion functions instead of built in ones.
	(rcd_rpc_prefs_register_methods): Register a bunch of standard
	preferences.

	* rcd-rpc-prefs.h: Move a lot of now publicly exported types and
	functions here.

2002-08-05  Joe Shaw  <joe@ximian.com>

	* rcd-module.h: Added version, interface_major, and
	interface_minor fields.

	* rcd-module.c (rcd_module_query): Take required_major and
	required_minor arguments.  If required_major isn't -1, check
	that the module's interface_major matches the required_major
	and that the module's interface_minor is at least the
	required_minor.

	* rcd-autopull.c: Add fields to the RCDModule.

	* rcd-rpc-sample.c: Add fields to the RCDModule.

	* rcd-rpc-system.c (system_query_module): Take required_major and
	required_minor arguments and pass them into rcd_module_query().

2002-08-05  Ian Peters  <itp@ximian.com>

	* rcd-rpc-packsys.c (packsys_package_dependency_info): change the
	way we iterate over the deps, since they're arrays now

	* rcd-rpc-util.h, rcd-rpc-util.c: change
	rcd_rc_package_dep_slist_to_xmlrpc to
	rcd_rc_package_dep_array_to_xmlrpc.

2002-08-05  Jon Trowbridge  <trow@ximian.com>

	* Makefile.am (install-data-hook): chmod rcd-buddy in the correct
	hook.

2002-08-05  Ian Peters  <itp@ximian.com>

	* Makefile.am: get rid of the rcd-marshal.[ch] stamp stuff

2002-08-05  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (main): Only set up the crash handlers if it looks
	like rcd-buddy is actually in the right place.

	* Makefile.am (rcd_buddy_DATA): Added rcd-buddy-cmds.
	(EXTRA_DIST): Added rcd-buddy and rcd-buddy-cmds.

	* rcd-buddy-cmds: A file with the commands that rcd-buddy feeds
	to gdb.

	* rcd-buddy.in: We .in-ify this so that we can embed the path to
	rcd-buddy-cmds in the script.

2002-08-05  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Set librcd_autopull_la_LDFLAGS to match the
	sample's.

2002-08-04  Jon Trowbridge  <trow@ximian.com>

	* rcd-buddy: Also write the backtrace to stderr.

	* Makefile.am: Install rcd-buddy into PREFIX/share/rcd and make it
	executable.

	* rcd-buddy: Added.  A little python script that runs gdb,
	attaches to a crashing rcd process, and dumps the backtrace into
	/tmp/rcd-crash.PID.
	
	* rcd.c (main): Handle SIGSEGV, SIGFPE and SIGBUS with
	crash_handler.
	(crash_handler): If we can find it, run rcd-buddy.

	* rcd-autopull.c: Added.  The beginnings of some code for an
	autopull module.  Still incomplete.

	* rcd-module.c (rcd_module_init): Please don't leak the GDir.

	* rcd-identity.c (create_password_file): Added.  Breaks out our
	fopen/chmod on PASSWORD_FILE.
	(identity_update_cb): Changed to use create_password_file.
	(rcd_identity_update_password_file): If our password file doesn't
	already exist, create it and then go ahead and do the right thing.
	(rcd_identity_remove_from_password_file): Use
	create_password_file.

	* rcd-rpc-util.c (rcd_xmlrpc_to_rc_package_dep): Memory leak.
	(rcd_rc_package_from_xmlrpc_package): Memory leak.

	* rcd-rpc-prefs.c (prefs_list_prefs): Memory leak.

	* rcd-rpc-packsys.c (build_updates_list): Memory leak.
	(packsys_what_provides): Memory leak.
	(packsys_what_requires): Memory leak.
	(packsys_what_conflicts): Memory leak.

	* rcd-rpc-log.c (log_query_log): Memory leak.

	* rcd-cache.c (normal_cache_filename_func): Memory leak.

2002-08-03  Ian Peters  <itp@ximian.com>

	* rcd-fetch.c (get_channel_list_url): no need to call
	rc_figure_distro, etc anymore, just check rc_distro_get_target

	* rcd-rpc-packsys.c (extra_dump_info): no rc_figure_distro, access
	the distro name, version, and target directly

	* rcd-rpc-system.c (system_ping): no rc_figure_distro, access
	name, version, and target directly

	* rcd-transact-log.c (transaction_xml): no rc_figure_distro,
	access target directly

	* rcd.c (main): as a HACK, call rc_distro_parse_xml (NULL, 0) to
	initialize the distribution with the internal distribution XML.
	This needs to eventually download and parse a distribution XML
	file, but we need to discuss how best to do that.

2002-08-02  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (append_dep_info): Fixed memory leak.

	* rcd-rpc.c (access_control_check): Fixed memory leak.

2002-08-02  Joe Shaw  <joe@ximian.com>

	* rcd-transfer-http.c (http_debug_pre_handler, http_debug): More
	output!
	(http_open): Actually include the request body in the message.

2002-08-02  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_register): Don't do any checks here; do
	them all in rcd.c.  Call uname() to get the hostname, and send it
	along on the query string with the orgtoken.  Use the standard
	host to get it, don't use a special registration host.  Get the
	X-RC-Status header from the server to determine if we've
	successfully registered.

	* rcd-prefs.c (rcd_prefs_get_registration_host): Removed.
	(rcd_prefs_get_registered): Added.
	(rcd_prefs_set_registered): Added.

	* rcd-transfer-http.c (http_debug, http_debug_pre_handler,
	http_debug_post_handler): Output an ungodly amount of HTTP
	debugging info.
	(http_done): Copy the response headers into our own copy, since
	Soup will automatically free them when we exit this function.
	(http_open): Call http_debug().
	(http_free): Free our response headers as well.
	(rcd_transfer_protocol_http_get_response_header): Pull the header
	out of our copy of headers, since the message will have been freed
	by the time we want them.

	* rcd-transfer-http.h (RCDTransferProtocolHTTP): Added a
	response_headers field.

	* rcd.c (initialize_data): Do a bunch of checks to see if we
	should register.

2002-08-02  Joe Shaw  <joe@ximian.com>

	* rcd.c (rcd_create_uuid): Added.  Creates a uuid file (like the
	mid and secret).
	(initialize_data): Create the mcookie and partnernet files if they
	don't already exist.

2002-08-01  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_register): Added, first cut at
	registration.

	* rcd-prefs.c (rcd_prefs_get_registration_host): Added.
	(rcd_prefs_get_org_id): Added.
	(rcd_prefs_get_mid): Added.
	(rcd_prefs_get_secret): Added.

	* rcd-transact-log.c (get_mid, get_secret, get_premium_uri):
	Removed.
	(rcd_transact_log_send_transaction): Change to use RCDTransfer
	instead of using Soup directly.  Use neat RCDTransferProtocolHTTP
	functions to set headers and do HTTP POST.
	(rcd_transact_log_send_success): Ditto.
	(transaction_sent, success_sent): Changed to be callbacks from the
	file_done signal on a RCDTransfer

	* rcd-transfer-http.c (get_mid, get_secret): Removed.
	(http_open): Set the HTTP method to the method set on the
	protocol, instead of always SOUP_METHOD_GET.  If we don't have a
	cache associated with this transfer, don't try to cache it
	anywhere.  Call add_header_cb() for every header we have.
	(add_header_cb): Added.  Adds the headers from the
	RCDTransferProtocolHTTP to the SoupMessage.
	(http_get_local_filename): Make this static.
	(http_free): Added.  Frees the headers.
	(rcd_transfer_protocol_http_set_method): Added.  Sets the HTTP
	method to use for a transfer.
	(rcd_transfer_protocol_http_set_request_body): Added.  Sets the
	body for a HTTP request.
	(rcd_transfer_protocol_http_set_request_header): Added.  Sets a
	header for a HTTP request.
	(rcd_transfer_protocol_http_get_response_header): Added.  Gets a
	header from a HTTP response.
	(rcd_transfer_protocol_http_new): Set the protocol free_func to
	http_free() and initialize the method to SOUP_METHOD_GET.

	* rcd.c (initialize_data): Call rcd_fetch_register().

2002-08-01  Joe Shaw  <joe@ximian.com>

	* rcd-transfer.c (rcd_transfer_finalize): Free the protocol.
	(rcd_transfer_new): Add a URL parameter here and create the
	RCDTransfereProtocol structure here, and set the URL and filename
	elements.
	(rcd_transfer_get_protocol_from_url): Make this non-static.
	(rcd_transfer_begin): Drop the URL parameter.
	(rcd_transfer_begin_blocking): Drop the URL parameter.

	* rcd-transfer.h (RCDTransferProtocol): Add a free_func element,
	which will allow RCDTransferProtocol implementations to free their
	extra data as well as themselves.

	* rcd-transfer-http.c (http_done): When pulling from the cache,
	create a new RCDTransferProtocol structure and set the URL and
	filename and call rcd_transfer_begin().g1
	
	(http_info): Get the X-RC-Auth header, if it's there, and store it
	in the static variable.
	(http_open): Send the X-RC-Auth header, if present, with any
	request.

	* rcd-fetch.c: Change all of the calls to rcd_transfer_new() to
	include the URL, and all the calls to
	rcd_transfer_begin[_blocking]() to not have a URL parameter.

2002-08-01  Ian Peters  <itp@ximian.com>

	* rcd-query-packages.c (needs_upgrade_match): only get upgrades in
	subscribed channels

	* rcd-rpc-packsys.c (build_updates_list): no need to filter out
	upgrades from unsubscribed channels, because we won't get them
	anymore

2002-07-31  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (option_parsing): Added late-background option to options
	table.
	(debug_message_handler): Moved the static PID variable out of the
	function (and renamed it slightly) so that we won't keep using the
	parent's PID if we daemonize late.
	(daemonize): Actually set /tmp/rcd-messages so that it is
	O_WRONLY.  That allows us to actually write stuff to it. :)
	(main): Support late-backgrounding.  This requires us to change
	the order of things slightly.
	(hello): Broke out the few lines of code that print the greeting
	so that we don't have to duplicate them for late-backgrounding in
	main.  Added printing the time, because that just seemed like a
	nice thing to print.

	* rcd-log.c (rcd_log_reinit): Added.  A small hack to help support
	--late-background.

	* rcd-rpc.c (rcd_rpc_register_method): Make the "Registering
	method foo" message level DEBUG, not INFO.

2002-07-31  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (package_completed_cb): Call the completed callback
	regardless of whether the transfers were successful or not.

	* rcd-rpc-packsys.c (run_transaction, verify_packages,
	download_completed): call rcd_transact_log_send_success() with the
	transaction id when the transaction has finished.
	(download_completed): Handle cancelled downloads as well as failed
	downloads.

	* rcd-transact-log.c (success_xml): Make tid and message const.
	(rcd_transact_log_send_success): Make msg const.

2002-07-31  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (download_packages): Don't call g_file_test()
	if the package filename is NULL.

	* rcd-transact-log.c (manifest_xml_node): Drop the URL argument.
	Only send update info if we have an update associated with our
	package.
	(transaction_xml): If we don't have a channel, send along -1, drop
	the RCPackageUpdate from the call to manifest_xml_node().
	(rcd_transact_log_send_transaction): Fix a double free.

2002-07-30  Ian Peters  <itp@ximian.com>

	* rcd-prefs.h, rcd-prefs.c: added
	rcd_prefs_[get|set]_[debug|syslog]_level

	* rcd-query-packages.c (installed_match): return the result of the
	rcd_query_match_bool
	(needs_upgrade_match): ditto

	* rcd-rpc-prefs.c (pref_table): expose debug-level and
	syslog-level

	* rcd.c (option_parsing): handle debug_ and syslog_level
	(debug_message_handler): use rcd_prefs_get_[debug|syslog]_level
	(initialize_logging): rc-debug changes

2002-07-30  Frank Belew  <frb@ximian.com>

	* Makefile.am: add support for linking rcd statically

2002-07-30  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_packages): Initialize successful to
	TRUE.  Duh.

	* rcd-rpc-packsys.c (cleanup_after_transaction): Added.  Cleans up
	the package cache if persistent caching is turned off, and allows
	shutdowns again.
	(run_transaction, verify_packages, download_completed): Call
	cleanup_after_transaction().
	(verify_packages): Change to take an RCDTransactionStatus instead
	of a non-descript gpointer.  Now a void function.

2002-07-30  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (initialize_rc_world): Added a shutdown handler that frees
	the world.  This keeps all of the world memory from showing up as
	reachable when we are using valgrind.

	* rcd-rpc-packsys.c (packsys_dump): Assemble extra information
	about the system (rcd version, time of day, hostname, etc.) and
	stick in into our world dump.
	(append_dep_info): Tiny simplication: error info items are always
	automatically flagged as important.  Also show which items are
	errors or important when RCD_DEBUG_DEPS is set.

2002-07-30  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Add rcd-transact-log.[ch]

	* rcd-fetch.c (package_completed_cb): Check to see if the transfer
	failed and send some useful failure info along if so.  Comment out
	cancelling of the other downloads when one of ours fails because
	of the Soup crash.

	* rcd-prefs.c (rcd_prefs_get_remote_server_enabled): Added.
	Checks the configuation file to see if we should run an HTTPS
	server.
	(rcd_prefs_get_remote_server_port): Get the port to run on from
	the config file.

	* rcd-rpc-packsys.c (verify_packages): If verification fails,
	allow shutdown again.
	(download_completed): Added, but incomplete.  If the download
	failed, send it down to the client and allow shutdowns again.  If
	it succeeds, call verify_packages().
	(download_packages): Set download_completed() to be the download
	completion callback instead of verify_packages().
	(packsys_transact): If we're in premium mode, send a transaction
	manifest to the server for logging.

	* rcd-rpc.c (run_server_thread): Removed; moved all of this into
	rcd_rpc_server_start().
	(rcd_rpc_server_start): Take a port parameter.  Start the HTTPS
	server if it's enabled.

	* rcd-transfer-http.c (map_soup_error_to_rcd_transfer_error): Make
	SOUP_ERROR_CANCELLED to RCD_TRANSFER_ERROR_CANCELLED.

	* rcd.c (option_parsing): Added -p options for setting the remote
	server port, and -r for disabling the remote server.
	(signal_handler): Handle SIGINT (ie, ^C in the controlling
	terminal).
	(main): Call rcd_rpc_server_start() with the port specified in -p
	and -r.

	* rcd-transact-log.[ch]: Added.  Handles connecting to the log on
	the server and sending transaction data and success.

2002-07-29  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Install the daemon into $prefix/sbin, like a good
	little daemon should.

	* rcd-rpc-packsys.c (packsys_package_info): Don't send down the
	installed size if it's zero.

2002-07-28  Jon Trowbridge  <trow@ximian.com>

	* rcd-recurring.c: Added.  This is a slightly over-engineered
	framework for handling recurring events.

	* rcd-heartbeat.c: Modified to use the new framework for recurring
	events in rcd-recurring.c.

2002-07-26  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Change the moduledir to be $(libdir)/rcd/modules so
	we don't try to load the RPM and dpkg stubs as modules.

	* rcd-rpc.c (access_control_check): Check to make sure method_info
	is valid before we dereference its privileges.
	
2002-07-25  Frank Belew  <frb@ximian.com>

	* Makefile.am: add libredcarpet.a to libs, add libredcarpet to INCLUDES

2002-07-25  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (run_transaction): Properly handle dry runs.
	(run_transaction): If we just did a dry run, don't log the
	transaction and don't rescan the system packages.
	(dep_get_package_info_cb): Generate a text message for
	RC_RESOLVER_INFO_TYPE_OBSOLETES items.

	* rcd.c (option_parsing): Added the --undump command line option.
	(root_check): Allow non-root without complaining if we have
	undumped.
	(daemonize): Don't daemonize if we have undumped.
	(initialize_rc_world): If we have undumped, initialize the RCWorld
	from the dump file instead of from the machine's package db.
	(initialize_data): Don't download any channel info or
	subscriptions when we have undumped.
	(main): Don't start the heartbeat if we have undumped.

2002-07-24  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.c (run_server_thread): Set the Soup SSL certificate and
	start the server as an HTTPS server.

2002-07-23  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (root_check): Removed a FIXME that didn't really need
	fixing.

	* rcd-rpc-prefs.c (rcd_rpc_prefs_register_methods): Removed a
	FIXME; superuser is probably the right privilege level for
	set_prefs.

	* rcd-log.c (rcd_log): Removed a FIXME that didn't really need
	fixing.

	* rcd-log-entry.c (rcd_log_entry_parse): Skip log lines that
	appear to be malformed.

	* rcd-fetch.c (process_channel_cb): Only store the channel's
	package data if we were able to uncompress it and extract
	it's packages without any obvious errors.

2002-07-23  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (dep_get_package_info_cb): Get the version
	numbers from the RCResolverInfo structs.

2002-07-23  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-util.c (rcd_rc_channel_to_xmlrpc): Put the alias in
	the XML-RPCification of our channel.

	* rcd-pending.c (pending_cleanup_cb): Remove the unused id
	variable.

	* rcd.c (initialize_rc_world): Check for an error on the packman.
	Fail if we find one.

2002-07-23  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c (rcd_cache_entry_new): Initialize the fd to -1.
	(rcd_cache_entry_cancel): If the fd is -1, don't try to close it.

	* rcd-unix-server.c (read_data): Remove the unref from here.
	(conn_accept): And add it here, after we add the watch.

2002-07-23  Jon Trowbridge  <trow@ximian.com>

	* rcd-prefs.c (rcd_prefs_get_heartbeat_interval): Set the default
	heartbeat interval to 21600 (6 hours).
	(rcd_prefs_set_heartbeat_interval): Reject any attempt to set
	the heartbeat interval below 1800 (30 minutes).

2002-07-22  Jon Trowbridge  <trow@ximian.com>

	* rcd-identity.c (rcd_identity_remove_from_password_file): Chmod
	the password file after we re-open it.

	* rcd-rpc-users.c (users_remove): Added.  A wrapper around
	rcd_identity_remove_from_password_file.

2002-07-22  Joe Shaw  <joe@ximian.com>

	* rcd-unix-server.c (read_cred): Set the size of the length before
	calling getsockopt().  This should fix the occassional
	authentication problems on unix sockets.

2002-07-22  Jon Trowbridge  <trow@ximian.com>

	* rcd-pending.c (rcd_pending_cleanup): Re-enabled pending
	cleanup... the problem was not with this code.

	* rcd-fetch.c (rcd_fetch_channel): The ChannelFetchClosure needs
	to hold a reference to the channel.  This fixes a bug which was
	causing us to segfault when repeatedly refreshing the channel
	data.
	(process_channel_cb): Release the closure's reference on the
	channel.

	* rcd-rpc-packsys.c (refresh_channels_cb): Set id_list to NULL
	after we g_slist_free it, so that it won't get freed again in
	check_pending_status_cb.

2002-07-22  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.c (serialize_fault): Fix a compiler warning.
	(run_server_thread): Set the debug level of the "Starting server"
	message to MESSAGE instead of INFO.

	* rcd.c (debug_message_handler): Change the callback to match the new
	signature.  If the message is MESSAGE or more severe, syslog the
	message.
	(initialize_logging): Remove the old syslogging.

2002-07-22  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_transact): Block shutdowns, since we
	don't want to be quitting in the middle of a transaction.
	(run_transaction): After the transaction is finished, allow
	shutdowns again.

	* rcd.c (main): Add a signal handler for SIGTERM and SIGQUIT
	(signal_handler): Added, shuts down the daemon cleanly.

2002-07-22  Jon Trowbridge  <trow@ximian.com>

	* rcd-identity.c (identity_update_cb): Chmod the password file to
	600 after we re-open it.

2002-07-21  Jon Trowbridge  <trow@ximian.com>

	* rcd-pending.c (rcd_pending_cleanup): There seems to be some
	problem with the cleanup function (memory corruption), so I'm
	disabling it for now.

	* rcd-unix-server.c (rcd_unix_server_run_async): If our
	attempt to unlink the old socket path fails when we start up,
	the permission are probably wrong and our attempt to start
	rcd will most likely fail... so print a warning message that
	says so.

	* rcd-rpc.c (run_server_thread): Turn a g_error into
	an rc_debug and an exit.

	* rcd-pending.c (rcd_pending_cleanup): Added.  A static
	function that cleans up old RCDPending objects.
	(rcd_pending_new): Call rcd_pending_cleanup.
	(rcd_pending_lookup_by_id): Call rcd_pending_cleanup.  Mark
	the poll time.
	(get_all_ids_cb): Mark the poll time.
	(rcd_pending_get_all_active_ids): Call rcd_pending_cleanup.

2002-07-20  Joe Shaw  <joe@ximian.com>

	* rcd-transfer-http.c (http_done): Use my
	RCD_SOUP_MESSAGE_IS_ERROR() macro instead of the one in Soup,
	because we don't want to treat 300 responses (redirects) as
	errors.	

2002-07-19  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-util.h: Add RCD_RPC_FAULT_CANT_AUTHENTICATE, which is
	different from PERMISSION_DENIED.

	* rcd-rpc.c (serialize_fault): Rename from
	serialize_permission_fault() and take a fault code and string as
	parameters.

2002-07-19  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc.c (unix_rpc_callback): Only use the rc-passwd file
	if it is secure.
	(soup_rpc_callback): Cause authentication to fail if the
	rc-passwd file isn't secure.

	* rcd.c (main): Check our rc-passwd permissions/ownership right
	when we start up, so that any yelling occurs right away.

	* rcd-identity.c (rcd_identity_password_file_is_secure): Added.
	Check that the permissions/ownership of our rc-passwd aren't such
	that something bad could happen.  If we don't like what we see,
	yell.

	* rcd-rpc-users.c (users_update): Check usernames and
	passwords that are passed in as arguments to our method.

	* rcd-identity.c (rcd_identity_well_formed_username): Added.  Anal
	checking of usernames.
	(rcd_identity_well_formed_password): Added.  Anal checking of
	passwords.

	* rcd-rpc-packsys.c (packsys_package_dependency_info): Added.  A
	new method that returns provides, requires, conflicts and
	obsoletes information.
	(rcd_rpc_packsys_register_methods): Register our new method.

	* rcd-rpc-util.c (rcd_rc_package_dep_slist_to_xmlrpc): Added.
	(assemble_spec): Moved most of the heavy lifting from
	rcd_xmlrpc_to_rc_package_spec to here.
	(rcd_xmlrpc_to_rc_package_spec): Added.  Basically a wrapper
	around assemble_spec.
	(rcd_xmlrpc_to_rc_package_dep): Now uses assemble_spec for most of
	the work.

	* rcd-rpc-users.c (users_get_valid_privileges): Added.  Returns a 
	list of valid privileges.
	(rcd_rpc_users_register_methods): Register our new method.

2002-07-18  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (all_channels_cb): In the local case, if we have to
	fallback to fetching from the net, add the ids to the list.

	* rcd-rpc-packsys.c (check_pending_status_cb): Added.  Unlock the
	packsys lock if all of the transfers have finished.
	(refresh_channels_cb): Set up the check_pending_status_cb()
	handler.
	(packsys_refresh_all_channels): Check for a lock and throw a fault
	if we're locked.

	* rcd-rpc-util.h: Add a RCD_RPC_FAULT_LOCKED fault.

2002-07-17  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-util.c (rcd_rc_package_from_xmlrpc_package): If we don't
	have a channel associated, first check to see if the
	"package_data" key is set, because then we know it's actually a
	streamed package.  Else check for a "package_filename" key,
	because then we know it's actually a reference to a local file.
	Otherwise, check for system packages like usual.

2002-07-16  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c (rcd_prefs_get_proxy): Added.

	* rcd-transfer-http.c (http_done): Split out the mapping of Soup
	errors to RCDTransfer errors into a separate function and flesh it
	out a little more.
	(http_open): Get the proxy URL and set it.

2002-07-15  Joe Shaw  <joe@ximian.com>

	* gnome-config.c: Remove an unused function to avoid a compiler
	warning.

	* rcd-cache.c (normal_cache_filename_func): Write out the URI's
	querystring if present as well as the path for things like
	packages.php.

	* rcd-fetch.c (merge_paths): A horrible, horrible function to
	merge the broken paths we build in libredcarpet so we always
	download the right thing.
	(rcd_fetch_channel): Use merge_paths().  Check for an error after
	the rcd_transfer_begin().
	(download_package_file): Ditto.

	* rcd-prefs.c (rcd_prefs_get_host): Check RCX_MAGIC first.
	(rcd_prefs_get_premium): Added.  Checks RCX_MAGIC, then RC_MAGIC,
	then the configuration.

	* rcd-transfer-http.c (http_done): Map a few Soup errors to
	RCDTransfer errors.
	(http_info): Don't open a cache entry if we got a 401 or 407.
	(get_mid, get_secret): Added.  Get the MID and secret for a
	machine.
	(get_premium_uri): Added.  Reads the MID and secret and inserts
	them as username and password into the transfer URI.
	(http_open): Get rid of the ALLOW_RCX ifdef.  If we're in premium
	mode, call get_premium_uri(), otherwise use regular old
	soup_uri_new().

	* rcd-transfer.c (pending_file_data_cb): Only update by size if we
	know the file size.
	(pending_file_done_cb): If there was an error, call
	rcd_pending_fail() with the transfer error string.

	* rcd.c (option_parsing): Add a --debug/-d flag which takes a
	level of debugging, like red-carpet and rc-autopull.
	(initialize_logging): Set the display level to the debug level
	specified with the -d flag.  Still defaults to
	RC_DEBUG_LEVEL_INFO.

2002-07-12  Jon Trowbridge  <trow@ximian.com>

	* rcd-privileges.c: Make our first assigned privilege be 1<<1, so
	that the superuser privilege (~0) will always have a unique bit
	set.

	* rcd-rpc-users.c: Added.  Highly preliminary (and still broken)
	XML-RPC wrappers around account-manipulation info.

	* rcd-rpc-packsys.c (rcd_rpc_packsys_register_methods):
	Stringified our required privileges.
	(check_install_package_auth): Hacked to use the new privileges
	system.
	(check_remove_package_auth): Hacked to use the new privileges
	system.
	(check_install_package_auth): Hacked to use the new privileges
	system.

	* rcd-rpc-news.c (rcd_rpc_news_register_methods): Stringified our
	required privileges.

	* rcd-rpc-log.c (rcd_rpc_log_register_methods): Stringified our
	required privileges.

	* rcd.c (main): Call rcd_privileges_init(), which defines our base
	set of privileges.

	* rcd-rpc.c (unix_rpc_callback): Hacked to use new privileges
	system.
	(rcd_rpc_register_method): Hacked to use the new privileges
	system.  We now take as our third arg a string containing the
	required privileges.

	* rcd-identity.c: Changed throughout to use the RCDPrivileges
	bitmasks instead of the authorization lists.
	(rcd_identity_approve_action): Added.
	(rcd_identity_foreach_from_password_file): Added.  Iterates across
	user/password file.
	(rcd_identity_update_password_file): Added.  Adds or updates
	entries in the user/password file.
	(rcd_identity_remove_from_password_file): Added.  Removes entries
	from the user/password file.

	* rcd-auth.c: Killed off.

	* rcd-privileges.c: Added.  New, improved, all-singing all-dancing
	privileges system.

2002-07-12  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-util.h: Added a bunch of #defines for fault codes, to
	make things a lot more sane.

	* rcd-rpc.c, rcd-rpc-log.c, rcd-rpc-packsys.c, rcd-rpc-prefs.c,
	rcd-rpc-utils.c: Use the new defines for fault codes instead of
	numbers.

	* rcd-rpc-packsys.c (packsys_find_latest_version): Find the
	installed version on the system, and if a version found in a
	channel isn't newer, throw a PACKAGE_IS_NEWER fault.  If it isn't
	found at all, throw a PACKAGE_NOT_FOUND fault.
	(find_latest_version): Check to make sure the package we're
	iterating over is newer than the installed version, if there is
	one.

2002-07-12  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_solve_dependencies): Removed.  It's
	just silly to have two API calls for this.
	(packsys_resolve_dependencies): Require a third argument, for a
	list of extra requirements.

2002-07-11  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (resolve_deps): Take an RCPackageDepSList of
	extra dependencies to add to the resolver.
	(packsys_solve_dependencies): Given a list of deps, get a
	resolution which will solve them.
	(packsys_what_provides, packsys_what_requires,
	packsys_what_conflicts): Check for a fault after parsing the
	argument list to prevent a failed assertion if the data passed in
	is bad.

	* rcd-rpc-util.c (rcd_xmlrpc_array_to_rc_package_dep_slist): Added.

2002-07-11  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.packsys.c (resolve_deps): Instead of returning a list of
	packages to install or remove, return a list which contains
	packages, the operation to perform, and details on why it's being
	installed or removed.
	(rcd_rc_package_slist_to_xmlrpc_op_array): Added.  Given a list of
	packages and an RCResolver, create the operation array.
	(dep_get_package_info): Added.  Gets details on why a dependency
	is being added (ie, "depends on: libfoo")

2002-07-11  Jon Trowbridge  <trow@ximian.com>

	* rcd-unix-server.c (rcd_unix_server_run_async): Use
	g_return_val_if_fail instead of g_return_if_fail.

	* rcd-rpc-util.c (rcd_rc_package_spec_to_xmlrpc): Properly
	handle the has_epoch flag.
	(rcd_rc_package_dep_to_xmlrpc): Added.
	(rcd_xmlrpc_to_rc_package_dep): Added.

	* rcd-rpc-packsys.c (packsys_what_provides): Added.  XML-RPC
	wrapper around the rc_world_foreach_providing_package function.
	(packsys_what_requires): Added.  Wrapper around the
	rc_world_foreach_requiring_package function.
	(packsys_what_conflicts): Added. Wrapper around the
	rc_world_foreach_conflicting_package function.
	(rcd_rpc_packsys_register_methods): Register our new methods.

2002-07-10  Jon Trowbridge  <trow@ximian.com>

	* rcd-identity.c (rcd_identity_free): Free the password
	and the privileges list.

2002-07-10  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.c (unix_rpc_callback): Implicitly give all local users
	view rights unless specified otherwise in the password file.

2002-07-10  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c (rcd_prefs_get_host): Get the hostname from the
	DefaultFreeURL override before looking in the actual
	configuration.

	* rcd-rpc-packsys.c (packsys_dump): Compress the packaging data
	and send it down as binary data.

	* rcd-rpc.c (run_server_thread): Check the return code from
	rcd_unix_server_run_async() and error out if it doesn't work.

	* rcd-unix-server.c (rcd_unix_server_run_async): Now returns an
	integer; 0 on success.

2002-07-10  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (build_updates_list): Filter out updates to
	unsubscribed channels.
	(packsys_update_summary): Added.  An XML-RPC method that returns a
	summary of the number of available updates.  This allows us to
	quickly check for updates w/o having to send all of the update
	information across the wire.
	(rcd_rpc_packsys_register_methods): Register the
	rcd.packsys.update_summary method.

2002-07-09  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_dump): Added.  Takes an XML dump of
	the RCWorld and sends it down the wire.
	(rcd_rpc_packsys_register_methods): Register it.

2002-07-09  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.c (soup_shutdown_cb): Added.  Unrefs the soup server so
	it shuts down.
	(run_server_thread): Add the shutdown handler.

	* rcd-unix-server.c (shutdown_server_cb): Added.  Closes the
	listening socket and unlinks it.
	(rcd_unix_server_run_async): Add the shutdown handler.

2002-07-09  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (root_check): Even if the --allow-non-root option has been
	given, point out that things may fail to work when run w/o root
	privileges.

2002-07-08  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_transact): Take a boolean third
	argument to specify a "dry run".  It doesn't actually work yet, as
	there isn't a hook in libredcarpet for it yet.

2002-07-08  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-system.c (system_ping): Send distribution information
	over the wire.

	* rcd-unix-server.c (read_cred): Add some debugging output in the
	(supposedly impossible) case where getsockopt() returns a valid
	value, but the credentials passed through aren't there.

2002-07-08  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_channel, download_package_file): Use
	rc_maybe_merge_paths() to build the correct paths for downloading
	channel data and packages not on the host server.

	* rcd-rpc-packsys.c (resolve_deps): Get details on the dependency
	failure and send them along in the fault.

2002-07-08  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (main): Add a shutdown handler to quit the main loop.

	* rcd-rpc-system.c (system_shutdown): Added.  Glue for the
	shutdown method.
	(rcd_rpc_system_register_methods): Register rcd.system.shutdown.

	* rcd-shutdown.c: Added.  Code to handle cleanly shutting down the
	daemon.

2002-07-08  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Add gnome-config.[ch] and parse-path.cP.

	* rcd-prefs.c: Make all of the getters read from the config file
	and all the setters write to it.

	* gnome-config.[ch], parse-path.cP: Added.  Mostly cut-and-pasted
	from libgnome, because we don't have a good reason to have a
	dependency upon it.

2002-07-07  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Define SYSCONFDIR, install the rcd binary.

	* rcd-auth.c, rcd-rpc-packsys.c, rcd-rpc.c: Eliminate the
	RCD_ENFORCE_AUTH env check and always require authorization.

	* rcd-identity.c (rcd_identity_from_password_file): Read the
	rc-passwd file from SYSCONFDIR.  Skip over lines which begin with
	a # as comments.

	* rcd-rpc.c (unix_rpc_callback): Fix an errant assert.

2002-07-06  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (daemonize): Open our rcd-messages file here, and redirect
	stdout and stderr to it.
	(debug_message_handler): Just write debug messages to stderr.  If
	we are daemonized, it will already have been redirected to
	rcd-messages.

	* rcd-query.c (rcd_query_match_string_ci): Fixed stupid typo.

2002-07-05  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (daemonize): Re-open stdin, stdout, stderr to /dev/null.

	* rcd-cache.c: Replaced g_warning/g_error calls with rc_debug.

	* rcd-fetch.c: Replaced g_warning/g_error calls with rc_debug.

	* rcd-log.c: Replaced g_warning/g_error calls with rc_debug.

	* rcd-module.c: Replaced g_warning/g_error calls with rc_debug.

	* rcd-query.c: Replaced g_warning/g_error calls with rc_debug.

	* rcd-rpc-sample.c: Replaced g_warning/g_error calls with rc_debug.

	* rcd-rpc.c: Replaced g_warning/g_error calls with rc_debug.

	* rcd-unix-server.c: Replaced g_warning/g_error calls with rc_debug.

	* rcd.c: Replaced g_warning/g_error calls with rc_debug.

	* rcd-rpc.c (process_rpc_call): Don't measure the time it takes to
	process each call.  Replace some g_warnings with rc_debugs.
	(unix_rpc_callback): Replaced g_warning with rc_debug.
	(run_server_thread): Replaced g_warning with rc_debug.  Added a
	note indicating that if we can't start the RPC server, it is
	probably because another rcd process is already running.
	(rcd_rpc_register_method): Replaced g_warning with rc_debug.

	* rcd.c (option_parsing): Added.  Handles option processing with
	popt.
	(root_check): Added.  Check to make sure that the daemon is being
	run as root.  Complain if it isn't, unless the --allow-non-root
	was passed in on the command line.
	(daemonize): Fork, make a new process group for ourselves, close
	all file descriptors.  Unless rcd was run with --non-daemon on the
	command line, of course.
	(debug_message_handler): Write everything to /tmp/rcd-messages.
	(Or to stderr if we are running in non-daemon mode.)
	(initialize_logging): Put a notice that rcd has started in the
	system log.
	(initialize_rpc): Added.  Moved a few calls from main.
	(initialize_data): Added.  Also a small bit of code moved from
	main.  Today is gratuitous encapsulation day.

2002-07-03  Joe Shaw  <joe@ximian.com>

	* rcd-prefs.c: Add a bunch of "set" functions for many of the
	prefs.  Note that they don't do anything yet.

	* rcd-rpc-prefs.c: New file.  Adds three RPC calls:
	rcd.prefs.get_pref, rcd.prefs.set_pref, and rcd.prefs.list_prefs,
	which do the three things you'd expect them to.
	
	* rcd.c (main): Register the prefs RPC calls.

2002-07-03  Jon Trowbridge  <trow@ximian.com>

	* rcd-query.c (rcd_query_match_string_ci): Fixed memory leak.

	* rcd-log.c (cutoff_time_init, cutoff_time_match, rcd_log_query):
	Make the argument to the cutoff_time query part be a number of
	seconds in the past, instead of an absolute time.  Then we use
	this number, combined with the local time on the server, to
	compute the cut-off time. 

2002-07-03  Joe Shaw  <joe@ximian.com>

	* rcd-rpc.c (unix_rpc_callback): Serialize a permission fault if
	we can't get a username from the password file instead of
	asserting later.

2002-07-02  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_packages): Fetch the package signature as
	well.

	* rcd-prefs.c (rcd_prefs_get_require_verified_packages): Added.

	* rcd-rpc-packsys.c (verify_packages): Added.  Verifies package
	signatures and calls run_transaction() when successfully completed.
	(download_packages): Call verify_packages() instead of
	run_transaction().
	(resolve_deps): Move most of the logic from
	packsys_resolve_dependencies() here.
	(packsys_resolve_dependencies): Mostly a shell around
	resolve_deps().
	(package_verify_dependencies): Added.  Mostly a shell around
	resolve_deps().
	(rcd_rpc_packsys_register_methods): Register verify_dependencies.

2002-07-01  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-util.c (rcd_rc_package_to_xmlrpc): If the package
	we are XML-RPCifying is a syatem package, try to guess
	the channel of origin and put that information in the
	"channel_guess" field.

	* rcd-log.c (package_name_match): Make string matches
	case-insensitive.
	(host_match): Make string matches case-insensitive.
	(user_match): Make string matches case-insensitive.
	(action_match): Make string matches case-insensitive.

	* rcd-rpc-util.c (rcd_rc_package_to_xmlrpc): Fixed the check
	for whether or not the package was installed.

2002-07-01  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c: Make all the channel metadata functions reference
	last known good files in /var/lib/rcd, not the cache, and always
	write them out, even if caching is turned off.
	(all_channels_cb): If we can't get data for a channel locally,
	download it.

	* rcd-rpc.c (rcd_rpc_server_start): Split the server starting
	stuff out of the init function.

	* rcd.c (main): Always try the local functions for channel list,
	channel data, and news.  Remove a big FIXME since it's fixed,
	explicitly call the rpc server start function.

2002-07-01  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (find_latest_version): If subscribed_only is
	set, skip over packages in unsubscribed channels.
	(packsys_find_latest_version): Take a second parameter: whether to
	only return packages in subscribed channels.

2002-06-27  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (main): Added a FIXME comment about a potential caching
	bug.

	* rcd-query-packages.c (name_match): Use case-insensitive
	matching.
	(summary_match): Use case-insensitive matching.
	(description_match): Use case-insensitive matching.
	(text_match): Use case-insensitive matching.
	(channel_match): Use case-insensitive matching.

	* rcd-query.c: Added string versions of CONTAINS_WORD and
	NOT_CONTAINS_WORD to our query2str table.  Add query_str_folded
	to the "private" part of RCDQueryPart.
	(rcd_query_match_string): Support CONTAINS_WORD and
	NOT_CONTAINS_WORD operations.
	(rcd_query_match_string_ci): Added.  Does case-insensitive
	matching.
	(rcd_query_begin): Initialize query_str_folded in each part.
	(rcd_query_end): Free query_str_folded (as necessary) in
	each part.

	* rcd-query.h: Added RCD_QUERY_CONTAINS_WORD and
	RCD_QUERY_NOT_CONTAINS_WORD to RCDQueryType enum.

	* rcd-fetch.c (rcd_fetch_channel_list_local): Better resource
	cleanup.
	(rcd_fetch_news): Removed an extra g_free of the URL string ---
	thanks valgrind!

	* rcd-unix-server.c: Added license.

	* rcd-unix-server.h: Added license.

	* rcd-transfer-http.c: Fixed compiler warning and added license.
	
	* rcd-transfer-file.c: Added license.

	* rcd-rpc.h: Added license.

	* rcd-rpc-util.h: Added license.

	* rcd-rpc-util.c: Added license.

	* rcd-rpc-system.h: Added license.

	* rcd-rpc-sample.h: Added license.

	* rcd-rpc-sample.c: Fixed compiler warning and added license.

	* rcd-rpc-packsys.h: Added license.

	* rcd-rpc-packsys.c: Fixed compiler warning and added license.

	* rcd-query-packages.c: Fixed compiler warning.

	* rcd-news.h: Include time.h

	* rcd-news.c: Fixed compiler warning.

	* rcd-log.c: Fixed compiler warning.

	* rcd-log-entry.c: Fixed compiler warning.

	* rcd-fetch.c: Fixed compiler warning.

	* rcd-auth.c: Fixed compiler warning.

2002-06-26  Jon Trowbridge  <trow@ximian.com>

	* rcd-transfer.c (pending_file_data_cb): Update using
	rcd_pending_update_by_size.

	* rcd-rpc-system.c (system_poll_pending): Add the completed
	size and total size to our XML-RPC struct.

	* rcd-rpc-packsys.c (update_download_progress): Update our pending
	object with rcd_pending_update_by_size.

	* rcd-query-packages.c (text_match): Added.  An RCDQueryPart
	callback for matching a string against a package's name,
	summary or description.

	* rcd-pending.c (rcd_pending_init): Initialize completed_size and
	total_size to -1.
	(rcd_pending_update): Set completed_size and total_size to -1,
	invalidating them if they had been previously set by a call to
	rcd_pending_update_by_size.
	(rcd_pending_update_by_size): Added.  Updates an RCDPending by
	specifying the total size of the task and the amount of the task
	that has been completed.  The percentage complete is automatically
	calculated from those two quantities.
	(rcd_pending_get_completed_size): Added.  An accessor.
	(rcd_pending_get_total_size): Added.  An accessor.

2002-06-25  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c (rcd_cache_entry_cancel): Added.  Closes the cache
	entry, but does not make it valid in the cache.

	* rcd-fetch.c (rcd_fetch_packages): Return a numeric ID of the
	overall package transfer so it can be cancelled later.
	(rcd_fetch_packages_abort): Aborts the package transfers
	associated with an ID.

	* rcd-rpc-packsys.c (packsys_abort_download): Added.  Aborts a
	download of a package transaction.
	(rcd_rpc_packsys_register_methods): Register the
	rcd.packsys.abort_download call.

	* rcd-transfer-http.c (http_done): Only close the cache entry if
	the download was without error (including abort).  Otherwise,
	cancel the cache entry.
	(http_abort): Set the RCD_TRANSFER_ERROR_CANCELLED before
	cancelling the SoupMessage, and don't emit
	rcd_transfer_emit_done(), as that'll be done in http_done()
	unconditionally.

	* rcd-transfer.c (pending_file_done_cb): If the transfer was
	cancelled rcd_pending_abort() on the pending, otherwise
	rcd_pending_finished().

2002-06-25  Jon Trowbridge  <trow@ximian.com>

	* rcd-fetch.c (rcd_fetch_news): Doh!  It is an error if doc == NULL,
	not if doc != NULL.

	* rcd-query.c (query2str): Added 'begin-or' and 'end-or' string
	representations of RCD_QUERY_BEGIN_OR and RCD_QUERY_END_OR.
	Terminate the array with RCD_QUERY_INVALID, not RCD_QUERY_LAST.
	(rcd_query_type_from_string): Check for end of array by looking
	for RCD_QUERY_INVALID.
	(rcd_query_begin): Check that our begin-ors and end-ors balance
	properly.  When calling a part's ->initialize method, make
	sure the engine is non-NULL.
	(rcd_query_match): Handle ors.
	(rcd_query_end): When calling a part's ->finalize method,
	make sure the engine is non-NULL.

2002-06-24  Jon Trowbridge  <trow@ximian.com>

	* rcd-module.c (rcd_module_init): If the module dir doesn't
	exist, print a warning and return.

	* rcd-fetch.c (get_channel_list_url): Better error handling.
	(rcd_fetch_channel_list): Better error handling.
	(rcd_fetch_news): Better error handling.

	* rcd-rpc-packsys.c (packsys_subscribe): Return zero and undo the
	change if we couldn't save the subscriptions file to disk
	(packsys_unsubscribe): Return zero and undo the change if we
	couldn't save the subscriptions file to disk.

	* rcd-subscriptions.c (rcd_subscriptions_load): Changed to return
	a bool indicating whether the operation succeeded or failed.
	(rcd_subscriptions_save): Changed to return a bool indicating
	whether the operation succeeded or failed.

	* rcd-log.c (rcd_log_scan): Do the right thing if we encounter
	a zero-length log file.

	* rcd-fetch.c (rcd_fetch_all_channels): Return a list of
	pending ids for our channel downloads.

	* rcd-rpc-system.c (system_poll_pending): Send some more info
	about our pending object.
	(system_get_all_pending): Added.
	(rcd_rpc_system_register_methods): Register the get_all_pending
	method.

	* rcd-pending.c (rcd_pending_get_all_active_ids): Added.
	(rcd_pending_is_active): Added.

2002-06-19  Joe Shaw  <joe@ximian.com>

	* rcd-pending.c (rcd_pending_get_latest_message): Added.

	* rcd-rpc-packsys.c (transact_step_cb): We probably don't want to
	push the same message into the pending twice in a row.  Get's rid
	of the annoying "Removing" messages for each package removed in
	the client.
	(update_log): Added.  Logs the package transactions.
	(packsys_transact): Fix some package lifecycle issues.

	* rcd-rpc-util.c (rcd_rc_package_from_name,
	rcd_rc_package_from_xmlrpc_package): ref the package.

	* rcd-rpc.c (process_rpc_call, unix_rpc_callback,
	soup_rpc_callback): Pass along the client host making the call,
	along with the identity associated with the call.  Requires CVS
	Soup.

2002-06-18  Jon Trowbridge  <trow@ximian.com>

	* rcd-log.c: Added some comments describing our cutoff
	logic in more detail.

	* rcd.c (main): Fetch the news when we start up.

	* rcd-fetch.c (rcd_fetch_news): Added.  Download our RDF news.
	(rcd_fetch_news_local): Get the news from our local cache.

	* rcd-rpc-news.c: Added.  XML-RPC glue for news.

	* rcd-news.c: Added.  A simple structure to carry around
	news information, and code for maintaining a global news
	list.

2002-06-18  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (prepend_pkg): Don't add a package to be
	uninstalled to the hash if it's not already installed on the
	system.

	* rcd-rpc-util.c (rcd_debug_serialize): Make this a function from
	a #define so I can call it in gdb.

2002-06-17  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c: Resurrected packsys_resolve_dependencies().
	Given a list of packages to be installed and removed, it returns a
	list of additional packages to be installed and removed to satisfy
	dependencies.

2002-06-17  Jon Trowbridge  <trow@ximian.com>

	* rcd.c: Get rid of a warning by #including rcd-rpc-log.h

	* rcd-rpc-log.c: Added.  XML-RPC magic for log queries.

	* rcd.c (main): Register log methods.

	* rcd-rpc-util.c (rcd_rc_package_spec_to_xmlrpc): Made non-static
	so that I can use it in rcd-rpc-log.c.

	* rcd-query.c (rcd_query_begin): Set each part's 'processed' flag
	to FALSE.
	(rcd_query_match): Skip parts whose processed flag is TRUE.

	* rcd-log.c (rcd_log): Directly write out stringified log message,
	checking to make sure that the log file has been properly
	initialized.
	(rcd_log_query): Implements log querying, using the same
	QueryEngine/QueryParts framework as package queries.

	* rcd-log-entry.c (spec_to_str): Renamed from spec_str.  Changed
	log format to be more efficiently parseable.
	(split_on_vbar): A custom, high-efficiency line-splitter.
	(spec_from_str): Parse our a RCPackageSpec.
	(rcd_log_entry_parse): Implemented.  Parses log lines in a fairly
	efficient manner, without any memory allocs or frees.

2002-06-14  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_package_info): Added.  Returns
	details on a package necessary for an "rpm -qi" like command.
	(rcd_rpc_packsys_register_methods): Register the channel-refresh
	heartbeat func here, and check in the heartbeat func that a
	packaging system lock isn't held so we don't end up refreshing the
	channel data in the middle of a transaction.
	(run_transaction): Grab the lock at the start of the transaction
	and release it at the end, start the heartbeat after the modules
	have been loaded.

	* rcd.c: Moved the channel refreshing heartbeat func out of here.

2002-06-14  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c: When adding messages to an RCDPending, use
	strings that will be parsed by the client instead of user-visible
	strings, to keep localization issues out of the daemon and in the
	client where they belong.

	* rcd-transfer-file.c (file_get_local_filename): Return the full
	path to the file instead of just the filename.

2002-06-14  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c: Added _local functions which read channel data from
	only the cache and return success.

	* rcd.c (main): Try to load the channels off of disk first and
	then fetch from the net if they're unavailable.

2002-06-14  Joe Shaw  <joe@ximian.com>

	* rcd-cache.c: Mostly redone.  Most actions are now performed on a
	per-transfer RCDCacheEntry.  Entity tag and modification data are
	now kept in a in-memory cache.

	* rcd-transfer.c: Clean this up a ton, and make it more generic
	for protocol handlers.  Split out the file and http protocol
	handlers into their own files.

	* rcd-transfer-file.c, rcd-transfer-http.c: Added.

	* rcd-fetch.c: Update for all the cache and transfer API changes.

	* rcd-rpc-packsys.c (run_transaction): If caching is turned off,
	clean up the recently downloaded package files.
	(download_packages): Check to make sure the package_filename set
	in the package exists... if not, download the file again.

	* rcd-unix-server.c (rcd_unix_server_run_async): Check the return
	values from bind () and listen () and throw a warning about not
	being able to start the Unix server.

2002-06-13  Joe Shaw  <joe@ximian.com>

	* rcd-transfer.c (rcd_transfer_class_init): Change the marshal's
	arguments from STRING:INT to POINTER:UINT.  Since the data being
	passed through isn't null-terminated, it can't be passed around as
	a string.

2002-06-13  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (initialize_logging): Initialize our logfile.

	* rcd-log-entry.c: Added.  An object for holding log info.

	* rcd-log.c: Added.  Basic code to initialize logging and write
	RCDLogEntry items out to the log file.

2002-06-12  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_search): Renamed from packsys_query
	to match the design doc.
	(run_transaction): Send down the reason for the transaction
	failure in the message.

2002-06-12  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (build_updates_list): Send the relevant
	package update descriptions along with each update.

2002-06-12  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_packages): Take another callback to give
	progress on the file itself.

	* rcd-pending.c (rcd_pending_get_user_data,
	rcd_pending_set_user_data): Remove these... it's a GObject, so we
	can just use g_object_{set|get}_data().
	(rcd_pending_add_message, rcd_pending_get_messages): Added.
	Allows persistent messages to be set on an RCDPending so important
	info isn't lost in between polls.

	* rcd-rpc-packsys.c: Add messages to the pending object when we do
	important things, update it in package download progress callback.

	* rcd-rpc-system.c (system_poll_pending): Serialize the messages.

	* rcd-transfer.c: Use gsize for file sizes throughout.

2002-06-11  Joe Shaw  <joe@ximian.com>

	* rcd-fetch.c (rcd_fetch_packages): Added.  Downloads a list of
	packages and calls the provided callback when finished with all of
	them.

	* rcd-rpc-packsys.c (packsys_find_latest_version): Added.  Given a
	name, it finds the latest version in the available channels.
	(download_packages): Check to make sure we have packages to
	download and fire 'em off.
	(packsys_transact): If we don't need to download packages, begin
	the transaction.

	* rcd-rpc-util.c (rcd_rc_package_from_xmlrpc_package): Fix this up
	so it checks the channel before the installed bit.

	* rcd-transfer.c (http_done): Make sure we close the cache after
	we're done with the transfer.

	* rcd-unix-server.c (rcd_unix_server_run_async): Set ourselves up
	to ignore SIGPIPE.
	(read_data): Handle an error condition from g_io_channel_write()
	in the case of a SIGPIPE so we don't get ourselves into an
	infinite loop using 100% CPU.

2002-06-11  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-util.c (rcd_rc_package_to_xmlrpc): Pass along infomation
	about importance when a package is an update.

	* rcd-rpc-packsys.c (packsys_get_updates): Added.  Implements
	the XML-RPC get_updates method.
	(rcd_rpc_packsys_register_methods): Register the get_updates
	method.

2002-06-11  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_transact): Don't allow packages to be
	specified by name when doing an install, as it doesn't contain
	enough information to be really useful.

	* rcd-rpc-util.c (rcd_rc_package_to_xmlrpc): Change the
	"installed" flag to mean that there is a package installed on the
	system with the same name.

2002-06-07  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_refresh_all_channels): Added.

	* rcd.c (refresh_channels_cb): Load the subscriptions after
	refreshing the channel list so we maintain the correct
	subscription info.

2002-06-07  Jon Trowbridge  <trow@ximian.com>

	* rcd-transfer.c (rcd_transfer_finalize): Check for NULL to
	avoid a run-time glib warning.

2002-06-07  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c:
	* rcd-rpc.c:
	* rcd-unix-server.c: Fix up warnings

	* rcd.c (remove_channel_cb): Uncomment the remove channel call.
	Requires updated libredcarpet.

2002-06-06  Joe Shaw  <joe@ximian.com>

	* rcd-heartbeat.c: Added.  Runs a heartbeat process which modules
	can register against.

	* rcd-prefs.c (rcd_prefs_get_heartbeat_interval): Added.

	* rcd.c (main): Set up the heartbeat function for refreshing the
	channels and start it.

2002-06-05  Joe Shaw  <joe@ximian.com>

	* rcd-rpc-packsys.c (packsys_query_file): Call
	rc_xmlrpc_to_rc_package() and pass in the types we accept.
	(run_transaction): Re-get the system packages after a transaction.
	(package_transact): Call rc_xmlrpc_to_rc_packagE() and pass in the
	types we accept.
	(packsys_transaction_get_status): Removed.  We can just use
	rcd.system.poll_pending().
	(rcd_rpc_packsys_register_methods): Don't register
	transaction_get_status().

	* rcd-rpc-util.c (rcd_rc_package_spec_to_xmlrpc):
	XMLRPC_FAIL_IF_FAULT() after trying to get each element.
	(rcd_rc_package_from_name, rcd_rc_package_from_file,
	rcd_rc_package_from_streamed_package,
	rcd_rc_package_from_xmlrpc_package): Added these functions which
	take xmlrpc_values and somehow get RCPackage structures for them.
	_from_name() is still broken.  Haven't decided if I like this API
	yet.
	(rcd_xmlrpc_to_rc_package): Added.  Calls a number of the above
	functions depending on flags that were passed into it specifying
	the types to accept.
	(rcd_xmlrpc_array_to_rc_package_slist): Added.

	* rcd-unix-server.c (rcd_unix_server_run_async): Make the socket
	writable by all users.
	
2002-06-05  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (packsys_subscribe): Added.
	(packsys_unsubscribe): Added.
	(rcd_rpc_packsys_register_methods): Register our subscribe and
	unsubscribe methods.

2002-06-03  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (packsys_refresh_channel): Added.  Given a
	channel id, reloads the channel's package info.
	(rcd_rpc_packsys_register_methods): Register the refresh_channel
	method.

	* rcd-fetch.c (rcd_fetch_channel): Return the id of the RCDPending
	associated with the package info transfer.

	* rcd-rpc-system.c (system_ping): Return the system time along
	with the other 'ping' info.
	(system_poll_pending): Pass along more information from the
	RCDPending object.

2002-06-03  Joe Shaw  <joe@ximian.com>

	* rcd-auth.c (auth_action_requirements_met): Fix a braindead goto.

	* rcd-pending.c (rcd_pending_get_user_data,
	rcd_pending_set_user_data): Added.  Allows some user data to be
	associated with an RCDPending dingus.

	* rcd-rpc-packsys.c (packsys_query): If we get a RCD_QUERY_INVALID
	back from the conversion, set a fault.
	(packsys_transact, packsys_transaction_get_status): Reenabled, does
	authentication and uses RCDPending.

	* rcd-rpc-util.c (rcd_rc_package_to_xmlrpc): Drop the
	package_filename and signature_filename fields... a client
	shouldn't need to know these.
	(rcd_xmlrpc_streamed_array_to_rc_package_slist): Added.

	* rcd-rpc.c (process_rpc_call): Set the caller's identity.
	(rcd_rpc_get_caller_identity): Added, allows RPC calls to get
	their caller's identity.  I'm a little worried about reentrancy
	here, so spit out a warning if it ever happens.

	* rcd-unix-server.c (read_cred): Change debug output to only be
	one line.

2002-06-03  Jon Trowbridge  <trow@ximian.com>

	* rcd.c (initialize_logging): Get initial daemon output from the
	rcd_about_* functions.

	* rcd-module.c: Re-ordered #include directives.

	* rcd-unix-server.c: Re-ordered #include directives.

	* rcd-rpc.c: Re-ordered #include directives.

	* rcd-rpc-util.h: Added RCD_XMLRPC_STRUCT_GET_DOUBLE and
	RCD_XMLRPC_STRUCT_SET_DOUBLE macros.

	* rcd-rpc-util.c (rcd_xmlrpc_streamed_to_rc_package): Set package
	to NULL to silence compiler warning.

	* rcd-rpc-system.c (system_ping): Have ping return server info
	instead of just the time.
	(system_poll_pending): Added.  This allows us to poll for the
	status of pending operations to see what happened, allow us to
	update progress bars, etc.

	* rcd-fetch.c (rcd_fetch_channel_list): Make our channel list
	download be a blocking transfer.
	(rcd_fetch_channel): ...but make our channel package info download
	non-blocking.

	* rcd-transfer.c (rcd_transfer_finalize): Unref our RCDPending.
	(rcd_transfer_set_flags): Anal arg checking.
	(rcd_transfer_set_proxy_url): Anal arg checking.
	(rcd_transfer_get_pending): Accessor for our RCDPending.
	(rcd_transfer_get_error): Anal arg checking.
	(rcd_transfer_begin): If we aren't a blocking transfer (and don't
	explicitly say not to do so), create an RCDPending object and hook
	up the signals so that it will track the transfer's progress.
	Return the id of the RCDPending instead of a GByteArray.
	(rcd_transfer_begin_blocking): An explicit entry-point for
	blocking transfers, which won't create an RCDPending and returns a
	GByteArray.

	* rcd-transfer.h: Add an RCDPending to the RCDTransfer struct.

	* rcd-about.c: Added.  A place to hide important strings behind an
	simple API.

	* rcd-pending.c: Added.  A gadget for tracking the progress of
	long-running operations in the daemon.

2002-05-30  Joe Shaw  <joe@ximian.com>

	* rcd-auth.c (rcd_string_to_auth_action_list): Fix an invalid
	return type.

	* rcd-rpc-packsys.c (packsys_query_file): Uncomment this and bring
	it up to snuff, register the call.

	* rcd-rpc-util.c (rcd_xmlrpc_streamed_to_rc_package): Added.
	Takes either a filename or a streamed package, queries it, and
	returns an RCPackage instance.

	* rcd-unix-server.c (read_data): Only verify the credentials if
	they haven't been verified previously.

2002-05-30  Joe Shaw  <joe@ximian.com>

	* rcd-auth.c: Add a new special auth type, "superuser", which
	grants all rights to any user who has it.

	* rcd-rpc.c (process_rpc_call): Use the new preinvoke method code
	I added to xmlrpc-c to do access control.  It's a lot cleaner, and
	you can't subvert it by using system.multicall(). :)
	(access_control_check): Added.  Does an ACL lookup and check
	before all RPC calls and sets a fault if not approved.
	(unix_rpc_call): Implement identites for Unix domain RPC calls.

	* rcd-unix-server.c (RCDUnixServerCallback): Return a handle which
	contains both the method data and credential info.
	(read_cred): Check to make sure we got valid credentials and put
	that info in the handle.

2002-05-29  Joe Shaw  <joe@ximian.com>

	* rcd-auth.c: Made more extensible for modules by making ACLs
	GQuark based and passing around lists of GQuarks for privileges.

	* rcd-identity.c (rcd_identity_from_password_file):
	* rcd-rpc-packsys.c (rcd_rpc_packsys_register_methods):
	* rcd-rpc-sample.c (rcd_module_load): 
	* rcd-rpc-system.c (rcd_rpc_system_register_methods): Update to
	reflect changes in auth API.

	* rcd-module.c (rcd_module_init): Use rc_debug

	* rcd-prefs.c (rcd_prefs_get_host): Use RC_MAGIC if it is set.

	* rcd-rpc.c (process_rpc_call): Move some shared code between the
	protocols here.

2002-05-29  Jon Trowbridge  <trow@ximian.com>

	* rcd-rpc-packsys.c (packsys_get_channels): Added.
	(add_package_cb): Ref the package, so we don't leave a dangling
	pointer in our world later when we free the list and its contents.
	(rcd_rpc_packsys_register_methods): Register the get_channels
	method.

	* rcd-rpc-util.c (rcd_rc_channel_to_xmlrpc): Added.

	* rcd-query-packages.c: Added.  Implements package queries on top
	of the framework in rcd-query.c.

	* rcd-query.c: Abstracts this code into a generalized querying
	mechanism (which we will be able to also use for log & news
	queries).

	* rcd-subscriptions.c: Added.  Reads and writes the XML file
	containing the subscription information.

	* rcd-fetch.c (rcd_fetch_channel): Use
	rc_world_add_packages_from_buffer so that we get the full benefit
	of the SAX parser.

2002-05-28  Joe Shaw  <joe@ximian.com>

	* rcd-auth.c: Change RCDAuthAction to #defines which can be
	bitwise ORed.
	(rcd_auth_action_to_string): No longer const, can output a list of
	strings
	(rcd_string_to_auth_action): Parses a list of strings and returns
	an RCDAuthAction
	(rcd_auth_approve_action): Ease up on the argument restrictions
	for now.  If RCD_ENFORCE_AUTH is enabled, actually check
	privileges.

	* rcd-identity.c (rcd_identity_from_password_file): Added.  Looks
	for a user in the password file and returns an RCDIdentity with
	its username, password, and privileges.

	* rcd-rpc.c (rcd_rpc_init): Initialize a hash table for storing
	method info.
	(rcd_rpc_register_method): Take an RCDAuthAction parameter
	specifying the privileges required to call this method.  Add
	method info to the hash table.
	(soup_rpc_callback): Authenticate the user from HTTP Basic auth
	against an RCDIdentity from the password file.  Then look up the
	method info from the hash table and call rcd_auth_approve_action()
	to verify the privileges.

	* rcd-rpc-packsys.c (rcd_rpc_packsys_register_methods):
	* rcd-rpc-sample.c (rcd_module_load):
	* rcd-rpc-system.c (rcd_rpc_system_register_methods): Pass in
	privileges required to call these methods.

2002-05-28  Jon Trowbridge  <trow@ximian.com>

	* rcd.c: Added stuff to download channel and package info and to
	use a debug display handler.  Removed some old testing code.

	* rcd-transfer.c: Poked at the various bits of rc_debug-ism.

	* rcd-fetch.c: Added.  Some code for downloading channel and
	package information and storing it in the RCWorld.

	* rcd-cache.c (rcd_cache_open): Don't free cache_fn and tmp_fn
	until we've finished using them.

	* rcd-module.c: Changed to use rc_debug for spew.

	* rcd-prefs.c (rcd_prefs_get_cache_dir): Use a cache file under
	/tmp for now, so there is less warning spew when not running as
	root.

2002-05-24  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Add in rcd-rpc-packsys.[ch], rcd-rpc-util.[ch],
	rcd-unix-server.[ch]: Added these.

	* rcd-rpc.c (unix_rpc_callback): Handle an XML-RPC callback over
	unix domain sockets.
	(rpc_callback, default_callback): Prefix these functions with
	"soup_"
	(server_init): Removed this function, it wasn't long enough to be
	useful.
	(run_server_thread): Move the contents of server_init() here, add
	a call to rcd_unix_server_run_async() for handling requests over
	unix domain sockets.

	* rcd-rpc.h: Move header includes inside of the only-include-once
	#ifdef magic.

	* rcd-rpc-packsys.[ch]: Added.  Contains packaging system RPC
	calls (just query for now).

	* rcd-rpc-util.[ch]: Added.  Contains utility functions for
	converting an RCPackage or RCPackageSList to XML-RPC values and
	XML-RPC values into RCDQueryParts.

	* rcd-unix-server.[ch]: Added.  Lame first cut at doing XML-RPC
	calls over unix domain sockets.

	* rcd.c (initialize_rc_world): Register the packaging system RPC
	methods.

2002-05-24  Joe Shaw  <joe@ximian.com>

	* Makefile.am: Lots of magic

	* rcd-module.c: Added dynamic module loading.

	* rcd-rpc.c:
	* rcd-rpc-system.c:
	* rcd-rpc-sample.c: Added RPC framework with a sample module
	implementation and some system functions (query_module, ping,
	etc.)

	* rcd.c: Initialize the module loader, run a main loop.

2002-05-23  Jon Trowbridge  <trow@ximian.com>

	* rcd-query.c: Added a framework for complex queries.

