Index: daapsharing/rb-daap-connection.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/daapsharing/rb-daap-connection.c,v
retrieving revision 1.13
diff -p -u -r1.13 rb-daap-connection.c
--- daapsharing/rb-daap-connection.c	21 Jan 2006 05:56:51 -0000	1.13
+++ daapsharing/rb-daap-connection.c	24 Jan 2006 16:30:50 -0000
@@ -1,4 +1,5 @@
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
  *  Implementation of DAAP (iTunes Music Sharing) hashing, parsing, connection
  *
  *  Copyright (C) 2004,2005 Charles Schmidt <cschmidt2@emich.edu>
@@ -19,25 +20,35 @@
  *
  */
 
+#include "config.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <math.h>
+#ifdef HAVE_LIBZ
+#include <zlib.h>
+#endif
+
+#include <glib/gi18n.h>
+
+#include <libsoup/soup.h>
+#include <libsoup/soup-connection.h>
+#include <libsoup/soup-session-sync.h>
+#include <libsoup/soup-uri.h>
+
 #include "rb-daap-connection.h"
 #include "rb-daap-structure.h"
 #include "rb-daap-dialog.h"
 
-#include <libgnome/gnome-i18n.h>
 #include "rb-debug.h"
 
-#ifdef HAVE_LIBZ
-#include <zlib.h>
-#endif
+#define RB_DAAP_USER_AGENT "iTunes/4.6 (Windows; N)"
 
 /* hashing - based on/copied from libopendaap
  * Copyright (c) 2004 David Hammerton
  */
 
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-
 typedef struct {
     guint32 buf[4];
     guint32 bits[2];
@@ -517,15 +528,6 @@ rb_daap_hash_generate (short version_maj
 
 
 /* connection */
-#include <math.h>
-#include <libsoup/soup.h>
-#include <libsoup/soup-connection.h>
-#include <libsoup/soup-session-sync.h>
-
-#include <libsoup/soup-uri.h>
-
-#define RB_DAAP_USER_AGENT "iTunes/4.6 (Windows; N)"
-
 
 static GObject * rb_daap_connection_constructor (GType type, guint n_construct_properties,
 						 GObjectConstructParam *construct_properties);
Index: daapsharing/rb-daap-dialog.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/daapsharing/rb-daap-dialog.c,v
retrieving revision 1.3
diff -p -u -r1.3 rb-daap-dialog.c
--- daapsharing/rb-daap-dialog.c	11 Sep 2005 10:31:45 -0000	1.3
+++ daapsharing/rb-daap-dialog.c	24 Jan 2006 16:30:50 -0000
@@ -1,4 +1,5 @@
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
  *  Implementation of DAAP (iTunes Music Sharing) dialogs 
  *  (password & name collision)
  *
@@ -20,12 +21,16 @@
  *
  */
 
-#include "rb-daap-dialog.h"
-#include <gtk/gtk.h>
-#include <libgnome/gnome-i18n.h>
-#include <glib/gprintf.h>
+#include "config.h"
+
 #include <string.h>
 
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+#include <gtk/gtk.h>
+
+#include "rb-daap-dialog.h"
+
 static gchar *
 encode_base64 (const gchar *string)
 {
@@ -101,7 +106,8 @@ rb_daap_password_dialog_new_run (const g
 					      GTK_RESPONSE_OK,
 					      NULL);
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-	
+	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+
 	hbox = gtk_hbox_new (FALSE, 6);
 	gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
 	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
@@ -178,7 +184,8 @@ rb_daap_collision_dialog_new_run (const 
 					      GTK_RESPONSE_OK,
 					      NULL);
 	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-	
+	gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+
 	hbox = gtk_hbox_new (FALSE, 6);
 	gtk_container_set_border_width (GTK_CONTAINER (hbox), 12);
 	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
Index: daapsharing/rb-daap-mdns.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/daapsharing/rb-daap-mdns.c,v
retrieving revision 1.16
diff -p -u -r1.16 rb-daap-mdns.c
--- daapsharing/rb-daap-mdns.c	22 Jan 2006 11:59:16 -0000	1.16
+++ daapsharing/rb-daap-mdns.c	24 Jan 2006 16:30:50 -0000
@@ -1,4 +1,5 @@
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
  *  Implentation of Multicast DNS for DAAP sharing
  *
  *  Copyright (C) 2005 Charles Schmidt <cschmidt2@emich.edu>
@@ -19,19 +20,18 @@
  *
  */
 
-#include <config.h>
+#include "config.h"
 
-#include "rb-daap-mdns.h"
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib/gi18n.h>
 
-#include <libgnome/gnome-i18n.h>
+#include "rb-daap-mdns.h"
 #include "rb-dialog.h"
 #include "rb-debug.h"
 #include "eel-gconf-extensions.h"
 
-#include <string.h>
-#include <stdlib.h>
-
-
 GQuark
 rb_daap_mdns_error_quark (void)
 {
@@ -399,11 +399,13 @@ gboolean
 rb_daap_mdns_publish (RBDAAPmDNSPublisher *publisher,
 		      const gchar *name,
 		      guint port,
+		      gboolean password_required,
 		      RBDAAPmDNSPublisherCallback callback,
 		      gpointer user_data)
 {
 	sw_discovery discovery;
 	HowlPublishData *pub_data;
+	sw_text_record text_record;
 	sw_result result;
 	GError *error = NULL;
 
@@ -424,6 +426,15 @@ rb_daap_mdns_publish (RBDAAPmDNSPublishe
 	g_assert (our_service_name == NULL);
 	our_service_name = g_strdup (name);
 
+	if (sw_text_record_init (&text_record) != SW_OKAY) {
+		rb_debug ("Error initializing Howl text record");
+		return FALSE;
+	}
+
+	sw_text_record_add_key_and_string_value (text_record,
+						 "Password",
+						 password_required ? "true" : "false");
+
 	result = sw_discovery_publish (discovery,
 				       0,
 				       name,
@@ -431,12 +442,14 @@ rb_daap_mdns_publish (RBDAAPmDNSPublishe
 				       "local",
 				       NULL,
 				       port,
-				       NULL,
-				       0,
+				       sw_text_record_bytes (text_record),
+				       sw_text_record_len (text_record),
 				       (sw_discovery_publish_reply) publish_cb,
 	       			       (sw_opaque) pub_data,
 				       (sw_discovery_oid*) &pub_data->oid);
-		
+
+	sw_text_record_fina (text_record);
+
 	if (result != SW_OKAY) {
 		g_free (pub_data);
 		rb_debug ("Error starting mDNS publish with Howl: %s", howl_strerror (result));
@@ -801,27 +814,37 @@ typedef struct {
 	RBDAAPmDNSPublisherCallback callback;
 	gpointer data;
 	guint port;
+	gboolean password_required;
 } RBDAAPmDNSPublisherData;
 
 static gint
 add_service (AvahiEntryGroup *group,
 	     const gchar *name,
-	     guint port)
+	     guint port,
+	     gboolean password_required)
 {
 	gint ret;
-	
-	ret = avahi_entry_group_add_service (group,
-					     AVAHI_IF_UNSPEC,
-					     AVAHI_PROTO_INET,
+	AvahiStringList *str_list;
+
+	str_list = avahi_string_list_new ("", NULL);
+	str_list = avahi_string_list_add_pair (str_list,
+					       "Password",
+					       password_required ? "true" : "false");
+
+	ret = avahi_entry_group_add_service_strlst (group,
+						    AVAHI_IF_UNSPEC,
+						    AVAHI_PROTO_INET,
 #ifdef HAVE_AVAHI_0_6
-					     AVAHI_PUBLISH_USE_MULTICAST,
+						    AVAHI_PUBLISH_USE_MULTICAST,
 #endif
-					     name,
-					     "_daap._tcp",
-					     NULL,
-					     NULL,
-					     port,
-					     NULL);
+						    name,
+						    "_daap._tcp",
+						    NULL,
+						    NULL,
+						    port,
+						    str_list);
+
+	avahi_string_list_free (str_list);
 
 	if (ret < 0) {
 		return ret;
@@ -848,10 +871,10 @@ entry_group_cb (AvahiEntryGroup *group,
 		
 		new_name = (pub_data->callback) (
 				(RBDAAPmDNSPublisher)pub_data,
-				RB_DAAP_MDNS_PUBLISHER_COLLISION, 
+				RB_DAAP_MDNS_PUBLISHER_COLLISION,
 				pub_data->data);
 		
-		ret = add_service (group, new_name, pub_data->port);
+		ret = add_service (group, new_name, pub_data->port, pub_data->password_required);
 
 		g_free (new_name);
 
@@ -867,6 +890,7 @@ gboolean
 rb_daap_mdns_publish (RBDAAPmDNSPublisher *publisher,
 		      const gchar *name,
 		      guint port,
+		      gboolean password_required,
 		      RBDAAPmDNSPublisherCallback callback,
 		      gpointer user_data)
 {
@@ -887,6 +911,7 @@ rb_daap_mdns_publish (RBDAAPmDNSPublishe
 	*publisher = (RBDAAPmDNSPublisher) pub_data;
 	pub_data->callback = callback;
 	pub_data->port = port;
+	pub_data->password_required = password_required;
 	pub_data->data = user_data;
 	
 	pub_data->eg = avahi_entry_group_new (client,
@@ -899,7 +924,7 @@ rb_daap_mdns_publish (RBDAAPmDNSPublishe
 		return FALSE;
 	}
 
-	ret = add_service (pub_data->eg, name, port);
+	ret = add_service (pub_data->eg, name, port, password_required);
 	
 	if (ret < 0) {
 		g_free (pub_data);
Index: daapsharing/rb-daap-mdns.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/daapsharing/rb-daap-mdns.h,v
retrieving revision 1.5
diff -p -u -r1.5 rb-daap-mdns.h
--- daapsharing/rb-daap-mdns.h	16 Nov 2005 08:28:36 -0000	1.5
+++ daapsharing/rb-daap-mdns.h	24 Jan 2006 16:30:50 -0000
@@ -96,6 +96,7 @@ gboolean
 rb_daap_mdns_publish (RBDAAPmDNSPublisher *publisher,
 		      const gchar *name,
 		      guint port,
+                      gboolean password_required,
 		      RBDAAPmDNSPublisherCallback callback,
 		      gpointer user_data);
 
Index: daapsharing/rb-daap-share.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/daapsharing/rb-daap-share.c,v
retrieving revision 1.13
diff -p -u -r1.13 rb-daap-share.c
--- daapsharing/rb-daap-share.c	8 Jan 2006 11:05:23 -0000	1.13
+++ daapsharing/rb-daap-share.c	24 Jan 2006 16:30:50 -0000
@@ -20,7 +20,7 @@
  *
  */
 
-#include <config.h>
+#include "config.h"
 
 #include <time.h>
 #include <string.h>
@@ -32,6 +32,7 @@
 #include <libsoup/soup-message.h>
 #include <libsoup/soup-uri.h>
 #include <libsoup/soup-server.h>
+#include <libsoup/soup-server-auth.h>
 #include <libsoup/soup-server-message.h>
 #include <libgnomevfs/gnome-vfs.h>
 
@@ -66,16 +67,22 @@ static void rb_daap_share_playlist_destr
 static void rb_daap_share_forget_playlist (gpointer data,
 					   RBDAAPShare *share);
 
-
-#define CONF_NAME CONF_PREFIX "/sharing/share_name"
 #define STANDARD_DAAP_PORT 3689
 
 /* HTTP chunk size used to send files to clients */
 #define DAAP_SHARE_CHUNK_SIZE	16384
 
+typedef enum {
+	RB_DAAP_SHARE_AUTH_METHOD_NONE              = 0,
+	RB_DAAP_SHARE_AUTH_METHOD_NAME_AND_PASSWORD = 1,
+	RB_DAAP_SHARE_AUTH_METHOD_PASSWORD          = 2
+} RBDAAPShareAuthMethod;
+
 struct RBDAAPSharePrivate {
 	gchar *name;
 	guint port;
+	char *password;
+	RBDAAPShareAuthMethod auth_method;
 
 	/* mdns/dns-sd publishing things */
 	gboolean published;
@@ -111,6 +118,7 @@ typedef struct {
 enum {
 	PROP_0,
 	PROP_NAME,
+	PROP_PASSWORD,
 	PROP_DB,
 	PROP_PLAYLIST_MANAGER
 };
@@ -136,6 +144,13 @@ rb_daap_share_class_init (RBDAAPShareCla
 							      NULL,
 							      G_PARAM_READWRITE));
 	g_object_class_install_property (object_class,
+					 PROP_PASSWORD,
+					 g_param_spec_string ("password",
+							      "Authentication password",
+							      "Authentication password",
+							      NULL,
+							      G_PARAM_READWRITE));
+	g_object_class_install_property (object_class,
 					 PROP_DB,
 					 g_param_spec_object ("db",
 							      "RhythmDB",
@@ -159,6 +174,89 @@ rb_daap_share_init (RBDAAPShare *share)
 	share->priv = RB_DAAP_SHARE_GET_PRIVATE (share);
 
 	share->priv->revision_number = 5;
+
+	share->priv->auth_method = RB_DAAP_SHARE_AUTH_METHOD_NONE;
+}
+
+static void
+rb_daap_share_set_name (RBDAAPShare *share,
+			const char  *name)
+{
+	gboolean restart_publish = FALSE;
+
+	g_return_if_fail (share != NULL);
+
+	/* check if the name hasn't really changed */
+	if (share->priv->name && name &&
+	    strcmp (name, share->priv->name) == 0) {
+		return;
+	}
+	
+	if (share->priv->published) {
+		rb_daap_share_stop_publish (share);
+		restart_publish = TRUE;
+	}
+
+	g_free (share->priv->name);
+	share->priv->name = g_strdup (name);
+
+	if (restart_publish) {
+		rb_daap_share_start_publish (share);
+	}
+}
+
+static void
+rb_daap_share_set_password (RBDAAPShare *share,
+			    const char  *password)
+{
+	gboolean restart_publish = FALSE;
+
+	g_return_if_fail (share != NULL);
+
+	if (share->priv->password && password &&
+	    strcmp (password, share->priv->password) == 0) {
+		return;
+	}
+
+	if (share->priv->published) {
+		rb_daap_share_stop_publish (share);
+		restart_publish = TRUE;
+	}
+
+	g_free (share->priv->password);
+	share->priv->password = g_strdup (password);
+	if (password != NULL) {
+		share->priv->auth_method = RB_DAAP_SHARE_AUTH_METHOD_PASSWORD;
+	} else {
+		share->priv->auth_method = RB_DAAP_SHARE_AUTH_METHOD_NONE;
+	}
+
+	if (restart_publish) {
+		rb_daap_share_start_publish (share);
+	}
+}
+
+static void
+rb_daap_share_set_playlist_manager (RBDAAPShare       *share,
+				    RBPlaylistManager *playlist_manager)
+{
+	GList *playlists;
+
+	g_return_if_fail (share != NULL);
+
+	share->priv->playlist_manager = playlist_manager;
+
+	g_signal_connect_object (G_OBJECT (share->priv->playlist_manager),
+				 "playlist_added",
+				 G_CALLBACK (rb_daap_share_playlist_created),
+				 share, 0);
+
+	/* Currently, there are no playlists when this object is created, but in
+	 * case it changes..
+	 */
+	playlists = rb_playlist_manager_get_playlists (share->priv->playlist_manager);
+	g_list_foreach (playlists, (GFunc) rb_daap_share_process_playlist, share);
+	g_list_free (playlists);
 }
 
 static void
@@ -170,52 +268,17 @@ rb_daap_share_set_property (GObject *obj
 	RBDAAPShare *share = RB_DAAP_SHARE (object);
 
 	switch (prop_id) {
-	case PROP_NAME: {
-		gboolean restart_publish = FALSE;
-		const char *name = g_value_get_string (value);
-
-		/* check if the name hasn't really changed */
-		if (share->priv->name && name &&
-		    strcmp (name, share->priv->name) == 0) {
-			return;
-		}
-	
-		if (share->priv->name) {
-			g_free (share->priv->name);
-
-			if (share->priv->published) {
-				rb_daap_share_stop_publish (share);
-				restart_publish = TRUE;
-			}
-		}
-
-		share->priv->name = g_strdup (name);
-
-		if (restart_publish) {
-			rb_daap_share_start_publish (share);
-		}
-
+	case PROP_NAME:
+		rb_daap_share_set_name (share, g_value_get_string (value));
+		break;
+	case PROP_PASSWORD:
+		rb_daap_share_set_password (share, g_value_get_string (value));
 		break;
-	}
 	case PROP_DB:
 		share->priv->db = g_value_get_object (value);
 		break;
 	case PROP_PLAYLIST_MANAGER:
-		{
-			GList *playlists;
-			share->priv->playlist_manager = g_value_get_object (value);
-			g_signal_connect_object (G_OBJECT (share->priv->playlist_manager),
-						 "playlist_added",
-						 G_CALLBACK (rb_daap_share_playlist_created),
-						 share, 0);
-
-			/* Currently, there are no playlists when this object is created, but in
-			 * case it changes..
-			 */
-			playlists = rb_playlist_manager_get_playlists (share->priv->playlist_manager);
-			g_list_foreach (playlists, (GFunc) rb_daap_share_process_playlist, share);
-			g_list_free (playlists);
-		}
+		rb_daap_share_set_playlist_manager (share, g_value_get_object (value));
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -235,6 +298,9 @@ rb_daap_share_get_property (GObject *obj
 	case PROP_NAME:
 		g_value_set_string (value, share->priv->name);
 		break;
+	case PROP_PASSWORD:
+		g_value_set_string (value, share->priv->password);
+		break;
 	case PROP_DB:
 		g_value_set_object (value, share->priv->db);
 		break;
@@ -342,7 +408,8 @@ rb_daap_share_dispose (GObject *object)
 
 
 RBDAAPShare *
-rb_daap_share_new (const gchar *name,
+rb_daap_share_new (const char *name,
+		   const char *password,
 		   RhythmDB *db,
 		   RBPlaylistManager *playlist_manager)
 {
@@ -350,6 +417,7 @@ rb_daap_share_new (const gchar *name,
 
 	share = RB_DAAP_SHARE (g_object_new (RB_TYPE_DAAP_SHARE,
 					     "name", name,
+					     "password", password,
 					     "db", db,
 					     "playlist-manager", playlist_manager,
 					     NULL));
@@ -387,7 +455,7 @@ message_set_from_rb_daap_structure (Soup
 	resp = rb_daap_structure_serialize (structure, &length);
 
 	if (resp == NULL) {
-		g_print ("serialize gave us null?\n");
+		rb_debug ("serialize gave us null?\n");
 		return;
 	}
 
@@ -444,7 +512,7 @@ server_info_cb (RBDAAPShare *share, 
 	 * 3.0 is 2/3
 	 */
 	rb_daap_structure_add (msrv, RB_DAAP_CC_MINM, share->priv->name);
-	rb_daap_structure_add (msrv, RB_DAAP_CC_MSAU, 0);
+	rb_daap_structure_add (msrv, RB_DAAP_CC_MSAU, share->priv->auth_method);
 	/* authentication method
 	 * 0 is nothing
 	 * 1 is name & password
@@ -541,7 +609,7 @@ update_cb (RBDAAPShare *share,
 	revision_number_position = strstr (path, "revision-number=");
 
 	if (revision_number_position == NULL) {
-		g_print ("client asked for an update without a revision number?!?\n");
+		rb_debug ("client asked for an update without a revision number?!?\n");
 		g_free (path);
 		return;
 	}
@@ -772,7 +840,7 @@ add_entry_to_mlcl (RhythmDBEntry *entry,
 	if (client_requested (mb->bits, SONG_TRACK_NUMBER))
 		rb_daap_structure_add (mlit, RB_DAAP_CC_ASTN, (gint32) rhythmdb_entry_get_ulong (entry, RHYTHMDB_PROP_TRACK_NUMBER));
 	if (client_requested (mb->bits, SONG_USER_RATING))
-		rb_daap_structure_add (mlit, RB_DAAP_CC_ASUR, 0); // fixme
+		rb_daap_structure_add (mlit, RB_DAAP_CC_ASUR, 0); /* FIXME */
 	if (client_requested (mb->bits, SONG_YEAR))
 		rb_daap_structure_add (mlit, RB_DAAP_CC_ASYR, 0);
 	
@@ -910,7 +978,7 @@ databases_cb (RBDAAPShare *share, 
 {
 	gchar *path;
 	gchar *rest_of_path;
-//	guint revision_number;
+	/*guint revision_number;*/
 	
 	path = soup_uri_to_string (soup_message_get_uri (message), TRUE);
 
@@ -1112,7 +1180,7 @@ databases_cb (RBDAAPShare *share, 
 			GnomeVFSFileOffset range;
 			gchar *content_range;
 			
-			s = range_header + 6; // bytes=
+			s = range_header + 6; /* bytes= */
 			range = atoll (s);
 			
 			result = gnome_vfs_seek (handle, GNOME_VFS_SEEK_START, range);
@@ -1140,7 +1208,7 @@ databases_cb (RBDAAPShare *share, 
 		soup_server_message_set_encoding (SOUP_SERVER_MESSAGE (message), SOUP_TRANSFER_CHUNKED);
 
 	} else {
-		g_print ("unhandled: %s\n", path);
+		rb_debug ("unhandled: %s\n", path);
 	}
 	
 out:
@@ -1172,6 +1240,7 @@ server_cb (SoupServerContext *context,
 	guint i;
 
 	path = soup_uri_to_string (soup_message_get_uri (message), TRUE);
+	rb_debug ("request for %s", path);
 
 	for (i = 0; i < G_N_ELEMENTS (paths_to_functions); i++) {
 		if (g_ascii_strncasecmp (paths_to_functions[i].path, path, paths_to_functions[i].path_length) == 0) {
@@ -1258,11 +1327,39 @@ publish_cb (RBDAAPmDNSPublisher publishe
 	return NULL;
 }
 
+static gboolean
+soup_auth_callback (SoupServerAuthContext *auth_ctx,
+                    SoupServerAuth        *auth,
+                    SoupMessage           *message,
+                    RBDAAPShare           *share)
+{
+	const char *username;
+	gboolean    matched;
+	char       *path;
+
+	path = soup_uri_to_string (soup_message_get_uri (message), TRUE);
+	rb_debug ("Auth request for %s", path);
+	g_free (path);
+
+	if (! auth) {
+		return FALSE;
+	}
+
+	username = soup_server_auth_get_user (auth);
+	rb_debug ("Auth request for %s", username);
+
+	matched = soup_server_auth_check_passwd (auth, share->priv->password);
+
+	return matched;
+}
+
 static void
 rb_daap_share_start_publish (RBDAAPShare *share)
 {
 	gint port = STANDARD_DAAP_PORT;
 	gboolean ret;
+	gboolean password_required;
+	SoupServerAuthContext auth_ctx = { 0 };
 
 	share->priv->server = soup_server_new (SOUP_SERVER_PORT, port, NULL);
 	if (share->priv->server == NULL) {
@@ -1278,6 +1375,34 @@ rb_daap_share_start_publish (RBDAAPShare
 	share->priv->port = soup_server_get_port (share->priv->server);
 	rb_debug ("Started DAAP server on port %d", port);
 
+	password_required = (share->priv->auth_method != RB_DAAP_SHARE_AUTH_METHOD_NONE);
+
+	if (password_required) {
+		auth_ctx.types = SOUP_AUTH_TYPE_BASIC;
+		auth_ctx.callback = (SoupServerAuthCallbackFn)soup_auth_callback;
+		auth_ctx.user_data = share;
+		auth_ctx.basic_info.realm = "Music Sharing";
+
+		soup_server_add_handler (share->priv->server, 
+					 "/login",
+					 &auth_ctx, 
+					 (SoupServerCallbackFn)server_cb,
+					 NULL,
+					 share);
+		soup_server_add_handler (share->priv->server, 
+					 "/update",
+					 &auth_ctx, 
+					 (SoupServerCallbackFn)server_cb,
+					 NULL,
+					 share);
+		soup_server_add_handler (share->priv->server, 
+					 "/databases",
+					 &auth_ctx, 
+					 (SoupServerCallbackFn)server_cb,
+					 NULL,
+					 share);
+	}
+
 	soup_server_add_handler (share->priv->server, 
 				 NULL, 
 				 NULL, 
@@ -1289,6 +1414,7 @@ rb_daap_share_start_publish (RBDAAPShare
 	ret = rb_daap_mdns_publish (&(share->priv->publisher),
 				    share->priv->name,
 				    share->priv->port,
+				    password_required,
 				    (RBDAAPmDNSPublisherCallback) publish_cb,
 				    share);
 	
@@ -1328,7 +1454,7 @@ rb_daap_share_stop_publish (RBDAAPShare 
 		 * GLib-CRITICAL **: g_main_loop_quit: assertion `loop != NULL' failed
 		 * But it doesn't seem to matter.
 		 */
-//		soup_server_quit (share->priv->server);
+		/*soup_server_quit (share->priv->server); */
 		g_object_unref (G_OBJECT (share->priv->server));
 		share->priv->server = NULL;
 	}
Index: daapsharing/rb-daap-share.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/daapsharing/rb-daap-share.h,v
retrieving revision 1.1
diff -p -u -r1.1 rb-daap-share.h
--- daapsharing/rb-daap-share.h	6 Sep 2005 07:15:31 -0000	1.1
+++ daapsharing/rb-daap-share.h	24 Jan 2006 16:30:50 -0000
@@ -47,13 +47,12 @@ typedef struct {
 	GObjectClass parent;
 } RBDAAPShareClass;
 
-GType 
-rb_daap_share_get_type (void);
+GType         rb_daap_share_get_type (void);
 
-RBDAAPShare * 
-rb_daap_share_new (const gchar *name, 
-		   RhythmDB *db, 
-		   RBPlaylistManager *playlist_manager);
+RBDAAPShare * rb_daap_share_new      (const char *name, 
+                                      const char *password,
+                                      RhythmDB *db, 
+                                      RBPlaylistManager *playlist_manager);
 
 #endif /* __RB_DAAP_SHARE_H */
 
Index: daapsharing/rb-daap-sharing.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/daapsharing/rb-daap-sharing.c,v
retrieving revision 1.3
diff -p -u -r1.3 rb-daap-sharing.c
--- daapsharing/rb-daap-sharing.c	15 Sep 2005 05:04:06 -0000	1.3
+++ daapsharing/rb-daap-sharing.c	24 Jan 2006 16:30:50 -0000
@@ -1,4 +1,5 @@
-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
  *  Implmentation of DAAP (iTunes Music Sharing) sharing
  *
  *  Copyright (C) 2005 Charles Schmidt <cschmidt2@emich.edu>
@@ -19,12 +20,13 @@
  *
  */
 
-#include <config.h>
+#include "config.h"
 
-#include <libgnome/gnome-i18n.h>
-#include <glib/gprintf.h>
 #include <string.h>
 
+#include <glib/gi18n.h>
+#include <glib/gprintf.h>
+
 #include "rb-daap-sharing.h"
 #include "rb-daap-share.h"
 #include "rb-debug.h"
@@ -33,24 +35,25 @@
 #include "eel-gconf-extensions.h"
 #include "rb-preferences.h"
 
-#define CONF_ENABLE_SHARING CONF_PREFIX "/sharing/enable_sharing"
-#define CONF_SHARE_NAME CONF_PREFIX "/sharing/share_name"
-
 static RBDAAPShare *share = NULL;
 static guint enable_sharing_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
+static guint require_password_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
 static guint share_name_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
+static guint share_password_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
 
 static void 
 create_share (RBShell *shell)
 {
 	RhythmDB *db;
 	RBPlaylistManager *playlist_manager;
-	gchar *name;
+	char *name;
+        char *password;
+	gboolean require_password;
 
 	g_assert (share == NULL);
 	rb_debug ("initialize daap sharing\n");
 
-	name = eel_gconf_get_string (CONF_SHARE_NAME);
+	name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
 
 	if (name == NULL || *name == '\0') {
 		const gchar *real_name;
@@ -63,13 +66,22 @@ create_share (RBShell *shell)
 		}
 
 		name = g_strdup_printf (_("%s's Music"), real_name);
-		eel_gconf_set_string (CONF_SHARE_NAME, name);
+		eel_gconf_set_string (CONF_DAAP_SHARE_NAME, name);
 	}
 
 	g_object_get (G_OBJECT (shell), "db", &db, "playlist-manager", &playlist_manager, NULL);
 
-	share = rb_daap_share_new (name, db, playlist_manager);
+	require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
+	if (require_password) {
+		password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
+	} else {
+		password = NULL;
+	}
+
+	share = rb_daap_share_new (name, password, db, playlist_manager);
+
 	g_free (name);
+	g_free (password);
 }
 
 static void 
@@ -80,31 +92,87 @@ enable_sharing_changed_cb (GConfClient *
 {
 	gboolean enabled;
 
-	enabled = eel_gconf_get_boolean (CONF_ENABLE_SHARING);
+	enabled = eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING);
 
 	if (enabled) {
-		if (share == NULL)
+		if (share == NULL) {
 			create_share (shell);
+		}
 	} else {
 		rb_debug ("shutdown daap sharing");
 
-		if (share)
+		if (share) {
 			g_object_unref (share);
+		}
 		share = NULL;
 	}
 }
 
 static void 
+require_password_changed_cb (GConfClient *client,
+			     guint cnxn_id,
+			     GConfEntry *entry,
+			     RBShell *shell)
+{
+	gboolean required;
+	char    *password;
+
+	if (share == NULL) {
+		return;
+	}
+
+	required = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
+
+	if (required) {
+		password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
+	} else {
+		password = NULL;
+	}
+
+	g_object_set (G_OBJECT (share), "password", password, NULL);
+	g_free (password);
+}
+
+static void 
 share_name_changed_cb (GConfClient *client, 
 		       guint cnxn_id, 
 		       GConfEntry *entry, 
 		       RBShell *shell)
 {
-	if (share) {
-		gchar *name = eel_gconf_get_string (CONF_SHARE_NAME);;
-		g_object_set (G_OBJECT (share), "name", name, NULL);
-		g_free (name);
+	char *name;
+
+	if (share == NULL) {
+		return;
+	}
+
+	name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
+	g_object_set (G_OBJECT (share), "name", name, NULL);
+	g_free (name);
+}
+
+static void 
+share_password_changed_cb (GConfClient *client, 
+			   guint cnxn_id, 
+			   GConfEntry *entry, 
+			   RBShell *shell)
+{
+	gboolean require_password;
+	char    *password;
+
+	if (share == NULL) {
+		return;
+	}
+
+	require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
+
+	/* Don't do anything unless we require a password */
+	if (! require_password) {
+		return;
 	}
+
+	password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
+	g_object_set (G_OBJECT (share), "password", password, NULL);
+	g_free (password);
 }
 
 
@@ -113,18 +181,26 @@ rb_daap_sharing_init (RBShell *shell)
 {
 	g_object_ref (shell);
 
-	if (eel_gconf_get_boolean (CONF_ENABLE_SHARING)) {
+	if (eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING)) {
 		create_share (shell);
 	}
 
 	enable_sharing_notify_id =
-		eel_gconf_notification_add (CONF_ENABLE_SHARING,
+		eel_gconf_notification_add (CONF_DAAP_ENABLE_SHARING,
 					    (GConfClientNotifyFunc) enable_sharing_changed_cb,
 					    shell);
+	require_password_notify_id =
+		eel_gconf_notification_add (CONF_DAAP_REQUIRE_PASSWORD,
+					    (GConfClientNotifyFunc) require_password_changed_cb,
+					    shell);
 	share_name_notify_id =
-		eel_gconf_notification_add (CONF_ENABLE_SHARING,
+		eel_gconf_notification_add (CONF_DAAP_SHARE_NAME,
 					    (GConfClientNotifyFunc) share_name_changed_cb,
 					    shell);
+	share_password_notify_id =
+		eel_gconf_notification_add (CONF_DAAP_SHARE_PASSWORD,
+					    (GConfClientNotifyFunc) share_password_changed_cb,
+					    shell);
 }
 
 void 
@@ -141,9 +217,17 @@ rb_daap_sharing_shutdown (RBShell *shell
 		eel_gconf_notification_remove (enable_sharing_notify_id);
 		enable_sharing_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
 	}
+	if (require_password_notify_id != EEL_GCONF_UNDEFINED_CONNECTION) {
+		eel_gconf_notification_remove (require_password_notify_id);
+		require_password_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
+	}
 	if (share_name_notify_id != EEL_GCONF_UNDEFINED_CONNECTION) {
 		eel_gconf_notification_remove (share_name_notify_id);
 		share_name_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
+	}
+	if (share_password_notify_id != EEL_GCONF_UNDEFINED_CONNECTION) {
+		eel_gconf_notification_remove (share_password_notify_id);
+		share_password_notify_id = EEL_GCONF_UNDEFINED_CONNECTION;
 	}
 
 	g_object_unref (shell);
Index: data/rhythmbox.schemas
===================================================================
RCS file: /cvs/gnome/rhythmbox/data/rhythmbox.schemas,v
retrieving revision 1.62
diff -p -u -r1.62 rhythmbox.schemas
--- data/rhythmbox.schemas	7 Jan 2006 16:07:25 -0000	1.62
+++ data/rhythmbox.schemas	24 Jan 2006 16:30:50 -0000
@@ -530,6 +530,17 @@
 	</locale>
       </schema>
       <schema>
+	<key>/schemas/apps/rhythmbox/sharing/require_password</key>
+	<applyto>/apps/rhythmbox/sharing/require_password</applyto>
+	<owner>rhythmbox</owner>
+	<type>bool</type>
+	<default>0</default>
+	<locale name="C">
+	<short>Require a password to access your music over the network</short>
+	<long>When enabled, Rhythmbox will require a password for others to access your music over the network.</long>
+	</locale>
+      </schema>
+      <schema>
 	<key>/schemas/apps/rhythmbox/sharing/share_name</key>
 	<applyto>/apps/rhythmbox/sharing/share_name</applyto>
 	<owner>rhythmbox</owner>
@@ -538,6 +549,17 @@
 	<locale name="C">
 	<short>Name for your shared music</short>
 	<long>Name other computers will see your music shared as</long>
+	</locale>
+      </schema>
+      <schema>
+	<key>/schemas/apps/rhythmbox/sharing/share_password</key>
+	<applyto>/apps/rhythmbox/sharing/share_password</applyto>
+	<owner>rhythmbox</owner>
+	<type>string</type>
+	<default></default>
+	<locale name="C">
+	<short>Password for your shared music</short>
+	<long>Password that is required for accessing your shared music.</long>
 	</locale>
       </schema>
       <schema>
Index: data/glade/daap-prefs.glade
===================================================================
RCS file: /cvs/gnome/rhythmbox/data/glade/daap-prefs.glade,v
retrieving revision 1.2
diff -p -u -r1.2 daap-prefs.glade
--- data/glade/daap-prefs.glade	4 Nov 2005 14:31:08 -0000	1.2
+++ data/glade/daap-prefs.glade	24 Jan 2006 16:30:50 -0000
@@ -158,10 +158,56 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkHBox" id="daap_hbox">
+			    <widget class="GtkTable" id="daap_box">
 			      <property name="visible">True</property>
+			      <property name="n_rows">2</property>
+			      <property name="n_columns">2</property>
 			      <property name="homogeneous">False</property>
-			      <property name="spacing">12</property>
+			      <property name="row_spacing">6</property>
+			      <property name="column_spacing">6</property>
+
+			      <child>
+				<widget class="GtkCheckButton" id="daap_password_check">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="label" translatable="yes">Require _password:</property>
+				  <property name="use_underline">True</property>
+				  <property name="relief">GTK_RELIEF_NORMAL</property>
+				  <property name="focus_on_click">True</property>
+				  <property name="active">False</property>
+				  <property name="inconsistent">False</property>
+				  <property name="draw_indicator">True</property>
+				</widget>
+				<packing>
+				  <property name="left_attach">0</property>
+				  <property name="right_attach">1</property>
+				  <property name="top_attach">1</property>
+				  <property name="bottom_attach">2</property>
+				  <property name="x_options">fill</property>
+				  <property name="y_options"></property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkEntry" id="daap_name_entry">
+				  <property name="visible">True</property>
+				  <property name="can_focus">True</property>
+				  <property name="editable">True</property>
+				  <property name="visibility">True</property>
+				  <property name="max_length">0</property>
+				  <property name="text" translatable="yes"></property>
+				  <property name="has_frame">True</property>
+				  <property name="invisible_char">*</property>
+				  <property name="activates_default">False</property>
+				</widget>
+				<packing>
+				  <property name="left_attach">1</property>
+				  <property name="right_attach">2</property>
+				  <property name="top_attach">0</property>
+				  <property name="bottom_attach">1</property>
+				  <property name="y_options"></property>
+				</packing>
+			      </child>
 
 			      <child>
 				<widget class="GtkLabel" id="label18">
@@ -183,18 +229,21 @@
 				  <property name="angle">0</property>
 				</widget>
 				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">False</property>
-				  <property name="fill">False</property>
+				  <property name="left_attach">0</property>
+				  <property name="right_attach">1</property>
+				  <property name="top_attach">0</property>
+				  <property name="bottom_attach">1</property>
+				  <property name="x_options">fill</property>
+				  <property name="y_options"></property>
 				</packing>
 			      </child>
 
 			      <child>
-				<widget class="GtkEntry" id="daap_name_entry">
+				<widget class="GtkEntry" id="daap_password_entry">
 				  <property name="visible">True</property>
 				  <property name="can_focus">True</property>
 				  <property name="editable">True</property>
-				  <property name="visibility">True</property>
+				  <property name="visibility">False</property>
 				  <property name="max_length">0</property>
 				  <property name="text" translatable="yes"></property>
 				  <property name="has_frame">True</property>
@@ -202,16 +251,18 @@
 				  <property name="activates_default">False</property>
 				</widget>
 				<packing>
-				  <property name="padding">0</property>
-				  <property name="expand">True</property>
-				  <property name="fill">True</property>
+				  <property name="left_attach">1</property>
+				  <property name="right_attach">2</property>
+				  <property name="top_attach">1</property>
+				  <property name="bottom_attach">2</property>
+				  <property name="y_options"></property>
 				</packing>
 			      </child>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
-			      <property name="expand">False</property>
-			      <property name="fill">False</property>
+			      <property name="expand">True</property>
+			      <property name="fill">True</property>
 			    </packing>
 			  </child>
 			</widget>
Index: lib/rb-preferences.h
===================================================================
RCS file: /cvs/gnome/rhythmbox/lib/rb-preferences.h,v
retrieving revision 1.24
diff -p -u -r1.24 rb-preferences.h
--- lib/rb-preferences.h	4 Jan 2006 09:50:15 -0000	1.24
+++ lib/rb-preferences.h	24 Jan 2006 16:30:50 -0000
@@ -52,6 +52,11 @@ G_BEGIN_DECLS
 #define CONF_AUDIOSCROBBLER_PASSWORD CONF_PREFIX "/audioscrobbler/password"
 #define CONF_AUDIOSCROBBLER_ENABLED CONF_PREFIX "/audioscrobbler/enabled"
 
+#define CONF_DAAP_ENABLE_SHARING   CONF_PREFIX "/sharing/enable_sharing"
+#define CONF_DAAP_SHARE_NAME       CONF_PREFIX "/sharing/share_name"
+#define CONF_DAAP_SHARE_PASSWORD   CONF_PREFIX "/sharing/share_password"
+#define CONF_DAAP_REQUIRE_PASSWORD CONF_PREFIX "/sharing/require_password"
+
 G_END_DECLS
 
 #endif /* __RB_PREFERENCES_H */
Index: shell/rb-shell-preferences.c
===================================================================
RCS file: /cvs/gnome/rhythmbox/shell/rb-shell-preferences.c,v
retrieving revision 1.55
diff -p -u -r1.55 rb-shell-preferences.c
--- shell/rb-shell-preferences.c	6 Jan 2006 16:00:41 -0000	1.55
+++ shell/rb-shell-preferences.c	24 Jan 2006 16:30:50 -0000
@@ -247,69 +247,128 @@ rb_shell_preferences_append_view_page (R
 
 #ifdef WITH_DAAP_SUPPORT
 
-#define CONF_ENABLE_SHARING "/apps/rhythmbox/sharing/enable_sharing"
-#define CONF_NAME "/apps/rhythmbox/sharing/share_name"
+static void
+share_check_button_toggled_cb (GtkToggleButton *button,
+			       GtkWidget *widget)
+{
+	gboolean b;
+
+	b = gtk_toggle_button_get_active (button);
+
+	eel_gconf_set_boolean (CONF_DAAP_ENABLE_SHARING, b);
+
+	gtk_widget_set_sensitive (widget, b);
+	
+	return;
+}
 
 static void
-share_check_button_toggled_cb (GtkToggleButton *button, GtkWidget *hbox)
+password_check_button_toggled_cb (GtkToggleButton *button,
+				  GtkWidget *widget)
 {
 	gboolean b;
 
 	b = gtk_toggle_button_get_active (button);
 
-	eel_gconf_set_boolean (CONF_ENABLE_SHARING, b);
+	eel_gconf_set_boolean (CONF_DAAP_REQUIRE_PASSWORD, b);
 
-	gtk_widget_set_sensitive (hbox, b);
+	gtk_widget_set_sensitive (widget, b);
 	
 	return;
 }
 
 static gboolean
-share_name_entry_focus_out_event_cb (GtkEntry *entry, GdkEventFocus *event, gpointer data)
+share_name_entry_focus_out_event_cb (GtkEntry *entry,
+				     GdkEventFocus *event,
+				     gpointer data)
 {
 	const gchar *name;
 	char *old_name;
 
 	name = gtk_entry_get_text (entry);
-	old_name = eel_gconf_get_string (CONF_NAME);
+	old_name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
 
-	if (strcmp (name, old_name) != 0)
-		eel_gconf_set_string (CONF_NAME, name);
+	if (name && old_name && strcmp (name, old_name) != 0) {
+		eel_gconf_set_string (CONF_DAAP_SHARE_NAME, name);
+	}
 
 	g_free (old_name);
 
 	return FALSE;
 }
 
+static gboolean
+share_password_entry_focus_out_event_cb (GtkEntry *entry,
+					 GdkEventFocus *event,
+					 gpointer data)
+{
+	const char *pw;
+	char *old_pw;
+
+	pw = gtk_entry_get_text (entry);
+	old_pw = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
+
+	if (pw && old_pw && strcmp (pw, old_pw) != 0) {
+		eel_gconf_set_string (CONF_DAAP_SHARE_PASSWORD, pw);
+	}
+
+	g_free (old_pw);
+
+	return FALSE;
+}
+
 static void
 add_daap_preferences (RBShellPreferences *shell_preferences)
 {
 	GladeXML *xml;
 	GtkWidget *check;
-	GtkWidget *entry;
-	GtkWidget *hbox;
-	gboolean b;
+	GtkWidget *name_entry;
+	GtkWidget *password_entry;
+	GtkWidget *password_check;
+	GtkWidget *box;
+	gboolean sharing_enabled;
+	gboolean require_password;
 
-	gchar *name;
+	char *name;
+	char *password;
 
 	xml = rb_glade_xml_new ("daap-prefs.glade",
 				"daap_vbox",
 				shell_preferences);
 
 	check = glade_xml_get_widget (xml, "daap_enable_check");
-	entry = glade_xml_get_widget (xml, "daap_name_entry");
-	hbox = glade_xml_get_widget (xml, "daap_hbox");
+	password_check = glade_xml_get_widget (xml, "daap_password_check");
+	name_entry = glade_xml_get_widget (xml, "daap_name_entry");
+	password_entry = glade_xml_get_widget (xml, "daap_password_entry");
+	box = glade_xml_get_widget (xml, "daap_box");
 	
-	b = eel_gconf_get_boolean (CONF_ENABLE_SHARING);
-	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), b);
-	g_signal_connect (G_OBJECT (check), "toggled", G_CALLBACK (share_check_button_toggled_cb), hbox);
+	sharing_enabled = eel_gconf_get_boolean (CONF_DAAP_ENABLE_SHARING);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), sharing_enabled);
+	g_signal_connect (check, "toggled", G_CALLBACK (share_check_button_toggled_cb), box);
+
+	require_password = eel_gconf_get_boolean (CONF_DAAP_REQUIRE_PASSWORD);
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (password_check), require_password);
+	g_signal_connect (password_check, "toggled", G_CALLBACK (password_check_button_toggled_cb), password_entry);
 	
-	name = eel_gconf_get_string (CONF_NAME);
-	gtk_entry_set_text (GTK_ENTRY (entry), name);
-	g_signal_connect (G_OBJECT (entry), "focus-out-event", G_CALLBACK (share_name_entry_focus_out_event_cb), NULL);	
+	name = eel_gconf_get_string (CONF_DAAP_SHARE_NAME);
+	if (name != NULL) {
+		gtk_entry_set_text (GTK_ENTRY (name_entry), name);
+	}
+	g_free (name);
+	g_signal_connect (name_entry, "focus-out-event",
+			  G_CALLBACK (share_name_entry_focus_out_event_cb), NULL);	
+
+	password = eel_gconf_get_string (CONF_DAAP_SHARE_PASSWORD);
+	if (password != NULL) {
+		gtk_entry_set_text (GTK_ENTRY (password_entry), password);
+	}
+	g_free (password);
+	g_signal_connect (password_entry, "focus-out-event",
+			  G_CALLBACK (share_password_entry_focus_out_event_cb), NULL);	
+
+	gtk_widget_set_sensitive (box, sharing_enabled);
+	gtk_widget_set_sensitive (password_entry, require_password);
 
-	gtk_widget_set_sensitive (hbox, b);
-	
 	gtk_notebook_append_page (GTK_NOTEBOOK (shell_preferences->priv->notebook),
 				  glade_xml_get_widget (xml, "daap_vbox"),
 				  gtk_label_new (_("Sharing")));
