2004-07-19 Dan Williams <dcbw@redhat.com>

* Makefile.am
		- Add info-daemon directory

	* configure.in
		- Check for glade libs and headers
		- Add info-daemon directory

	* src/NetworkManagerAP.c
		- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
			copied over to the new AP.

	* src/NetworkManagerDbus.c
	  src/NetworkManagerDbus.h
		- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
		- Remove nm_dbus_signal_need_key_for_network()
		- Add disabled code for asynchronous user wep key callbacks
		- Add functions for getting, setting, and cancelling user key operations
		- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
		- Add "setKeyForNetwork" dbus method call on NetworkManager object

	* src/NetworkManagerDevice.c
	  src/NetworkManagerDevice.h
		- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
			logic is in device activation now
		- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
			key is wrong) trigger get-user-key pending action
		- Implement get-user-key pending action stuff, tie to dbus messages
		- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
		- Add nm_device_ap_list_get_ap_by_essid()
		- Instead of copying "best" access points, ref them instead so that the key we set
			sticks around

	* src/NetworkManagerPolicy.c
		- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
		- Don't cancel pending actions on a device if its the same device as last iteration
		- Only promote pending_device->active_device if activation was successfull

	* src/Makefile.am
		- Rename nmclienttest->nmtest

	* info-daemon/Makefile.am
	  info-daemon/NetworkManagerInfo.c
	  info-daemon/NetworkManagerInfo.h
	  info-daemon/NetworkManagerInfoDbus.c
	  info-daemon/NetworkManagerInfoDbus.h
	  info-daemon/passphrase.glade
	  info-daemon/NetworkManagerInfo.conf
	  info-daemon/keyring.png
	  	- Import sources for info-daemon, which pops up dialog for passphrase/key when
	  		NetworkManager asks for it, and also will (soon) provide "allowed" access point
	  		lists to NetworkManager by proxying user's GConf


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@16 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams 2004-07-19 06:08:52 +00:00
parent 088b0d8eb2
commit aab500146f
23 changed files with 1424 additions and 178 deletions

View file

@ -1,3 +1,58 @@
2004-07-19 Dan Williams <dcbw@redhat.com>
* Makefile.am
- Add info-daemon directory
* configure.in
- Check for glade libs and headers
- Add info-daemon directory
* src/NetworkManagerAP.c
- nm_ap_new_from_ap(): Fix bug that resulted in an APs encryption status not getting
copied over to the new AP.
* src/NetworkManagerDbus.c
src/NetworkManagerDbus.h
- Deal with nm_device_ap_list_get_ap()->nm_device_ap_list_get_ap_by_index() change
- Remove nm_dbus_signal_need_key_for_network()
- Add disabled code for asynchronous user wep key callbacks
- Add functions for getting, setting, and cancelling user key operations
- Remove "setKeyForNetwork" device dbus method call, its on NetworkManager object instead
- Add "setKeyForNetwork" dbus method call on NetworkManager object
* src/NetworkManagerDevice.c
src/NetworkManagerDevice.h
- nm_device_update_link_active(): revert changes for wireless link detection, the WEP-key-is-wrong
logic is in device activation now
- nm_device_activate(): for wireless devices, if we can't associate with access point (perhaps
key is wrong) trigger get-user-key pending action
- Implement get-user-key pending action stuff, tie to dbus messages
- Rename nm_device_ap_list_get_ap() -> nm_device_ap_list_get_ap_by_index()
- Add nm_device_ap_list_get_ap_by_essid()
- Instead of copying "best" access points, ref them instead so that the key we set
sticks around
* src/NetworkManagerPolicy.c
- Deal with wrong WEP key, but right access point (and if so, return link_active = TRUE)
- Don't cancel pending actions on a device if its the same device as last iteration
- Only promote pending_device->active_device if activation was successfull
* src/Makefile.am
- Rename nmclienttest->nmtest
* info-daemon/Makefile.am
info-daemon/NetworkManagerInfo.c
info-daemon/NetworkManagerInfo.h
info-daemon/NetworkManagerInfoDbus.c
info-daemon/NetworkManagerInfoDbus.h
info-daemon/passphrase.glade
info-daemon/NetworkManagerInfo.conf
info-daemon/keyring.png
- Import sources for info-daemon, which pops up dialog for passphrase/key when
NetworkManager asks for it, and also will (soon) provide "allowed" access point
lists to NetworkManager by proxying user's GConf
2004-07-15 Dan Williams <dcbw@redhat.com>
* src/Makefile.am

View file

@ -1 +1 @@
SUBDIRS = src dispatcher-daemon initscript test
SUBDIRS = src dispatcher-daemon info-daemon initscript test

View file

@ -56,6 +56,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GLADE_CFLAGS = @GLADE_CFLAGS@
GLADE_LIBS = @GLADE_LIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -107,7 +109,7 @@ sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
SUBDIRS = src dispatcher-daemon initscript test
SUBDIRS = src dispatcher-daemon info-daemon initscript test
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs

2
aclocal.m4 vendored
View file

