How to use wired Network with static AND dhcp?

2005-06-22 Thread Jens Lautenbacher
Hi,

I am using NM now quite some time and I really like it very much - still
I have a problem that I am currently unable to solve how to do it with
NM.

The situation is that I can use NM for my wireless stuff perfectly well,
as all places I've been are using dhcp for their wireless stuff. But for
the wired connection I have some places using predefined static routes,
DNS, and gateways (of course different every time) and some places where
I need to use dhcp.

How can this situation be handled with NM? 

jtl

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Howto control DNS?

2005-06-22 Thread Neal Becker
When I'm at work, I have to forward queries to a local DNS to resolve internal 
names, but at home I want a normal DNS setup.  How can I achieve this?  I had 
used profiles on Fedora without Networkmanager, but with NetworkManager I 
don't know how to force DNS to forward in my work environment.
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NetworkManager, Wireless and Fedora FC4

2005-06-22 Thread Ray Hooker
Well I am both encouraged and stuck.  NetworkManager was working but
without the VPNC, so I upgraded to the versions as per:
 http://people.redhat.com/davidz/nm-vpnc2/

When upgrading, it complained that I needed dhcdbd, so I got and
installed dhcdbd-1.6-1.rpm.

When I rebooted, logged in under gnome and ran
/usr/libexec/nm-applet it looks great.  It detects the other
networks in the neighborhood and mine.  The problem is that it doesn't
do dhcp client and setup routing.  I have even tried doing a pull
down from the applet and clicking on the wireless networks to
connect.  NOTE the wired ethernet does not work either.  I am
totally hosed other than manually setting up the routes and assigned a
fixed ip address.. and resolv.conf.

I suspect that it was the dhcdbd package that did it but any
suggestions are appreciated.  If necessary I can reinstall FC4 as I
want a set of steps that works cleanly without wondering as I often do
with Linux (yes well after 2 days it works but I wonder what I
did...?)

Ray
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NetworkManager, Wireless and Fedora FC4

2005-06-22 Thread Paul Ionescu
On Wed, 22 Jun 2005 09:39:04 -0400, Ray Hooker wrote:

 Well I am both encouraged and stuck.  NetworkManager was working but
 without the VPNC, so I upgraded to the versions as per:
  http://people.redhat.com/davidz/nm-vpnc2/
 
 When upgrading, it complained that I needed dhcdbd, so I got and installed
 dhcdbd-1.6-1.rpm.
 
 When I rebooted, logged in under gnome and ran /usr/libexec/nm-applet it
 looks great.  It detects the other networks in the neighborhood and mine. 
 The problem is that it doesn't do dhcp client and setup routing.  I have
 even tried doing a pull down from the applet and clicking on the
 wireless networks to connect.  NOTE the wired ethernet does not work
 either.  I am totally hosed other than manually setting up the routes and
 assigned a fixed ip address.. and resolv.conf.
 
 I suspect that it was the dhcdbd package that did it but any suggestions
 are appreciated.  If necessary I can reinstall FC4 as I want a set of
 steps that works cleanly without wondering as I often do with Linux (yes
 well after 2 days it works but I wonder what I did...?)
 
 Ray

Hi Ray,

I had the same problem last week on one computer with FC4.
You can find it on this list in 16.jun.2005.
And on the other hand, I have it working on another computer.
I don't know what went wrong or how to debug this, but you are not the
only one who had this.

Paul


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


[patch] fix FIXME in NetworkManagerDispatcher.c

2005-06-22 Thread Robert Love
Hi,

FIXME in dispatcher-daemon/NetworkManagerDispatcher.c reads:

``We should check the permissions and only execute files that
  are 0700 or 0500.''

Indeed we should.

Attached patch fixes the FIXME.

( Actually, I just check for

! (s-st_mode  (S_IWGRP|S_IWOTH|S_ISUID))

and

s-st_mode  S_IXUSR

Not the more aggressive no user or group bits whatsoever. )

Also, some cleanup: Mark two functions as static and catch and warn on
failure from system().

May I apply?

Robert Love


 dispatcher-daemon/NetworkManagerDispatcher.c |   45 +-- 1 files changed, 35 insertions(+), 10 deletions(-)