@ -837,7 +837,7 @@ fi])])
dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
dnl also defines GSTUFF_PKG_ERRORS on error
AC_DEFUN(PKG_CHECK_MODULES, [
AC_DEFUN([PKG_CHECK_MODULES], [
succeeded=no
if test -z "$PKG_CONFIG"; then

108
configure vendored
View file

@ -308,7 +308,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP IWLIB PKG_CONFIG NM_CFLAGS NM_LIBS LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE am__leading_dot CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP IWLIB PKG_CONFIG NM_CFLAGS NM_LIBS GLADE_CFLAGS GLADE_LIBS LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -3616,7 +3616,108 @@ echo "$as_me: error: Library requirements (dbus-glib-1 >= 0.20 hal >= 0.2.91 gth
ac_config_files="$ac_config_files Makefile src/Makefile dispatcher-daemon/Makefile test/Makefile initscript/Makefile"
succeeded=no
if test -z "$PKG_CONFIG"; then
# Extract the first word of "pkg-config", so it can be a program name with args.
set dummy pkg-config; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
;;
esac
fi
PKG_CONFIG=$ac_cv_path_PKG_CONFIG
if test -n "$PKG_CONFIG"; then
echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
echo "${ECHO_T}$PKG_CONFIG" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
fi
if test "$PKG_CONFIG" = "no" ; then
echo "*** The pkg-config script could not be found. Make sure it is"
echo "*** in your path, or set the PKG_CONFIG environment variable"
echo "*** to the full path to pkg-config."
echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
else
PKG_CONFIG_MIN_VERSION=0.9.0
if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
echo "$as_me:$LINENO: checking for libglade-2.0" >&5
echo $ECHO_N "checking for libglade-2.0... $ECHO_C" >&6
if $PKG_CONFIG --exists "libglade-2.0" ; then
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
succeeded=yes
echo "$as_me:$LINENO: checking GLADE_CFLAGS" >&5
echo $ECHO_N "checking GLADE_CFLAGS... $ECHO_C" >&6
GLADE_CFLAGS=`$PKG_CONFIG --cflags "libglade-2.0"`
echo "$as_me:$LINENO: result: $GLADE_CFLAGS" >&5
echo "${ECHO_T}$GLADE_CFLAGS" >&6
echo "$as_me:$LINENO: checking GLADE_LIBS" >&5
echo $ECHO_N "checking GLADE_LIBS... $ECHO_C" >&6
GLADE_LIBS=`$PKG_CONFIG --libs "libglade-2.0"`
echo "$as_me:$LINENO: result: $GLADE_LIBS" >&5
echo "${ECHO_T}$GLADE_LIBS" >&6
else
GLADE_CFLAGS=""
GLADE_LIBS=""
## If we have a custom action on failure, don't print errors, but
## do set a variable so people can do so.
GLADE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libglade-2.0"`
echo $GLADE_PKG_ERRORS
fi
else
echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
echo "*** See http://www.freedesktop.org/software/pkgconfig"
fi
fi
if test $succeeded = yes; then
:
else
{ { echo "$as_me:$LINENO: error: Library requirements (libglade-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&5
echo "$as_me: error: Library requirements (libglade-2.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them." >&2;}
{ (exit 1); exit 1; }; }
fi
ac_config_files="$ac_config_files Makefile src/Makefile dispatcher-daemon/Makefile info-daemon/Makefile test/Makefile initscript/Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@ -4195,6 +4296,7 @@ do
"Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"dispatcher-daemon/Makefile" ) CONFIG_FILES="$CONFIG_FILES dispatcher-daemon/Makefile" ;;
"info-daemon/Makefile" ) CONFIG_FILES="$CONFIG_FILES info-daemon/Makefile" ;;
"test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
"initscript/Makefile" ) CONFIG_FILES="$CONFIG_FILES initscript/Makefile" ;;
"depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
@ -4323,6 +4425,8 @@ s,@IWLIB@,$IWLIB,;t t
s,@PKG_CONFIG@,$PKG_CONFIG,;t t
s,@NM_CFLAGS@,$NM_CFLAGS,;t t
s,@NM_LIBS@,$NM_LIBS,;t t
s,@GLADE_CFLAGS@,$GLADE_CFLAGS,;t t
s,@GLADE_LIBS@,$GLADE_LIBS,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF

View file

@ -15,10 +15,15 @@ PKG_CHECK_MODULES(NM, dbus-glib-1 >= 0.20 hal >= 0.2.91 gthread-2.0)
AC_SUBST(NM_CFLAGS)
AC_SUBST(NM_LIBS)
PKG_CHECK_MODULES(GLADE, libglade-2.0)
AC_SUBST(GLADE_CFLAGS)
AC_SUBST(GLADE_LIBS)
AC_OUTPUT([
Makefile
src/Makefile
dispatcher-daemon/Makefile
info-daemon/Makefile
test/Makefile
initscript/Makefile
])

15
info-daemon/Makefile.am Normal file
View file

@ -0,0 +1,15 @@
INCLUDES = \
$(NM_CFLAGS) \
$(GLADE_CFLAGS) \
-Wall \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DBINDIR=\"$(bindir)\" \
-DDATADIR=\"$(datadir)\"
bin_PROGRAMS = NetworkManagerInfo
NetworkManagerInfo_SOURCES = NetworkManagerInfo.c \
NetworkManagerInfoDbus.c
NetworkManagerInfo_LDADD = $(NM_LIBS) $(GLADE_LIBS)

View file

@ -0,0 +1,360 @@
/* NetworkManagerInfo -- Manage allowed access points and provide a UI
* for WEP key entry
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2004 Red Hat, Inc.
*/
#include <glib.h>
#include <dbus/dbus-glib.h>
#include <getopt.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "NetworkManagerInfoDbus.h"
#include "NetworkManagerInfo.h"
/*
* nmi_clear_dialog
*
* Return dialog to its original state; clear out any network or device qdatas,
* clear the passphrase entry, and hide the dialog.
*
*/
static void nmi_clear_dialog (GtkWidget *dialog, GtkWidget *entry)
{
char *data;
g_return_if_fail (dialog != NULL);
g_return_if_fail (entry != NULL);
data = g_object_get_qdata (G_OBJECT (dialog), g_quark_from_static_string ("device"));
if (data)
{
g_free (data);
g_object_set_qdata (G_OBJECT (dialog), g_quark_from_static_string ("device"), NULL);
}
data = g_object_get_qdata (G_OBJECT (dialog), g_quark_from_static_string ("network"));
if (data)
{
g_free (data);
g_object_set_qdata (G_OBJECT (dialog), g_quark_from_static_string ("network"), NULL);
}
gtk_entry_set_text (GTK_ENTRY (entry), "");
gtk_widget_hide (dialog);
}
/*
* ok_button_clicked
*
* OK button handler; grab the passphrase and send it back
* to NetworkManager. Get rid of the dialog.
*
*/
static void ok_button_clicked (GtkWidget *ok_button, gpointer user_data)
{
GtkWidget *dialog = gtk_widget_get_toplevel (ok_button);
NMIAppInfo *info = (NMIAppInfo *)user_data;
g_return_if_fail (info != NULL);
if (GTK_WIDGET_TOPLEVEL (dialog))
{
GtkWidget *entry = glade_xml_get_widget (info->xml, "passphrase_entry");
const char *passphrase = gtk_entry_get_text (GTK_ENTRY (entry));
const char *device = g_object_get_qdata (G_OBJECT (dialog), g_quark_from_static_string ("device"));
const char *network = g_object_get_qdata (G_OBJECT (dialog), g_quark_from_static_string ("network"));
nmi_dbus_return_user_key (info->connection, device, network, passphrase);
nmi_clear_dialog (dialog, entry);
}
}
/*
* cancel_button_clicked
*
* Cancel button handler; return a cancellation message to NetworkManager
* and get rid of the dialog.
*
*/
static void cancel_button_clicked (GtkWidget *cancel_button, gpointer user_data)
{
GtkWidget *dialog = gtk_widget_get_toplevel (cancel_button);
NMIAppInfo *info = (NMIAppInfo *)user_data;
g_return_if_fail (info != NULL);
if (GTK_WIDGET_TOPLEVEL (dialog))
{
const char *device = g_object_get_qdata (G_OBJECT (dialog), g_quark_from_static_string ("device"));
const char *network = g_object_get_qdata (G_OBJECT (dialog), g_quark_from_static_string ("network"));
nmi_dbus_return_user_key (info->connection, device, network, "***cancelled***");
nmi_clear_dialog (dialog, glade_xml_get_widget (info->xml, "passphrase_entry"));
}
}
/*
* nmi_show_user_key_dialog
*
* Pop up the user key dialog in response to a dbus message
*
*/
void nmi_show_user_key_dialog (const char *device, const char *network, NMIAppInfo *info)
{
GtkWidget *dialog;
GtkWidget *label;
const gchar *label_text;
g_return_if_fail (info != NULL);
g_return_if_fail (device != NULL);
g_return_if_fail (network != NULL);
dialog = glade_xml_get_widget (info->xml, "passphrase_dialog");
nmi_clear_dialog (dialog, glade_xml_get_widget (info->xml, "passphrase_entry"));
/* Insert the Network name into the dialog text */
label = glade_xml_get_widget (info->xml, "label1");
label_text = gtk_label_get_label (GTK_LABEL (label));
if (label_text)
{
gchar *new_label_text = g_strdup_printf (label_text, network);
gtk_label_set_label (GTK_LABEL (label), new_label_text);
}
g_object_set_qdata (G_OBJECT (dialog), g_quark_from_static_string ("device"), g_strdup (device));
g_object_set_qdata (G_OBJECT (dialog), g_quark_from_static_string ("network"), g_strdup (network));
gtk_widget_show (dialog);
}
/*
* nmi_cancel_user_key_dialog
*
* Cancel and hide any user key dialog that might be up
*
*/
void nmi_cancel_user_key_dialog (NMIAppInfo *info)
{
GtkWidget *dialog;
GtkWidget *entry;
g_return_if_fail (info != NULL);
dialog = glade_xml_get_widget (info->xml, "passphrase_dialog");
entry = glade_xml_get_widget (info->xml, "passphrase_entry");
nmi_clear_dialog (dialog, entry);
}
/*
* nmi_interface_init
*
* Initialize the UI pieces of NMI.
*
*/
static void nmi_interface_init (NMIAppInfo *info)
{
GtkWidget *dialog;
GtkButton *ok_button;
GtkButton *cancel_button;
GtkEntry *entry;
info->xml = glade_xml_new("passphrase.glade", NULL, NULL);
if (!info->xml)
{
fprintf (stderr, "Could not open glade file!\n");
exit (1);
}
dialog = glade_xml_get_widget (info->xml, "passphrase_dialog");
gtk_widget_hide (dialog);
ok_button = GTK_BUTTON (glade_xml_get_widget (info->xml, "login_button"));
gtk_signal_connect (GTK_OBJECT (ok_button), "clicked", GTK_SIGNAL_FUNC (ok_button_clicked), info);
gtk_widget_grab_default (GTK_WIDGET (ok_button));
cancel_button = GTK_BUTTON (glade_xml_get_widget (info->xml, "cancel_button"));
gtk_signal_connect (GTK_OBJECT (cancel_button), "clicked", GTK_SIGNAL_FUNC (cancel_button_clicked), info);
entry = GTK_ENTRY (glade_xml_get_widget (info->xml, "passphrase_entry"));
gtk_entry_set_visibility (entry, FALSE);
gtk_entry_set_invisible_char (entry, '*');
nmi_clear_dialog (dialog, GTK_WIDGET (entry));
}
/*
* nmi_print_usage
*
* Prints program usage.
*
*/
static void nmi_print_usage (void)
{
fprintf (stderr, "\n" "usage : NetworkManagerInfo [--daemon=yes|no] [--help]\n");
fprintf (stderr,
"\n"
" --daemon=yes|no Become a daemon\n"
" --help Show this information and exit\n"
"\n"
"NetworkManagerInfo responds to NetworkManager requests for allowed access points\n"
"and WEP keys.\n"
"\n");
}
/*
* main
*
*/
int main( int argc, char *argv[] )
{
gboolean become_daemon = TRUE;
DBusError dbus_error;
DBusConnection *dbus_connection;
int err;
NMIAppInfo *app_info = NULL;
GMainLoop *loop;
/* Parse options */
while (1)
{
int c;
int option_index = 0;
const char *opt;
static struct option options[] = {
{"daemon", 1, NULL, 0},
{"help", 0, NULL, 0},
{NULL, 0, NULL, 0}
};
c = getopt_long (argc, argv, "", options, &option_index);
if (c == -1)
break;
switch (c)
{
case 0:
opt = options[option_index].name;
if (strcmp (opt, "help") == 0)
{
nmi_print_usage ();
return 0;
}
else if (strcmp (opt, "daemon") == 0)
{
if (strcmp ("yes", optarg) == 0)
become_daemon = TRUE;
else if (strcmp ("no", optarg) == 0)
become_daemon = FALSE;
else
{
nmi_print_usage ();
return 1;
}
}
break;
default:
nmi_print_usage ();
return 1;
break;
}
}
if (become_daemon)
{
int child_pid;
if (chdir ("/") < 0)
{
fprintf( stderr, "NetworkManagerInfo could not chdir to /. errno=%d", errno);
return 1;
}
child_pid = fork ();
switch (child_pid)
{
case -1:
fprintf( stderr, "NetworkManagerInfo could not daemonize. errno = %d\n", errno );
break;
case 0:
/* Child */
break;
default:
exit (0);
break;
}
}
app_info = g_new0 (NMIAppInfo, 1);
if (!app_info)
{
fprintf (stderr, "Not enough memory for application data.\n");
exit (1);
}
g_type_init ();
if (!g_thread_supported ())
g_thread_init (NULL);
/* Set up our connection to the message bus */
dbus_error_init (&dbus_error);
dbus_connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error);
if (dbus_connection == NULL)
{
fprintf (stderr, "NetworkManagerInfo could not get the system bus. Make sure the message bus daemon is running?\n");
exit (1);
}
dbus_connection_set_change_sigpipe (TRUE);
dbus_connection_set_exit_on_disconnect (dbus_connection, FALSE);
dbus_connection_setup_with_g_main (dbus_connection, NULL);
app_info->connection = dbus_connection;
/* Create our own dbus service */
err = nmi_dbus_service_init (dbus_connection, app_info);
if (err == -1)
exit (1);
gtk_init (&argc, &argv);
nmi_interface_init (app_info);
loop = g_main_loop_new (NULL, FALSE);
g_main_loop_run (loop);
g_free (app_info);
return 0;
}

View file

@ -0,0 +1,12 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy context="default">
<allow own="org.freedesktop.NetworkManagerInfo"/>
<allow send_destination="org.freedesktop.NetworkManagerInfo"/>
<allow send_interface="org.freedesktop.NetworkManagerInfo"/>
</policy>
</busconfig>

View file

@ -0,0 +1,42 @@
/* NetworkManagerInfo -- Manage allowed access points and provide a UI
* for WEP key entry
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2004 Red Hat, Inc.
*/
#ifndef NETWORK_MANAGER_INFO_H
#define NETWORK_MANAGER_INFO_H
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
struct NMIAppInfo
{
GladeXML *xml;
DBusConnection *connection;
};
typedef struct NMIAppInfo NMIAppInfo;
void nmi_show_user_key_dialog (const char *device, const char *network, NMIAppInfo *info);
void nmi_cancel_user_key_dialog (NMIAppInfo *info);
#endif

View file

@ -0,0 +1,209 @@
/* NetworkManagerInfo -- Manage allowed access points and provide a UI
* for WEP key entry
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2004 Red Hat, Inc.
*/
#include <glib.h>
#include <dbus/dbus-glib.h>
#include <stdio.h>
#include <string.h>
#include "NetworkManagerInfo.h"
#include "NetworkManagerInfoDbus.h"
#define NMI_DBUS_NMI_OBJECT_PATH_PREFIX "/org/freedesktop/NetworkManagerInfo"
#define NMI_DBUS_NMI_NAMESPACE "org.freedesktop.NetworkManagerInfo"
/*
* nmi_dbus_create_error_message
*
* Make a DBus error message
*
*/
static DBusMessage *nmi_dbus_create_error_message (DBusMessage *message, const char *exception_namespace,
const char *exception, const char *format, ...)
{
DBusMessage *reply_message;
va_list args;
char error_text[512];
va_start (args, format);
vsnprintf (error_text, 512, format, args);
va_end (args);
char *exception_text = g_strdup_printf ("%s.%s", exception_namespace, exception);
reply_message = dbus_message_new_error (message, exception_text, error_text);
g_free (exception_text);
return (reply_message);
}
/*
* nmi_dbus_dbus_return_user_key
*
* Alert NetworkManager of the new user key
*
*/
void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
const char *network, const char *passphrase)
{
DBusMessage *message;
DBusMessageIter iter;
g_return_if_fail (connection != NULL);
g_return_if_fail (device != NULL);
g_return_if_fail (network != NULL);
g_return_if_fail (passphrase != NULL);
message = dbus_message_new_method_call ("org.freedesktop.NetworkManager",
"/org/freedesktop/NetworkManager",
"org.freedesktop.NetworkManager",
"setKeyForNetwork");
if (message == NULL)
{
fprintf (stderr, "nmi_dbus_return_user_key(): Couldn't allocate the dbus message\n");
return;
}
/* Add network name and passphrase */
dbus_message_iter_init (message, &iter);
dbus_message_iter_append_string (&iter, device);
dbus_message_iter_append_string (&iter, network);
dbus_message_iter_append_string (&iter, passphrase);
if (!dbus_connection_send (connection, message, NULL))
{
fprintf (stderr, "nmi_dbus_return_user_key(): dbus could not send the message\n");
return;
}
}
/*
* nmi_dbus_nmi_message_handler
*
* Responds to requests for our services
*
*/
static DBusHandlerResult nmi_dbus_nmi_message_handler (DBusConnection *connection, DBusMessage *message, void *user_data)
{
const char *method;
const char *path;
NMIAppInfo *info = (NMIAppInfo *)user_data;
DBusMessage *reply_message = NULL;
g_return_val_if_fail (info != NULL, DBUS_HANDLER_RESULT_HANDLED);
method = dbus_message_get_member (message);
path = dbus_message_get_path (message);
/* fprintf (stderr, "nmi_dbus_nmi_message_handler() got method %s for path %s\n", method, path); */
if (strcmp ("getKeyForNetwork", method) == 0)
{
GtkWidget *dialog = glade_xml_get_widget (info->xml, "passphrase_dialog");
if (!GTK_WIDGET_VISIBLE (dialog))
{
DBusMessageIter iter;
char *dbus_string;
char *device = NULL;
char *network = NULL;
dbus_message_iter_init (message, &iter);
/* Grab device */
dbus_string = dbus_message_iter_get_string (&iter);
device = (dbus_string == NULL ? NULL : strdup (dbus_string));
dbus_free (dbus_string);
/* Grab network to get key for */
if (dbus_message_iter_next (&iter))
{
dbus_string = dbus_message_iter_get_string (&iter);
network = (dbus_string == NULL ? NULL : strdup (dbus_string));
dbus_free (dbus_string);
}
if (device && network)
nmi_show_user_key_dialog (device, network, info);
g_free (device);
g_free (network);
}
}
else if (strcmp ("cancelGetKeyForNetwork", method) == 0)
{
GtkWidget *dialog = glade_xml_get_widget (info->xml, "passphrase_dialog");
if (GTK_WIDGET_VISIBLE (dialog))
nmi_cancel_user_key_dialog (info);
}
else
{
reply_message = nmi_dbus_create_error_message (message, NMI_DBUS_NMI_NAMESPACE, "UnknownMethod",
"NetworkManagerInfo knows nothing about the method %s for object %s", method, path);
dbus_connection_send (connection, reply_message, NULL);
}
return (DBUS_HANDLER_RESULT_HANDLED);
}
/*
* nmi_dbus_nmi_unregister_handler
*
* Nothing happens here.
*
*/
void nmi_dbus_nmi_unregister_handler (DBusConnection *connection, void *user_data)
{
/* do nothing */
}
/*
* nmi_dbus_service_init
*
* Connect to the system messagebus and register ourselves as a service.
*
*/
int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info)
{
DBusError dbus_error;
DBusObjectPathVTable nmi_vtable = { &nmi_dbus_nmi_unregister_handler, &nmi_dbus_nmi_message_handler, NULL, NULL, NULL, NULL };
const char *nmi_path[] = { "org", "freedesktop", "NetworkManagerInfo", NULL };
dbus_error_init (&dbus_error);
dbus_bus_acquire_service (dbus_connection, NMI_DBUS_NMI_NAMESPACE, 0, &dbus_error);
if (dbus_error_is_set (&dbus_error))
{
fprintf (stderr, "nmi_dbus_service_init() could not acquire its service. dbus_bus_acquire_service() says: '%s'\n", dbus_error.message);
return (-1);
}
if (!dbus_connection_register_object_path (dbus_connection, nmi_path, &nmi_vtable, info))
{
fprintf (stderr, "nmi_dbus_service_init() could not register a handler for NetworkManagerInfo. Not enough memory?\n");
return (-1);
}
return (0);
}

View file

@ -0,0 +1,35 @@
/* NetworkManagerInfo -- Manage allowed access points and provide a UI
* for WEP key entry
*
* Dan Williams <dcbw@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* (C) Copyright 2004 Red Hat, Inc.
*/
#ifndef NETWORK_MANAGER_INFO_DBUS_SERVICE_H
#define NETWORK_MANAGER_INFO_DBUS_SERVICE_H
#include <glib.h>
#include <dbus/dbus-glib.h>
#include "NetworkManagerInfo.h"
int nmi_dbus_service_init (DBusConnection *dbus_connection, NMIAppInfo *info);
void nmi_dbus_return_user_key (DBusConnection *connection, const char *device,
const char *network, const char *passphrase);
#endif

BIN
info-daemon/keyring.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -0,0 +1,189 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="passphrase_dialog">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancel_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
</widget>
</child>
<child>
<widget class="GtkButton" id="login_button">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Login to AP</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="pixbuf">keyring.png</property>
<property name="xalign">0.5</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">12</property>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;span weight=&quot;bold&quot; size=&quot;larger&quot;&gt;Passphrase Required by Wireless Network&lt;/span&gt;
A passphrase or WEP key is required to access the wireless network '%s'.</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">True</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">6</property>
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="label" translatable="yes">Passphrase:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="passphrase_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" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View file