Index: dispatcher-daemon/NetworkManagerDispatcher.c
===
RCS file: /cvs/gnome/NetworkManager/dispatcher-daemon/NetworkManagerDispatcher.c,v
retrieving revision 1.16
diff -u -u -r1.16 NetworkManagerDispatcher.c
--- dispatcher-daemon/NetworkManagerDispatcher.c	16 May 2005 01:43:14 -	1.16
+++ dispatcher-daemon/NetworkManagerDispatcher.c	22 Jun 2005 16:31:46 -
@@ -50,13 +50,40 @@
 
 #define NM_SCRIPT_DIR	/etc/NetworkManager/dispatcher.d
 
+
+/*
+ * nmd_permission_check
+ *
+ * Verify that the given script has the permissions we want.  Specifically,
+ * very that the file is
+ *	- A regular file.
+ *	- Owned by root.
+ *	- Not writable by the group or by other.
+ *	- Not setuid.
+ *	- Executable by the owner.
+ *
+ */
+static inline gboolean nmd_permission_check (struct stat *s)
+{
+	if (!S_ISREG (s-st_mode))
+		return FALSE;
+	if (s-st_uid != 0)
+		return FALSE;
+	if (s-st_mode  (S_IWGRP|S_IWOTH|S_ISUID))
+		return FALSE;
+	if (!(s-st_mode  S_IXUSR))
+		return FALSE;
+	return TRUE;
+}
+
+
 /*
  * nmd_execute_scripts
  *
  * Call scripts in /etc/NetworkManager.d when devices go down or up
  *
  */