@ -56,6 +56,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GLADE_CFLAGS = @GLADE_CFLAGS@
GLADE_LIBS = @GLADE_LIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@

View file

@ -98,7 +98,7 @@ NMAccessPoint * nm_ap_new_from_ap (NMAccessPoint *src_ap)
new_ap->quality = src_ap->quality;
new_ap->freq = src_ap->freq;
new_ap->rate = src_ap->rate;
new_ap->encrypted = new_ap->encrypted;
new_ap->encrypted = src_ap->encrypted;
if (src_ap->wep_key && (strlen (src_ap->wep_key) > 0))
new_ap->wep_key = g_strdup (src_ap->wep_key);

View file

@ -172,7 +172,7 @@ NMAccessPoint *nm_dbus_get_network_from_object_path (const char *path, NMDevice
g_return_val_if_fail (path != NULL, NULL);
while ((ap = nm_device_ap_list_get_ap (dev, i)) != NULL)
while ((ap = nm_device_ap_list_get_ap_by_index (dev, i)) != NULL)
{
snprintf (compare_path, 100, "%s/%d/Networks/%d", NM_DBUS_DEVICES_OBJECT_PATH_PREFIX, dev_index, i);
if (strncmp (path, compare_path, strlen (compare_path)) == 0)
@ -413,49 +413,6 @@ void nm_dbus_signal_device_now_active (DBusConnection *connection, NMDevice *dev
}
/*
* nm_dbus_signal_need_key_for_network
*
* Notifies the bus that NetworkManager needs a encryption key for a particular access point,
* because it does not have one or the one stored with allowed access points is wrong.
*
* Returns: 0 on no error
* -1 on error
*/
int nm_dbus_signal_need_key_for_network (DBusConnection *connection, NMDevice *dev, NMAccessPoint *ap)
{
DBusMessage *message;
unsigned char *object_path = g_new0 (unsigned char, 100);
int return_val = -1;
g_return_val_if_fail (dev != NULL, -1);
g_return_val_if_fail (ap != NULL, -1);
g_return_val_if_fail (nm_ap_get_essid (ap) != NULL, -1);
message = dbus_message_new_signal (NM_DBUS_NM_OBJECT_PATH_PREFIX, NM_DBUS_NM_NAMESPACE, "NeedKeyForNetwork");
if (!message)
{
NM_DEBUG_PRINT ("nm_dbus_signal_need_wep_key_for_network(): Not enough memory for new dbus message!\n");
return (return_val);
}
nm_dbus_get_object_path_from_device (dev, object_path, 100, FALSE);
dbus_message_append_args (message, DBUS_TYPE_STRING, object_path, DBUS_TYPE_INVALID);
dbus_message_append_args (message, DBUS_TYPE_STRING, nm_ap_get_essid (ap), DBUS_TYPE_INVALID);
g_free (object_path);
if (!dbus_connection_send (connection, message, NULL))
{
NM_DEBUG_PRINT ("nm_dbus_signal_need_wep_key_for_network(): Could not raise the NeedKeyForNetwork signal!\n");
}
else
return_val = 0;
dbus_message_unref (message);
return (return_val);
}
/*
* nm_dbus_signal_device_ip4_address_change
*
@ -484,6 +441,175 @@ void nm_dbus_signal_device_ip4_address_change (DBusConnection *connection, NMDev
dbus_message_unref (message);
}
#if 0
/*
* nm_dbus_get_user_key_for_network_callback
*
* Called from the DBus Pending Call upon receipt of a reply
* message from NetworkManagerInfo.
*
*/
void nm_dbus_get_user_key_for_network_callback (DBusPendingCall *pending, void *user_data)
{
char *key = NULL;
DBusMessage *reply;
DBusMessageIter iter;
NMDevice *dev = (NMDevice *)user_data;
g_return_if_fail (dev != NULL);
reply = dbus_pending_call_get_reply (pending);
if (reply && !dbus_message_is_error (reply, DBUS_ERROR_NO_REPLY))
{
dbus_message_iter_init (reply, &iter);
key = dbus_message_iter_get_string (&iter);
nm_device_pending_action_set_user_key (dev, key);
fprintf (stderr, "dbus user key callback got key '%s'\n", key );
dbus_free (key);
dbus_pending_call_unref (pending);
}
}
/*
* nm_dbus_get_user_key_for_network_data_free
*
* Frees data used during the user key pending action
*
*/
void nm_dbus_get_user_key_for_network_data_free (void *user_data)
{
g_return_if_fail (user_data != NULL);
nm_device_unref ((NMDevice *)user_data);
}
#endif
/*
* nm_dbus_get_user_key_for_network
*
* Asks NetworkManagerInfo for a user-entered WEP key.
*
*/
void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMDevice *dev, NMAccessPoint *ap,
DBusPendingCall **pending)
{
DBusMessage *message;
DBusMessageIter iter;
g_return_if_fail (dev != NULL);
g_return_if_fail (ap != NULL);
g_return_if_fail (nm_ap_get_essid (ap) != NULL);
message = dbus_message_new_method_call ("org.freedesktop.NetworkManagerInfo",
"/org/freedesktop/NetworkManagerInfo",
"org.freedesktop.NetworkManagerInfo",
"getKeyForNetwork");
if (message == NULL)
{
NM_DEBUG_PRINT ("nm_dbus_get_user_key_for_network(): Couldn't allocate the dbus message\n");
return;
}
dbus_message_iter_init (message, &iter);
dbus_message_iter_append_string (&iter, nm_device_get_iface (dev));
dbus_message_iter_append_string (&iter, nm_ap_get_essid (ap));
if (!dbus_connection_send (connection, message, NULL))
NM_DEBUG_PRINT ("nm_dbus_get_user_key_for_network(): could not send dbus message\n");
/* For asynchronous replies, disabled for now */
#if 0
if (!dbus_connection_send_with_reply (connection, message, pending, -1))
{
fprintf (stderr, "%s raised:\n %s\n\n", error.name, error.message);
dbus_message_unref (message);
return;
}
nm_device_ref (dev);
dbus_pending_call_ref (*pending);
dbus_pending_call_set_notify (*pending, &nm_dbus_get_user_key_for_network_callback,
(void *)dev, &nm_dbus_get_user_key_for_network_data_free);
#endif
dbus_message_unref (message);
}
/*
* nm_dbus_set_user_key_for_network
*
* In response to a NetworkManagerInfo message, sets the WEP key
* for a particular wireless AP/network
*
*/
static void nm_dbus_set_user_key_for_network (DBusConnection *connection, DBusMessage *message)
{
DBusMessageIter iter;
char *device;
char *network;
char *passphrase;
char *dbus_string;
dbus_message_iter_init (message, &iter);
/* Grab device */
dbus_string = dbus_message_iter_get_string (&iter);
device = (dbus_string == NULL ? NULL : strdup (dbus_string));
dbus_free (dbus_string);
/* Grab network */
dbus_string = dbus_message_iter_get_string (&iter);
network = (dbus_string == NULL ? NULL : strdup (dbus_string));
dbus_free (dbus_string);
/* Grab passphrase */
dbus_string = dbus_message_iter_get_string (&iter);
passphrase = (dbus_string == NULL ? NULL : strdup (dbus_string));
dbus_free (dbus_string);
if (device && network && passphrase)
{
NMData *data = nm_get_global_data();
NMDevice *dev = nm_get_device_by_iface (data, device);
if (dev)
nm_device_pending_action_set_user_key (dev, passphrase);
}
g_free (device);
g_free (network);
g_free (passphrase);
}
/*
* nm_dbus_cancel_get_user_key_for_network
*
* Sends a user-key cancellation message to NetworkManagerInfo
*
*/
void nm_dbus_cancel_get_user_key_for_network (DBusConnection *connection)
{
DBusMessage *message;
message = dbus_message_new_method_call ("org.freedesktop.NetworkManagerInfo",
"/org/freedesktop/NetworkManagerInfo",
"org.freedesktop.NetworkManagerInfo",
"cancelGetKeyForNetwork");
if (message == NULL)
{
NM_DEBUG_PRINT ("nm_dbus_cancel_get_user_key_for_network(): Couldn't allocate the dbus message\n");
return;
}
if (!dbus_connection_send (connection, message, NULL))
NM_DEBUG_PRINT ("nm_dbus_cancel_get_user_key_for_network(): could not send dbus message\n");
dbus_message_unref (message);
}
/*
* nm_dbus_devices_handle_networks_request
@ -582,30 +708,12 @@ static DBusMessage *nm_dbus_devices_handle_request (DBusConnection *connection,
dbus_message_iter_append_int32 (&iter, nm_device_get_iface_type (dev));
else if (strcmp ("getIP4Address", request) == 0)
dbus_message_iter_append_uint32 (&iter, nm_device_get_ip4_address (dev));
else if (strcmp ("setKeyForNetwork", request) == 0)
{
DBusMessageIter key_iter;
char *dbus_string;
char *key;
dbus_message_iter_init (message, &key_iter);
dbus_string = dbus_message_iter_get_string (&key_iter);
key = (dbus_string == NULL ? NULL : strdup (dbus_string));
dbus_free (dbus_string);
if (!key)
{
NM_DEBUG_PRINT ("NetworkManagerClient returned a NULL key in setKeyForNetwork message" )
}
else
nm_device_pending_action_set_user_key (dev, key);
}
else if (strcmp ("getActiveNetwork", request) == 0)
{
NMAccessPoint *ap = NULL;
int i = 0;
while ((ap = nm_device_ap_list_get_ap (dev, i)) != NULL)
while ((ap = nm_device_ap_list_get_ap_by_index (dev, i)) != NULL)
{
if (nm_null_safe_strcmp (nm_ap_get_essid (ap), nm_device_get_essid (dev)) == 0)
{
@ -630,7 +738,7 @@ static DBusMessage *nm_dbus_devices_handle_request (DBusConnection *connection,
dbus_message_iter_append_array (&iter, &iter_array, DBUS_TYPE_STRING);
while ((ap = nm_device_ap_list_get_ap (dev, i)) != NULL)
while ((ap = nm_device_ap_list_get_ap_by_index (dev, i)) != NULL)
{
object_path = g_strdup_printf ("%s/%d/Networks/%d", NM_DBUS_DEVICES_OBJECT_PATH_PREFIX, dev_index, i);
dbus_message_iter_append_string (&iter_array, object_path);
@ -643,9 +751,7 @@ static DBusMessage *nm_dbus_devices_handle_request (DBusConnection *connection,
{
/* Must destroy the allocated message */
dbus_message_unref (reply_message);
reply_message = nm_dbus_create_error_message (message, NM_DBUS_NM_NAMESPACE, "UnknownMethod",
"NetworkManager knows nothing about the method %s for object %s", request, path);
reply_message = NULL;
}
return (reply_message);
@ -663,23 +769,29 @@ static DBusHandlerResult nm_dbus_nm_message_handler (DBusConnection *connection,
const char *method;
const char *path;
DBusMessage *reply_message = NULL;
gboolean handled = TRUE;
method = dbus_message_get_member (message);
path = dbus_message_get_path (message);
/* NM_DEBUG_PRINT_2 ("nm_dbus_nm_message_handler() got method %s for path %s\n", method, path); */
NM_DEBUG_PRINT_2 ("nm_dbus_nm_message_handler() got method %s for path %s\n", method, path);
if (strcmp ("getActiveDevice", method) == 0)
reply_message = nm_dbus_nm_get_active_device (connection, message);
else if (strcmp ("getDevices", method) == 0)
reply_message = nm_dbus_nm_get_devices (connection, message);
else if (strcmp ("setKeyForNetwork", method) == 0)
nm_dbus_set_user_key_for_network (connection, message);
else
reply_message = nm_dbus_create_error_message (message, NM_DBUS_NM_NAMESPACE, "UnknownMethod",
"NetworkManager knows nothing about the method %s for object %s", method, path);
handled = FALSE;
dbus_connection_send (connection, reply_message, NULL);
if (reply_message)
{
dbus_connection_send (connection, reply_message, NULL);
dbus_message_unref (reply_message);
}
return (DBUS_HANDLER_RESULT_HANDLED);
return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
}
@ -710,12 +822,14 @@ static DBusHandlerResult nm_dbus_devices_message_handler (DBusConnection *connec
method = dbus_message_get_member (message);
path = dbus_message_get_path (message);
/* NM_DEBUG_PRINT_2 ("nm_dbus_devices_message_handler() got method %s for path %s\n", method, path); */
if ((reply_message = nm_dbus_devices_handle_request (connection, message, path, method)))
{
dbus_connection_send (connection, reply_message, NULL);
dbus_message_unref (reply_message);
return (DBUS_HANDLER_RESULT_HANDLED);
}
reply_message = nm_dbus_devices_handle_request (connection, message, path, method);
dbus_connection_send (connection, reply_message, NULL);
return (DBUS_HANDLER_RESULT_HANDLED);
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
}

View file

@ -40,6 +40,8 @@ void nm_dbus_signal_device_now_active (DBusConnection *connection, NMDevice
void nm_dbus_signal_device_ip4_address_change(DBusConnection *connection, NMDevice *dev);
int nm_dbus_signal_need_key_for_network (DBusConnection *connection, NMDevice *dev, NMAccessPoint *ap);
void nm_dbus_get_user_key_for_network (DBusConnection *connection, NMDevice *dev, NMAccessPoint *ap, DBusPendingCall **pending);
void nm_dbus_cancel_get_user_key_for_network (DBusConnection *connection);
#endif

View file

@ -190,7 +190,8 @@ typedef union NMDeviceOptions
typedef struct NMPendingActionUserKeyOptions
{
unsigned char *essid; // ESSID we are waiting for a key for
unsigned char *essid; // ESSID we are waiting for a key for
DBusPendingCall *pending_call;
} NMPendingActionUserKeyOptions;
typedef union NMPendingActionOptions
@ -415,26 +416,8 @@ void nm_device_update_link_active (NMDevice *dev, gboolean check_mii)
iwlib_socket = iw_sockets_open ();
if (iw_get_ext (iwlib_socket, nm_device_get_iface (dev), SIOCGIWAP, &wrq) >= 0)
{
NMAccessPoint *ap = nm_device_get_best_ap (dev);
unsigned char *essid = nm_device_get_essid (dev);
if (ap && essid && (strcmp (essid, nm_ap_get_essid (ap)) == 0))
{
fprintf (stderr, "Best AP: '%s', current AP: '%s'\n", nm_ap_get_essid (ap), nm_device_get_essid (dev));
/* If either:
* 1) the associated AP's MAC address is valid, or
* 2) its not valid but encryption is turned on (not valid b/c key might be wrong)
* then we consider there to be a "link"
*/
if (nm_ethernet_address_is_valid ((struct ether_addr *)(&(wrq.u.ap_addr.sa_data))))
link_active = TRUE;
else if (nm_ap_get_encrypted (ap))
{
link_active = TRUE;
/* Make sure we are at least attempting to get the key */
nm_device_pending_action_get_user_key (dev, ap);
}
}
if (nm_ethernet_address_is_valid ((struct ether_addr *)(&(wrq.u.ap_addr.sa_data))))
link_active = TRUE;
}
close (iwlib_socket);
break;
@ -802,34 +785,52 @@ gboolean nm_device_activate (NMDevice *dev)
/* If its a wireless device, set the ESSID and WEP key */
if (nm_device_is_wireless (dev))
{
NMAccessPoint *ap = nm_device_get_best_ap (dev);
NMAccessPoint *best_ap = nm_device_get_best_ap (dev);
/* If the card is just inserted, we may not have had a chance to scan yet */
if (!ap)
if (!best_ap)
{
nm_device_do_wireless_scan (dev);
ap = nm_device_get_best_ap (dev);
best_ap = nm_device_get_best_ap (dev);
}
/* If there is a desired AP to connect to, use that essid and possible WEP key */
if (ap && nm_ap_get_essid (ap))
if (best_ap && nm_ap_get_essid (best_ap))
{
nm_device_bring_down (dev);
nm_device_set_essid (dev, nm_ap_get_essid (ap));
nm_device_set_essid (dev, nm_ap_get_essid (best_ap));
/* Disable WEP */
nm_device_set_wep_key (dev, NULL);
if (nm_ap_get_wep_key (ap))
nm_device_set_wep_key (dev, nm_ap_get_wep_key (ap));
if (nm_ap_get_encrypted (best_ap) && nm_ap_get_wep_key (best_ap))
nm_device_set_wep_key (dev, nm_ap_get_wep_key (best_ap));
NM_DEBUG_PRINT_2 ("nm_device_activate(%s) using essid '%s'\n", nm_device_get_iface (dev), nm_ap_get_essid (ap));
NM_DEBUG_PRINT_2 ("nm_device_activate(%s) using essid '%s'\n", nm_device_get_iface (dev), nm_ap_get_essid (best_ap));
/* Bring the device up */
if (!nm_device_is_up (dev));
nm_device_bring_up (dev);
/* If we don't have a link, it probably means the access point has
* encryption enabled and we don't have the right WEP key.
*/
nm_device_update_link_active (dev, FALSE);
if ( !nm_device_get_link_active (dev)
&& !nm_device_need_ap_switch (dev)
&& nm_ap_get_encrypted (best_ap))
{
nm_device_pending_action_get_user_key (dev, best_ap);
return (FALSE);
}
}
}
/* Bring the device up */
if (!nm_device_is_up (dev));
nm_device_bring_up (dev);
else
{
/* Bring the device up */
if (!nm_device_is_up (dev));
nm_device_bring_up (dev);
}
/* Kill the old default route */
snprintf (buf, 500, "/sbin/ip route del default");
@ -871,7 +872,9 @@ gboolean nm_device_activate (NMDevice *dev)
snprintf (buf, 500, "/sbin/dhclient -1 -q -lf /var/lib/dhcp/dhclient-%s.leases -pf /var/run/dhclient-%s.pid -cf /etc/dhclient-%s.conf %s\n",
iface, iface, iface, iface);
dhclient_err = system (buf);
if (dhclient_err != 0)
if (dhclient_err == 0)
success = TRUE;
else
{
/* Interfaces cannot be down if they are the active interface,
* otherwise we cannot use them for scanning or link detection.
@ -885,7 +888,6 @@ gboolean nm_device_activate (NMDevice *dev)
}
nm_device_bring_up (dev);
success = FALSE;
}
/* Set the hostname back to what it was before so that X11 doesn't
@ -958,6 +960,12 @@ gboolean nm_device_deactivate (NMDevice *dev, gboolean just_added)
}
/*
* nm_device_pending_action
*
* Returns whether the device is blocking on a pending action or not.
*
*/
gboolean nm_device_pending_action (NMDevice *dev)
{
g_return_val_if_fail (dev != NULL, FALSE);
@ -965,6 +973,14 @@ gboolean nm_device_pending_action (NMDevice *dev)
return (dev->pending_action != NM_PENDING_ACTION_NONE);
}
/*
* nm_device_pending_action_get_user_key
*
* Initiate a pending action to retrieve a key from the user, using
* NetworkManagerInfo daemon.
*
*/
void nm_device_pending_action_get_user_key (NMDevice *dev, NMAccessPoint *ap)
{
NMData *data = nm_get_global_data ();
@ -978,13 +994,19 @@ void nm_device_pending_action_get_user_key (NMDevice *dev, NMAccessPoint *ap)
if (dev->pending_action != NM_PENDING_ACTION_NONE)
return;
if (nm_dbus_signal_need_key_for_network (data->dbus_connection, dev, ap) == 0)
{
dev->pending_action = NM_PENDING_ACTION_GET_USER_KEY;
dev->pending_action_options.user_key.essid = g_strdup (nm_ap_get_essid (ap));
}
dev->pending_action = NM_PENDING_ACTION_GET_USER_KEY;
dev->pending_action_options.user_key.essid = g_strdup (nm_ap_get_essid (ap));
nm_dbus_get_user_key_for_network (data->dbus_connection, dev, ap, &(dev->pending_action_options.user_key.pending_call));
}
/*
* nm_device_pending_action_set_user_key
*
* Called upon receipt of a NetworkManagerInfo reply with a
* user-supplied key.
*
*/
void nm_device_pending_action_set_user_key (NMDevice *dev, unsigned char *key)
{
g_return_if_fail (dev != NULL);
@ -1011,13 +1033,35 @@ void nm_device_pending_action_set_user_key (NMDevice *dev, unsigned char *key)
dev->pending_action = NM_PENDING_ACTION_NONE;
}
/*
* nm_device_cancel_pending_action
*
* Cancel any pending actions a device is blocking on and clean up
* those actions' data.
*
*/
void nm_device_pending_action_cancel (NMDevice *dev)
{
g_return_if_fail (dev != NULL);
NMData *data = nm_get_global_data ();
g_return_if_fail (dev != NULL);
g_return_if_fail (data != NULL);
if (dev->pending_action == NM_PENDING_ACTION_GET_USER_KEY)
{
/* Tell NetworkManagerInfo to cancel the operation, and clean up data related to it */
#if 0
dbus_pending_call_cancel (dev->pending_action_options.user_key.pending_call);
dbus_pending_call_unref (dev->pending_action_options.user_key.pending_call);
#endif
if ( dev->pending_action == NM_PENDING_ACTION_GET_USER_KEY
&& dev->pending_action_options.user_key.essid)
g_free (dev->pending_action_options.user_key.essid);
dev->pending_action_options.user_key.essid = NULL;
nm_dbus_cancel_get_user_key_for_network (data->dbus_connection);
}
dev->pending_action = NM_PENDING_ACTION_NONE;
}
@ -1083,14 +1127,13 @@ void nm_device_ap_list_clear (NMDevice *dev)
/*
* nm_device_ap_list_get_ap
* nm_device_ap_list_get_ap_by_index
*
* Get the access point at a specified index in the list
*
*/
NMAccessPoint *nm_device_ap_list_get_ap (NMDevice *dev, int index)
NMAccessPoint *nm_device_ap_list_get_ap_by_index (NMDevice *dev, int index)
{
GSList *element;
NMAccessPoint *ap = NULL;
g_return_val_if_fail (dev != NULL, NULL);
@ -1101,9 +1144,9 @@ NMAccessPoint *nm_device_ap_list_get_ap (NMDevice *dev, int index)
if (nm_try_acquire_mutex (dev->dev_options.wireless.ap_list_mutex, __FUNCTION__))
{
int i = 0;
GSList *element = dev->dev_options.wireless.ap_list;
int i = 0;
element = dev->dev_options.wireless.ap_list;
while (element)
{
if (element->data && (index == i))
@ -1122,6 +1165,43 @@ NMAccessPoint *nm_device_ap_list_get_ap (NMDevice *dev, int index)
}
/*
* nm_device_ap_list_get_ap_by_essid
*
* Get the access point for a specific essid
*
*/
NMAccessPoint *nm_device_ap_list_get_ap_by_essid (NMDevice *dev, const char *essid)
{
NMAccessPoint *ret_ap = NULL;
g_return_val_if_fail (dev != NULL, NULL);
g_return_val_if_fail (nm_device_is_wireless (dev), NULL);
g_return_val_if_fail (essid != NULL, NULL);
if (!dev->dev_options.wireless.ap_list)
return (NULL);
if (nm_try_acquire_mutex (dev->dev_options.wireless.ap_list_mutex, __FUNCTION__))
{
GSList *element = dev->dev_options.wireless.ap_list;
while (element)
{
NMAccessPoint *ap = (NMAccessPoint *)(element->data);
if (ap && nm_ap_get_essid (ap) && (strcmp (nm_ap_get_essid (ap), essid) == 0))
{
ret_ap = ap;
break;
}
element = g_slist_next (element);
}
nm_unlock_mutex (dev->dev_options.wireless.ap_list_mutex, __FUNCTION__);
}
return (ret_ap);
}
/*
* Get/Set functions for "best" access point
*
@ -1143,10 +1223,8 @@ void nm_device_set_best_ap (NMDevice *dev, NMAccessPoint *ap)
if (dev->dev_options.wireless.best_ap)
nm_ap_unref (dev->dev_options.wireless.best_ap);
/* We create a _copy_ of the AP, because we may need to get a WEP
* key from the user later and we set it on the AP.
*/
dev->dev_options.wireless.best_ap = nm_ap_new_from_ap (ap);
nm_ap_ref (ap);
dev->dev_options.wireless.best_ap = ap;
}
gboolean nm_device_need_ap_switch (NMDevice *dev)
@ -1243,9 +1321,10 @@ static void nm_device_do_normal_scan (NMDevice *dev)
if (highest_priority_ap)
nm_ap_unref (highest_priority_ap);
highest_priority_ap = nm_ap_new_from_ap (nm_ap);
highest_priority_ap = nm_ap;
}
nm_ap_unref (nm_ap);
else
nm_ap_unref (nm_ap);
}
tmp_ap = tmp_ap->next;
}
@ -1257,7 +1336,7 @@ static void nm_device_do_normal_scan (NMDevice *dev)
if ( highest_priority_ap
&& (!nm_device_get_best_ap (dev) || (nm_null_safe_strcmp (nm_device_get_essid (dev), nm_ap_get_essid (highest_priority_ap)) != 0)))
{
nm_device_set_best_ap (dev, nm_ap_new_from_ap (highest_priority_ap));
nm_device_set_best_ap (dev, highest_priority_ap);
nm_data_set_state_modified (nm_get_global_data (), TRUE);
nm_ap_unref (highest_priority_ap);
@ -1344,7 +1423,7 @@ static void nm_device_do_pseudo_scan (NMDevice *dev)
{
NM_DEBUG_PRINT_1 ("AP %s looks good, setting to desired\n", nm_ap_get_essid (ap));
nm_device_set_best_ap (dev, nm_ap_new_from_ap (ap));
nm_device_set_best_ap (dev, ap);
nm_data_set_state_modified (nm_get_global_data (), TRUE);
break;
}

View file

@ -91,7 +91,8 @@ void nm_device_pending_action_set_user_key (NMDevice *dev, unsigned char *key)
void nm_device_ap_list_add (NMDevice *dev, NMAccessPoint *ap);
void nm_device_ap_list_clear (NMDevice *dev);
NMAccessPoint *nm_device_ap_list_get_ap (NMDevice *dev, int index);
NMAccessPoint *nm_device_ap_list_get_ap_by_index (NMDevice *dev, int index);
NMAccessPoint *nm_device_ap_list_get_ap_by_essid (NMDevice *dev, const char *essid);
NMDevice * nm_get_device_by_udi (NMData *data, const char *udi);
NMDevice * nm_get_device_by_iface (NMData *data, const char *iface);

View file

@ -86,6 +86,21 @@ NMDevice * nm_policy_get_best_device (NMData *data)
}
else if (iface_type == NM_IFACE_TYPE_WIRELESS_ETHERNET)
{
NMAccessPoint *best_ap = nm_device_get_best_ap (dev);
/* This deals with the case where the WEP key we have
* for an access point is wrong. In that case, the
* MAC address of the associated AP will be invalid,
* so link_active will be FALSE. However, we still want
* to use this card and AP, just need to get the correct
* WEP key from the user via NetworkManagerInfo.
*/
if ( !link_active
&& !nm_device_need_ap_switch (dev)
&& best_ap
&& nm_ap_get_encrypted (best_ap))
link_active = TRUE;
if (link_active)
prio += 1;
@ -164,14 +179,6 @@ gboolean nm_state_modification_monitor (gpointer user_data)
if ((best_dev = nm_policy_get_best_device (data)) != NULL)
nm_device_ref (best_dev);
/* Cancel pending device actions on an existing pending device */
if (data->pending_device)
{
nm_device_pending_action_cancel (data->pending_device);
nm_device_unref (data->pending_device);
data->pending_device = NULL;
}
/* Only do a switch when:
* 1) the best_dev is different from data->active_device, OR
* 2) best_dev is wireless and its access point is not the "best" ap, OR
@ -181,6 +188,14 @@ gboolean nm_state_modification_monitor (gpointer user_data)
|| ( best_dev && nm_device_is_wireless (best_dev)
&& (nm_device_need_ap_switch (best_dev) || (nm_device_get_ip4_address (best_dev) == 0))))
{
/* Cancel pending device actions on an existing pending device */
if (data->pending_device && (best_dev != data->pending_device))
{
nm_device_pending_action_cancel (data->pending_device);
nm_device_unref (data->pending_device);
data->pending_device = NULL;
}
NM_DEBUG_PRINT_1 ("nm_state_modification_monitor() set pending_device = %s\n", best_dev ? nm_device_get_iface (best_dev) : "(null)");
data->pending_device = best_dev;
@ -208,11 +223,16 @@ gboolean nm_state_modification_monitor (gpointer user_data)
*/
if (!nm_device_pending_action (data->pending_device))
{
NM_DEBUG_PRINT_1 ("nm_state_modification_monitor() will activate device %s\n", nm_device_get_iface (data->pending_device));
/* Only move it from pending -> active if the activation was successfull,
* otherwise keep trying to activate it successfully.
*/
if (nm_device_activate (data->pending_device))
{
NM_DEBUG_PRINT_1 ("nm_state_modification_monitor() activated device %s\n", nm_device_get_iface (data->pending_device));
data->active_device = data->pending_device;
data->pending_device = NULL;
nm_device_activate (data->active_device);
data->active_device = data->pending_device;
data->pending_device = NULL;
}
}
}