-void nmd_execute_scripts (NMDAction action, char *iface_name)
+static void nmd_execute_scripts (NMDAction action, char *iface_name)
 {
 	GDir *		dir;
 	const char *	file_name;
@@ -82,17 +109,15 @@
 
 		if ((file_name[0] != '.')  (stat (file_path, s) == 0))
 		{
-			/* FIXME
-			 * We should check the permissions and only execute files that
-			 * are 0700 or 0500.
-			 */
-			if (S_ISREG (s.st_mode)  !S_ISLNK (s.st_mode)  (s.st_uid == 0))
+			if (nmd_permission_check (s))
 			{
-int x;
 char *cmd;
+int ret;
 
 cmd = g_strdup_printf (%s %s %s, file_path, iface_name, char_act);
-x = system (cmd);
+ret = system (cmd);
+if (ret == -1)
+	nm_warning (nmd_execute_scripts(): system() failed with errno = %d, errno);
 g_free (cmd);
 			}
 		}
@@ -109,7 +134,7 @@
  *
  * Queries NetworkManager for the name of a device, specified by a device path
  */
-char * nmd_get_device_name (DBusConnection *connection, char *path)
+static char * nmd_get_device_name (DBusConnection *connection, char *path)
 {
 	DBusMessage *	message;
 	DBusMessage *	reply;
@@ -259,7 +284,7 @@
  * main
  *
  */
-int main( int argc, char *argv[] )
+int main (int argc, char *argv[])
 {
 	gboolean		 become_daemon = TRUE;
 	GMainLoop		*loop  = NULL;
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


[patch] first pass at gnome-keyring support, baby.

2005-06-22 Thread Robert Love
Attached patch adds support for gnome-keyring to nm-applet and stores
the essid key encrypted in the keyring instead of cleartext in gconf.

It is a first pass, but it seems to work well [1].

One issue is it causes the gnome-keyring decrypt your keyring dialog
to pop up as soon as the applet loads (presuming that your keyring is
not already decrypted, of course).  It seems as if the information
(including the keys) is read for each wireless network on startup?
Maybe we could change that, or defer reading the key until it is
absolutely needed.  Or only read the key if the auth_method specifies
such.

Thoughts?  Comments?

Robert Love

[1] Actually, it seems to work perfect.  But I am having a lot of
problems with NetworkManager and encrypted essids (or maybe just
switching between lots of essids in general) and my airo wireless card.
Sometimes the daemon just starts sitting there.  Sometimes it stops
scanning.  In either case, it won't exit.  Quick debugging shows it is
spinning on a mutex.  Although I've also seen evidence it is waiting for
something from the card.  It is confusing to the point of tears.  I'll
debug it later.  I should add that, ahem, Netapplet works fine with my
card.  ;-)

Index: configure.in
===
RCS file: /cvs/gnome/NetworkManager/configure.in,v
retrieving revision 1.82
diff -u -u -r1.82 configure.in
--- configure.in	20 Jun 2005 17:16:51 -	1.82
+++ configure.in	23 Jun 2005 01:54:43 -
@@ -177,10 +177,6 @@
 AC_SUBST(LIBGNOMEUI_CFLAGS) # is this even needed? it was typed incorrectly before
 AC_SUBST(LIBGNOMEUI_LIBS)
 
-PKG_CHECK_MODULES(GNOMEKEYRING, gnome-keyring-1)
-AC_SUBST(GNOMEKEYRING_CFLAGS) # is this even needed? it was typed incorrectly before
-AC_SUBST(GNOMEKEYRING_LIBS)
-
 AC_ARG_WITH(dbus-sys, AC_HELP_STRING([--with-dbus-sys=DIR], [where D-BUS system.d directory is]))
 
 if ! test -z $with_dbus_sys ; then
Index: gnome/applet/Makefile.am
===
RCS file: /cvs/gnome/NetworkManager/gnome/applet/Makefile.am,v
retrieving revision 1.5
diff -u -u -r1.5 Makefile.am
--- gnome/applet/Makefile.am	16 Jun 2005 18:47:56 -	1.5
+++ gnome/applet/Makefile.am	23 Jun 2005 01:54:43 -
@@ -16,7 +16,7 @@
 	$(GCONF_CFLAGS)			\
 	$(LIBGNOMEUI_CFLAGS)		\
 	$(PANEL_APPLET_CFLAGS)		\
-	$(GNOMEKEYRING_CFLAGS)		\
+	$(GNOME_KEYRING_CFLAGS)		\
 	-DICONDIR=\$(datadir)/pixmaps\\
 	-DGLADEDIR=\$(gladedir)\	\
 	-DBINDIR=\$(bindir)\	\
@@ -70,7 +70,7 @@
 	$(GTK_LIBS)		\
 	$(GCONF_LIBS)		\
 	$(LIBGNOMEUI_LIBS)	\
-	$(GNOMEKEYRING_LIBS)\
+	$(GNOME_KEYRING_LIBS)\
 	$(top_builddir)/utils/libnmutils.la	\
 	$(NULL)
 
Index: gnome/applet/applet-dbus-info.c
===
RCS file: /cvs/gnome/NetworkManager/gnome/applet/applet-dbus-info.c,v
retrieving revision 1.8
diff -u -u -r1.8 applet-dbus-info.c
--- gnome/applet/applet-dbus-info.c	21 Jun 2005 15:07:00 -	1.8
+++ gnome/applet/applet-dbus-info.c	23 Jun 2005 01:54:43 -
@@ -29,6 +29,8 @@
 #include dbus/dbus.h
 #include gtk/gtk.h
 #include glade/glade.h
+#include gnome-keyring.h
+
 #include NetworkManager.h
 #include applet.h
 #include applet-dbus.h
@@ -293,13 +295,14 @@
 	DBusError			 error;
 	NMNetworkType		 type;
 	char*escaped_network;
-
 	char*essid = NULL;
 	gint timestamp = -1;
-	gint32i;
+	gint32			 i;
 	char*key = NULL;
 	NMEncKeyType		 key_type = -1;
 	gboolean			 trusted = FALSE;
+	GList			*found_list;
+	GnomeKeyringResult	 ret;
 	NMDeviceAuthMethod	 auth_method = NM_DEVICE_AUTH_METHOD_UNKNOWN;
 
 	g_return_val_if_fail (applet != NULL, NULL);
@@ -335,16 +338,21 @@
 	}	
 	g_free (gconf_key);
 
-	/* Grab user-key key for our access point from GConf */
-	gconf_key = g_strdup_printf (%s/%s/key, GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
-	if ((value = gconf_client_get (applet-gconf_client, gconf_key, NULL)))
-	{
-		key = g_strdup (gconf_value_get_string (value));
-		gconf_value_free (value);
+	/* Get the essid key, if any, from the keyring */
+	ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
+   found_list,
+   essid,
+   GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
+   essid,
+   NULL);
+	if (ret == GNOME_KEYRING_RESULT_OK)
+	{
+		GnomeKeyringFound *found = found_list-data;
+		key = g_strdup (found-secret);
+		gnome_keyring_found_list_free (found_list);
 	}
 	else
 		key = g_strdup ();
-	g_free (gconf_key);
 
 	gconf_key = g_strdup_printf (%s/%s/key_type, GCONF_PATH_WIRELESS_NETWORKS, escaped_network);
 	if ((value = gconf_client_get (applet-gconf_client, gconf_key, NULL)))
Index: gnome/applet/applet.c
===
RCS file: /cvs/gnome/NetworkManager/gnome/applet/applet.c,v
retrieving revision 1.16
diff -u -u -r1.16 applet.c
--- gnome/applet/applet.c	21 Jun 2005 15:09:34 -	

Re: [patch] fix FIXME in NetworkManagerDispatcher.c

2005-06-22 Thread Dan Williams
On Wed, 22 Jun 2005, Robert Love wrote:
 May I apply?

Looks good, go ahead.

Dan
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [patch] first pass at gnome-keyring support, baby.

2005-06-22 Thread Colin Walters
On Wed, 2005-06-22 at 22:02 -0400, Robert Love wrote:
 Attached patch adds support for gnome-keyring to nm-applet and stores
 the essid key encrypted in the keyring instead of cleartext in gconf.
 
 It is a first pass, but it seems to work well [1].
 
 One issue is it causes the gnome-keyring decrypt your keyring dialog
 to pop up as soon as the applet loads (presuming that your keyring is
 not already decrypted, of course). 

Offtopic, but IMO we should just get rid of that dialog (and the whole
keyring access control).  It is a pretty small barrier versus a
compromised application, confusing to users, and it's also annoying.



signature.asc
Description: This is a digitally signed message part
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [patch] add a connection information dialog.

2005-06-22 Thread Colin Walters
On Tue, 2005-06-21 at 15:44 -0400, Robert Love wrote:
 On Tue, 2005-06-21 at 15:42 -0400, Robert Love wrote:
 
  The attached email implements a Connection Information dialog,
  accessible from the right-click menu, with connection-related
  information such as IP address, subnet mask, active interface, and so
  on.

I can't really comment as to whether it's a good idea or not, but from a
code point of view:

You create several different error dialogs like this:
+ error_dialog = gtk_message_dialog_new_with_markup (
+   GTK_WINDOW (info_dialog),
+   0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+   _(span weight=\bold\ size=\larger
\
+ Error displaying connection
information: 
+ /span\n\n
+ No active connection!));

Speaking from experience, you'll get yelled at by translators.  They
don't like having the span in the translated text; they suggest
wrapping it in g_strdup_printf, like:

msg = g_strdup_printf (span weight=\bold\ size=\larger\%s/span, 
   _(Error displaying connection information: %s));
error_dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (info_dialog),
   0, GTK_MESSAGE_ERROR, 
GTK_BUTTONS_OK,
   msg,
   _(No active connection!));
g_free (msg);

And actually looking more closely it looks like you're missing a %s.  
Also, you have several variants of this message which only differ on one
technical detail (Unable to open socket versus SIOCGIFFLAGS failed on
socket!), you probably want to extract that to a separate printf so the
translators only have to do the Error displaying connection
information: string once.  Maybe just do a goto socket_error;.




signature.asc
Description: This is a digitally signed message part
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [patch] first pass at gnome-keyring support, baby.

2005-06-22 Thread Robert Love
On Wed, 2005-06-22 at 23:49 -0400, David Zeuthen wrote:

 So, I guess my point is that we shouldn't care too much about annoying
 gnome-keyring dialogs at this point. Not that it doesn't matter, cause
 it does, however all that work is elsewhere really.

Nod.

We can do a lot better, though.  Right now we force an unlock on startup
because we parse every password.  Netapplet, for example, only required
an unlock when you actually connected to an password-protected network.

Robert Love


___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list