View file

@ -1,11 +1,10 @@
INCLUDES = \
$(NM_CFLAGS) \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DBINDIR=\"$(bindir)\" \
INCLUDES = \
$(NM_CFLAGS) \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DBINDIR=\"$(bindir)\" \
-DDATADIR=\"$(datadir)\"
noinst_PROGRAMS = nmclienttest
noinst_PROGRAMS = nmtest
nmclienttest_SOURCES = nmclienttest.c
nmclienttest_LDADD = $(NM_LIBS)
nmtest_SOURCES = nmclienttest.c
nmtest_LDADD = $(NM_LIBS)

View file

@ -56,6 +56,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GLADE_CFLAGS = @GLADE_CFLAGS@
GLADE_LIBS = @GLADE_LIBS@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
@ -108,28 +110,27 @@ sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
INCLUDES = \
$(NM_CFLAGS) \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DBINDIR=\"$(bindir)\" \
$(NM_CFLAGS) \
-DDBUS_API_SUBJECT_TO_CHANGE \
-DBINDIR=\"$(bindir)\" \
-DDATADIR=\"$(datadir)\"
noinst_PROGRAMS = nmclienttest
noinst_PROGRAMS = nmtest
nmclienttest_SOURCES = nmclienttest.c
nmclienttest_LDADD = $(NM_LIBS)
nmtest_SOURCES = nmclienttest.c
nmtest_LDADD = $(NM_LIBS)
subdir = test
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
noinst_PROGRAMS = nmclienttest$(EXEEXT)
noinst_PROGRAMS = nmtest$(EXEEXT)
PROGRAMS = $(noinst_PROGRAMS)
am_nmclienttest_OBJECTS = nmclienttest.$(OBJEXT)
nmclienttest_OBJECTS = $(am_nmclienttest_OBJECTS)
nmclienttest_DEPENDENCIES =
nmclienttest_LDFLAGS =
am_nmtest_OBJECTS = nmclienttest.$(OBJEXT)
nmtest_OBJECTS = $(am_nmtest_OBJECTS)
nmtest_DEPENDENCIES =
nmtest_LDFLAGS =
DEFAULT_INCLUDES = -I. -I$(srcdir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
@ -139,9 +140,9 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(nmclienttest_SOURCES)
DIST_SOURCES = $(nmtest_SOURCES)
DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
SOURCES = $(nmclienttest_SOURCES)
SOURCES = $(nmtest_SOURCES)
all: all-am
@ -155,9 +156,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
nmclienttest$(EXEEXT): $(nmclienttest_OBJECTS) $(nmclienttest_DEPENDENCIES)
@rm -f nmclienttest$(EXEEXT)
$(LINK) $(nmclienttest_LDFLAGS) $(nmclienttest_OBJECTS) $(nmclienttest_LDADD) $(LIBS)
nmtest$(EXEEXT): $(nmtest_OBJECTS) $(nmtest_DEPENDENCIES)
@rm -f nmtest$(EXEEXT)
$(LINK) $(nmtest_LDFLAGS) $(nmtest_OBJECTS) $(nmtest_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT) core *.core