mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 08:58:03 +02:00
Initial check in on NetworkManager PPTP VPN plugin (used pppd)
git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1220 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
b5c3269266
commit
25e0af63e8
42 changed files with 9828 additions and 0 deletions
5
vpn-daemons/pptp/AUTHORS
Normal file
5
vpn-daemons/pptp/AUTHORS
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Antony Mee <A.J.Mee@ncl.ac.uk>
|
||||
Tim Niemueller <tim@niemueller.de>
|
||||
Dan Williams <dcbw@redhat.com>
|
||||
David Zeuthen <davidz@redhat.com>
|
||||
|
||||
4
vpn-daemons/pptp/ChangeLog
Normal file
4
vpn-daemons/pptp/ChangeLog
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
2005-11-17 Antony Mee <A.J.Mee@ncl.ac.uk>
|
||||
|
||||
* started work based on openvpn work
|
||||
|
||||
28
vpn-daemons/pptp/Makefile.am
Normal file
28
vpn-daemons/pptp/Makefile.am
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
SUBDIRS = src auth-dialog properties po
|
||||
|
||||
dbusservicedir = $(sysconfdir)/dbus-1/system.d
|
||||
dbusservice_DATA = nm-pptp-service.conf
|
||||
|
||||
nmvpnservicedir = $(sysconfdir)/NetworkManager/VPN
|
||||
nmvpnservice_DATA = nm-pptp-service.name
|
||||
|
||||
desktopdir = $(datadir)/applications
|
||||
desktop_in_files = nm-pptp.desktop.in
|
||||
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
|
||||
@INTLTOOL_DESKTOP_RULE@
|
||||
|
||||
icondir = $(datadir)/icons/hicolor/48x48/apps
|
||||
icon_DATA = gnome-mime-application-x-pptp-settings.png
|
||||
|
||||
EXTRA_DIST = $(nmvpnservice_DATA) \
|
||||
$(dbusservice_DATA) \
|
||||
$(desktop_in_files) \
|
||||
$(icon_DATA) \
|
||||
intltool-extract.in \
|
||||
intltool-merge.in \
|
||||
intltool-update.in
|
||||
|
||||
CLEANFILES = $(desktop_DATA) *~
|
||||
DISTCLEANFILES = intltool-extract intltool-merge intltool-update
|
||||
0
vpn-daemons/pptp/NEWS
Normal file
0
vpn-daemons/pptp/NEWS
Normal file
15
vpn-daemons/pptp/README
Normal file
15
vpn-daemons/pptp/README
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
PPTP support for NetworkManager
|
||||
|
||||
Added by Antony Mee http://www.students.ncl.ac.uk/a.j.mee
|
||||
Based entirely on OpenVPN support by Tim Niemueller http://www.niemueller.de
|
||||
|
||||
This requires the Linux PPTP client installed
|
||||
http://pptpclient.sourceforge.net/
|
||||
|
||||
TODO: Support for passwords stored outside of /etc/ppp/chap-secrets
|
||||
|
||||
Code released under the GPL. See COPYING file in the NetworkManager
|
||||
directory.
|
||||
|
||||
Aachen, 2005/11/12
|
||||
|
||||
105
vpn-daemons/pptp/TODO
Normal file
105
vpn-daemons/pptp/TODO
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
|
||||
|
||||
|
||||
Hi Nikolaus,
|
||||
|
||||
Yes, I've did quite a bit of work on it. Infact I totally revamped it to use a pppd plugin as it's helper. (Thus is can do the DNS + routing without modifications to your local /etc/ppp files)
|
||||
|
||||
Actually there is one exception... Many distros have an ip-up script which implements usepeerdns functionality thus replacing resolve.conf... This conflicts with NetworkManager's actions so may need to be removed. Sadly there appears to be no way to tell pppd NOT to execute /etc/ppp/ip-up if it exists!
|
||||
|
||||
Uses a pppd plugin to handle CHAP authentication (not sure of the V2 implications...) and ip-up functionality... It explicitly resolves the IP of the vpn server before starting pppd. And starts pppd with the pty option rather than letting pptp start pppd (as recomented by the pptp maintainer).
|
||||
|
||||
Sadly, I haven't quite figured out how I'm gonna get the username and password from the vpn-daemon to the pppd helper plugin infact I've just got my credentials hard coded in the plugin for testing!
|
||||
The reason I haven't fixed that is that there is another strange behaviour where by the pptp vpn daemon (sometimes!) takes NM down when it exits!! It seems to seg fault but I can't find the cause. I've been really busy but would love somone to take a look at this. I can upload it in it's present state with instructions for where to insert your credentials if you/anyone else would be willing to try it and perhaps assist me.
|
||||
|
||||
tOnY
|
||||
|
||||
|
||||
Nikolaus Filus wrote:
|
||||
|
||||
> Hi,
|
||||
>
|
||||
> I just managed to get your pptp plugin "working" for my university setup. It was a hard piece of work, since I'm not familiar with NM or pptp details. There are several issues to be fixed and I hope this report will be usefull for you. I don't attach patches as my modifications are just hacks :)
|
||||
>
|
||||
> 1. nm-pptp-service-pptp-helper
|
||||
> The while-loop doesn't work, as I wasn't able to find a place, where
|
||||
> foreign_option_%i shall be defined. It seems to me as if this code is incomplete and you wanted to scan through the whole environment and
|
||||
> analyse the options. I had to manually add parsing of DNS, DNS1 and DNS2 which are set in my environment, or my resolv.conf is empty after connecting to the vpn.
|
||||
>
|
||||
> 2. nm-pptp-service
|
||||
> encrypt-mppe was never attached to my pppd options and I had to add
|
||||
>
|
||||
> g_ptr_array_add (pptp_argv, (gpointer) "require-mschap-v2");
|
||||
> g_ptr_array_add (pptp_argv, (gpointer) "mppe");
|
||||
> g_ptr_array_add (pptp_argv, (gpointer) "required,stateless");
|
||||
>
|
||||
> outside the for-loop. As you can see, I also need the "require-mschap-v2" option. For this to work I need to specify a special remotename, which is NOT the hostname, as used in your code. This also requires a second line
|
||||
> in chap-secrets.
|
||||
>
|
||||
> 3. configuration
|
||||
> By default a new default route to ppp0 is specified, deleting the old one. I need to preserve it (by setting vpn-routes to 0.0.0.0/0) and add
|
||||
>
|
||||
> route add -host vpn-gw dev eth1
|
||||
> route add default dev ppp0
|
||||
>
|
||||
> manually.
|
||||
>
|
||||
>
|
||||
> With this modifications, I was able to connect the vpn at my university "using" networkmanager.
|
||||
>
|
||||
>
|
||||
> Are you working on the pppd plugin as announced on the mailinglist? I would be glad to test it :)
|
||||
>
|
||||
>
|
||||
> Thanks for your work
|
||||
>
|
||||
> Nikolaus Filus
|
||||
>
|
||||
>
|
||||
>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Dan Williams wrote:
|
||||
|
||||
> But in your case, the pppd-vpn-service daemon could just do whatever it
|
||||
> does to start the connection, but provide a dbus service that when
|
||||
> called, returns the password and username. The pppd plugin would then
|
||||
> call this dbus service and request the pass & user.
|
||||
>
|
||||
>
|
||||
>
|
||||
That is precisely what I intend and started implementing it. I just wanted to fix the strange and 'intermittent' segfault before
|
||||
adding anymore complexity.
|
||||
|
||||
I only hesitated when naming the dbus service.
|
||||
|
||||
> There are some things to think hard about here though, namely the
|
||||
> security of it. If you have a daemon providing a dbus service, unless
|
||||
> you lock it down anyone can call its methods. So you'd have to make
|
||||
> sure that you lock down the dbus policy for the service-daemon pretty
|
||||
> tight. If you restrict it to just 'root'/uid 0, any root app could ask
|
||||
> for the user and password. But then again, any 'root' app can do
|
||||
> horrible things to your system anyway. So this might be an acceptable
|
||||
> course of action.
|
||||
>
|
||||
>
|
||||
I imagined that root access would be sufficient in this case too. I suppose
|
||||
the only other way is for the vpn-daemon to pass some secret cookie to the
|
||||
pppd on start up that the plugin then uses when asking for the user/pass later
|
||||
but that too would open all kinds of security holes I suppose.
|
||||
|
||||
Anyway... A root process could overwrite the pppd plugin in /usr/lib with
|
||||
something malicious so I can't see any possible gain. Just as a root process could
|
||||
overwrite the vpnc binary with a script which 'tee' s the standard input to a file :-)
|
||||
|
||||
> Ideally this could be solved upstream in pppd. But at some point you
|
||||
> simply do best-effort to hide the username & password from view, keep
|
||||
> investigating how to do it better, and fix it a bit later.
|
||||
>
|
||||
>
|
||||
Exactly. "Just works" not "Will at some future time just work" right :-)
|
||||
|
||||
tOnY
|
||||
45
vpn-daemons/pptp/acinclude.m4
Normal file
45
vpn-daemons/pptp/acinclude.m4
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
|
||||
dnl as-ac-expand.m4 0.1.0
|
||||
dnl autostars m4 macro for expanding directories using configure's prefix
|
||||
dnl thomas@apestaart.org
|
||||
|
||||
dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR)
|
||||
dnl
|
||||
dnl example
|
||||
dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
|
||||
dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local
|
||||
|
||||
AC_DEFUN(AS_AC_EXPAND,
|
||||
[
|
||||
EXP_VAR=[$1]
|
||||
FROM_VAR=[$2]
|
||||
|
||||
dnl first expand prefix and exec_prefix if necessary
|
||||
prefix_save=$prefix
|
||||
exec_prefix_save=$exec_prefix
|
||||
|
||||
dnl if no prefix given, then use /usr/local, the default prefix
|
||||
if test "x$prefix" = "xNONE"; then
|
||||
prefix=$ac_default_prefix
|
||||
fi
|
||||
dnl if no exec_prefix given, then use prefix
|
||||
if test "x$exec_prefix" = "xNONE"; then
|
||||
exec_prefix=$prefix
|
||||
fi
|
||||
|
||||
full_var="$FROM_VAR"
|
||||
dnl loop until it doesn't change anymore
|
||||
while true; do
|
||||
new_full_var="`eval echo $full_var`"
|
||||
if test "x$new_full_var"="x$full_var"; then break; fi
|
||||
full_var=$new_full_var
|
||||
done
|
||||
|
||||
dnl clean up
|
||||
full_var=$new_full_var
|
||||
AC_SUBST([$1], "$full_var")
|
||||
|
||||
dnl restore prefix and exec_prefix
|
||||
prefix=$prefix_save
|
||||
exec_prefix=$exec_prefix_save
|
||||
])
|
||||
3
vpn-daemons/pptp/auth-dialog/.cvsignore
Normal file
3
vpn-daemons/pptp/auth-dialog/.cvsignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Makefile.in
|
||||
Makefile
|
||||
nm-pptp-auth-dialog
|
||||
33
vpn-daemons/pptp/auth-dialog/Makefile.am
Normal file
33
vpn-daemons/pptp/auth-dialog/Makefile.am
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils
|
||||
|
||||
libexec_PROGRAMS = nm-pptp-auth-dialog
|
||||
|
||||
nm_pptp_auth_dialog_CPPFLAGS = \
|
||||
$(GTHREAD_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
$(LIBGNOMEUI_CFLAGS) \
|
||||
$(GNOMEKEYRING_CFLAGS) \
|
||||
-DICONDIR=\""$(datadir)/pixmaps"\" \
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DBINDIR=\""$(bindir)"\" \
|
||||
-DDBUS_API_SUBJECT_TO_CHANGE \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGNOME_DISABLE_DEPRECATED \
|
||||
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
|
||||
-DVERSION=\"$(VERSION)\" \
|
||||
$(NULL)
|
||||
|
||||
nm_pptp_auth_dialog_SOURCES = \
|
||||
main.c \
|
||||
gnome-two-password-dialog.c \
|
||||
gnome-two-password-dialog.h \
|
||||
$(NULL)
|
||||
|
||||
nm_pptp_auth_dialog_LDADD = \
|
||||
$(GTK_LIBS) \
|
||||
$(LIBGNOMEUI_LIBS) \
|
||||
$(GNOMEKEYRING_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
CLEANFILES = *~
|
||||
745
vpn-daemons/pptp/auth-dialog/gnome-two-password-dialog.c
Normal file
745
vpn-daemons/pptp/auth-dialog/gnome-two-password-dialog.c
Normal file
|
|
@ -0,0 +1,745 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/* gnome-password-dialog.c - A use password prompting dialog widget.
|
||||
|
||||
Copyright (C) 1999, 2000 Eazel, Inc.
|
||||
|
||||
The Gnome Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the ree Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
Authors: Ramiro Estrugo <ramiro@eazel.com>
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
//#include "gnome-i18nP.h"
|
||||
#include "gnome-two-password-dialog.h"
|
||||
#include <gtk/gtkbox.h>
|
||||
#include <gtk/gtkcheckbutton.h>
|
||||
#include <gtk/gtkentry.h>
|
||||
#include <gtk/gtkhbox.h>
|
||||
#include <gtk/gtkimage.h>
|
||||
#include <gtk/gtklabel.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
#include <gtk/gtkstock.h>
|
||||
#include <gtk/gtktable.h>
|
||||
#include <gtk/gtkvbox.h>
|
||||
#include <gtk/gtkradiobutton.h>
|
||||
#include <gtk/gtkstock.h>
|
||||
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
struct GnomeTwoPasswordDialogDetails
|
||||
{
|
||||
/* Attributes */
|
||||
gboolean readonly_username;
|
||||
gboolean readonly_domain;
|
||||
|
||||
gboolean show_username;
|
||||
gboolean show_domain;
|
||||
gboolean show_password;
|
||||
gboolean show_password_secondary;
|
||||
|
||||
/* TODO: */
|
||||
gboolean remember;
|
||||
char *remember_label_text;
|
||||
|
||||
/* Internal widgetry and flags */
|
||||
GtkWidget *username_entry;
|
||||
GtkWidget *password_entry;
|
||||
GtkWidget *password_entry_secondary;
|
||||
GtkWidget *domain_entry;
|
||||
|
||||
GtkWidget *table;
|
||||
|
||||
GtkWidget *remember_session_button;
|
||||
GtkWidget *remember_forever_button;
|
||||
|
||||
GtkWidget *radio_vbox;
|
||||
GtkWidget *connect_with_no_userpass_button;
|
||||
GtkWidget *connect_with_userpass_button;
|
||||
|
||||
gboolean anon_support_on;
|
||||
|
||||
char *secondary_password_label;
|
||||
};
|
||||
|
||||
/* Caption table rows indices */
|
||||
static const guint CAPTION_TABLE_USERNAME_ROW = 0;
|
||||
static const guint CAPTION_TABLE_PASSWORD_ROW = 1;
|
||||
|
||||
/* Layout constants */
|
||||
static const guint DIALOG_BORDER_WIDTH = 6;
|
||||
static const guint CAPTION_TABLE_BORDER_WIDTH = 4;
|
||||
|
||||
/* GnomeTwoPasswordDialogClass methods */
|
||||
static void gnome_two_password_dialog_class_init (GnomeTwoPasswordDialogClass *password_dialog_class);
|
||||
static void gnome_two_password_dialog_init (GnomeTwoPasswordDialog *password_dialog);
|
||||
|
||||
/* GObjectClass methods */
|
||||
static void gnome_two_password_dialog_finalize (GObject *object);
|
||||
|
||||
|
||||
/* GtkDialog callbacks */
|
||||
static void dialog_show_callback (GtkWidget *widget,
|
||||
gpointer callback_data);
|
||||
static void dialog_close_callback (GtkWidget *widget,
|
||||
gpointer callback_data);
|
||||
|
||||
static gpointer parent_class;
|
||||
|
||||
GtkType
|
||||
gnome_two_password_dialog_get_type (void)
|
||||
{
|
||||
static GType type = 0;
|
||||
|
||||
if (!type) {
|
||||
static const GTypeInfo info = {
|
||||
sizeof (GnomeTwoPasswordDialogClass),
|
||||
NULL, NULL,
|
||||
(GClassInitFunc) gnome_two_password_dialog_class_init,
|
||||
NULL, NULL,
|
||||
sizeof (GnomeTwoPasswordDialog), 0,
|
||||
(GInstanceInitFunc) gnome_two_password_dialog_init,
|
||||
NULL
|
||||
};
|
||||
|
||||
type = g_type_register_static (gtk_dialog_get_type(),
|
||||
"GnomeTwoPasswordDialog",
|
||||
&info, 0);
|
||||
|
||||
parent_class = g_type_class_ref (gtk_dialog_get_type());
|
||||
}
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gnome_two_password_dialog_class_init (GnomeTwoPasswordDialogClass * klass)
|
||||
{
|
||||
G_OBJECT_CLASS (klass)->finalize = gnome_two_password_dialog_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gnome_two_password_dialog_init (GnomeTwoPasswordDialog *password_dialog)
|
||||
{
|
||||
password_dialog->details = g_new0 (GnomeTwoPasswordDialogDetails, 1);
|
||||
password_dialog->details->show_username = TRUE;
|
||||
password_dialog->details->show_password = TRUE;
|
||||
password_dialog->details->show_password_secondary = TRUE;
|
||||
password_dialog->details->anon_support_on = FALSE;
|
||||
|
||||
password_dialog->details->secondary_password_label = g_strdup ( _("_Secondary Password:") );
|
||||
}
|
||||
|
||||
/* GObjectClass methods */
|
||||
static void
|
||||
gnome_two_password_dialog_finalize (GObject *object)
|
||||
{
|
||||
GnomeTwoPasswordDialog *password_dialog;
|
||||
|
||||
password_dialog = GNOME_TWO_PASSWORD_DIALOG (object);
|
||||
|
||||
g_object_unref (password_dialog->details->username_entry);
|
||||
g_object_unref (password_dialog->details->domain_entry);
|
||||
g_object_unref (password_dialog->details->password_entry);
|
||||
g_object_unref (password_dialog->details->password_entry_secondary);
|
||||
|
||||
g_free (password_dialog->details->remember_label_text);
|
||||
g_free (password_dialog->details);
|
||||
|
||||
g_free (password_dialog->details->secondary_password_label);
|
||||
|
||||
if (G_OBJECT_CLASS (parent_class)->finalize != NULL)
|
||||
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||
}
|
||||
|
||||
/* GtkDialog callbacks */
|
||||
static void
|
||||
dialog_show_callback (GtkWidget *widget, gpointer callback_data)
|
||||
{
|
||||
GnomeTwoPasswordDialog *password_dialog;
|
||||
|
||||
password_dialog = GNOME_TWO_PASSWORD_DIALOG (callback_data);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (password_dialog->details->username_entry) &&
|
||||
!password_dialog->details->readonly_username) {
|
||||
gtk_widget_grab_focus (password_dialog->details->username_entry);
|
||||
} else if (GTK_WIDGET_VISIBLE (password_dialog->details->domain_entry) &&
|
||||
!password_dialog->details->readonly_domain) {
|
||||
gtk_widget_grab_focus (password_dialog->details->domain_entry);
|
||||
} else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry)) {
|
||||
gtk_widget_grab_focus (password_dialog->details->password_entry);
|
||||
} else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry_secondary)) {
|
||||
gtk_widget_grab_focus (password_dialog->details->password_entry_secondary);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dialog_close_callback (GtkWidget *widget, gpointer callback_data)
|
||||
{
|
||||
gtk_widget_hide (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
userpass_radio_button_clicked (GtkWidget *widget, gpointer callback_data)
|
||||
{
|
||||
GnomeTwoPasswordDialog *password_dialog;
|
||||
|
||||
password_dialog = GNOME_TWO_PASSWORD_DIALOG (callback_data);
|
||||
|
||||
if (widget == password_dialog->details->connect_with_no_userpass_button) {
|
||||
gtk_widget_set_sensitive (
|
||||
password_dialog->details->table, FALSE);
|
||||
}
|
||||
else { /* the other button */
|
||||
gtk_widget_set_sensitive (
|
||||
password_dialog->details->table, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
add_row (GtkWidget *table, int row, const char *label_text, GtkWidget *entry, int offset)
|
||||
{
|
||||
GtkWidget *label;
|
||||
|
||||
label = gtk_label_new_with_mnemonic (label_text);
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), label,
|
||||
0, 1,
|
||||
row, row + 1,
|
||||
GTK_FILL,
|
||||
(GTK_FILL|GTK_EXPAND),
|
||||
offset, 0);
|
||||
|
||||
gtk_table_attach (GTK_TABLE (table), entry,
|
||||
1, 2,
|
||||
row, row + 1,
|
||||
(GTK_FILL|GTK_EXPAND),
|
||||
(GTK_FILL|GTK_EXPAND),
|
||||
0, 0);
|
||||
|
||||
gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_child (GtkWidget *child, GtkWidget *table)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (table), child);
|
||||
}
|
||||
|
||||
static void
|
||||
add_table_rows (GnomeTwoPasswordDialog *password_dialog)
|
||||
{
|
||||
int row;
|
||||
GtkWidget *table;
|
||||
int offset;
|
||||
|
||||
if (password_dialog->details->anon_support_on) {
|
||||
offset = 20;
|
||||
}
|
||||
else {
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
table = password_dialog->details->table;
|
||||
/* This will not kill the entries, since they are ref:ed */
|
||||
gtk_container_foreach (GTK_CONTAINER (table),
|
||||
(GtkCallback)remove_child, table);
|
||||
|
||||
row = 0;
|
||||
if (password_dialog->details->show_username)
|
||||
add_row (table, row++, _("_Username:"), password_dialog->details->username_entry, offset);
|
||||
if (password_dialog->details->show_domain)
|
||||
add_row (table, row++, _("_Domain:"), password_dialog->details->domain_entry, offset);
|
||||
if (password_dialog->details->show_password)
|
||||
add_row (table, row++, _("_Password:"), password_dialog->details->password_entry, offset);
|
||||
if (password_dialog->details->show_password_secondary)
|
||||
add_row (table, row++, password_dialog->details->secondary_password_label,
|
||||
password_dialog->details->password_entry_secondary, offset);
|
||||
|
||||
gtk_widget_show_all (table);
|
||||
}
|
||||
|
||||
static void
|
||||
username_entry_activate (GtkWidget *widget, GtkWidget *dialog)
|
||||
{
|
||||
GnomeTwoPasswordDialog *password_dialog;
|
||||
|
||||
password_dialog = GNOME_TWO_PASSWORD_DIALOG (dialog);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (password_dialog->details->domain_entry) &&
|
||||
GTK_WIDGET_SENSITIVE (password_dialog->details->domain_entry))
|
||||
gtk_widget_grab_focus (password_dialog->details->domain_entry);
|
||||
else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry) &&
|
||||
GTK_WIDGET_SENSITIVE (password_dialog->details->password_entry))
|
||||
gtk_widget_grab_focus (password_dialog->details->password_entry);
|
||||
else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry_secondary) &&
|
||||
GTK_WIDGET_SENSITIVE (password_dialog->details->password_entry_secondary))
|
||||
gtk_widget_grab_focus (password_dialog->details->password_entry_secondary);
|
||||
}
|
||||
|
||||
static void
|
||||
domain_entry_activate (GtkWidget *widget, GtkWidget *dialog)
|
||||
{
|
||||
GnomeTwoPasswordDialog *password_dialog;
|
||||
|
||||
password_dialog = GNOME_TWO_PASSWORD_DIALOG (dialog);
|
||||
|
||||
if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry) &&
|
||||
GTK_WIDGET_SENSITIVE (password_dialog->details->password_entry))
|
||||
gtk_widget_grab_focus (password_dialog->details->password_entry);
|
||||
else if (GTK_WIDGET_VISIBLE (password_dialog->details->password_entry_secondary) &&
|
||||
GTK_WIDGET_SENSITIVE (password_dialog->details->password_entry_secondary))
|
||||
gtk_widget_grab_focus (password_dialog->details->password_entry_secondary);
|
||||
}
|
||||
|
||||
|
||||
/* Public GnomeTwoPasswordDialog methods */
|
||||
GtkWidget *
|
||||
gnome_two_password_dialog_new (const char *dialog_title,
|
||||
const char *message,
|
||||
const char *username,
|
||||
const char *password,
|
||||
gboolean readonly_username)
|
||||
{
|
||||
GnomeTwoPasswordDialog *password_dialog;
|
||||
GtkWidget *table;
|
||||
GtkLabel *message_label;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *dialog_icon;
|
||||
GSList *group;
|
||||
|
||||
password_dialog = GNOME_TWO_PASSWORD_DIALOG (gtk_widget_new (gnome_two_password_dialog_get_type (), NULL));
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (password_dialog), dialog_title);
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (password_dialog),
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
|
||||
/* Setup the dialog */
|
||||
gtk_dialog_set_has_separator (GTK_DIALOG (password_dialog), FALSE);
|
||||
|
||||
gtk_window_set_position (GTK_WINDOW (password_dialog), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_modal (GTK_WINDOW (password_dialog), TRUE);
|
||||
|
||||
gtk_container_set_border_width (GTK_CONTAINER (password_dialog), DIALOG_BORDER_WIDTH);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (password_dialog), GTK_RESPONSE_OK);
|
||||
|
||||
g_signal_connect (password_dialog, "show",
|
||||
G_CALLBACK (dialog_show_callback), password_dialog);
|
||||
g_signal_connect (password_dialog, "close",
|
||||
G_CALLBACK (dialog_close_callback), password_dialog);
|
||||
|
||||
/* the radio buttons for anonymous login */
|
||||
password_dialog->details->connect_with_no_userpass_button =
|
||||
gtk_radio_button_new_with_mnemonic (NULL, _("Connect _anonymously"));
|
||||
group = gtk_radio_button_get_group (
|
||||
GTK_RADIO_BUTTON (password_dialog->details->connect_with_no_userpass_button));
|
||||
password_dialog->details->connect_with_userpass_button =
|
||||
gtk_radio_button_new_with_mnemonic (
|
||||
group, _("Connect as _user:"));
|
||||
|
||||
if (username != NULL && *username != 0) {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (password_dialog->details->connect_with_userpass_button), TRUE);
|
||||
} else {
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (password_dialog->details->connect_with_no_userpass_button), TRUE);
|
||||
}
|
||||
|
||||
|
||||
password_dialog->details->radio_vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (password_dialog->details->radio_vbox),
|
||||
password_dialog->details->connect_with_no_userpass_button,
|
||||
FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (password_dialog->details->radio_vbox),
|
||||
password_dialog->details->connect_with_userpass_button,
|
||||
FALSE, FALSE, 0);
|
||||
g_signal_connect (password_dialog->details->connect_with_no_userpass_button, "clicked",
|
||||
G_CALLBACK (userpass_radio_button_clicked), password_dialog);
|
||||
g_signal_connect (password_dialog->details->connect_with_userpass_button, "clicked",
|
||||
G_CALLBACK (userpass_radio_button_clicked), password_dialog);
|
||||
|
||||
/* The table that holds the captions */
|
||||
password_dialog->details->table = table = gtk_table_new (3, 2, FALSE);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
|
||||
|
||||
password_dialog->details->username_entry = gtk_entry_new ();
|
||||
password_dialog->details->domain_entry = gtk_entry_new ();
|
||||
password_dialog->details->password_entry = gtk_entry_new ();
|
||||
password_dialog->details->password_entry_secondary = gtk_entry_new ();
|
||||
|
||||
/* We want to hold on to these during the table rearrangement */
|
||||
g_object_ref (password_dialog->details->username_entry);
|
||||
gtk_object_sink (GTK_OBJECT (password_dialog->details->username_entry));
|
||||
g_object_ref (password_dialog->details->domain_entry);
|
||||
gtk_object_sink (GTK_OBJECT (password_dialog->details->domain_entry));
|
||||
g_object_ref (password_dialog->details->password_entry);
|
||||
gtk_object_sink (GTK_OBJECT (password_dialog->details->password_entry));
|
||||
g_object_ref (password_dialog->details->password_entry_secondary);
|
||||
gtk_object_sink (GTK_OBJECT (password_dialog->details->password_entry_secondary));
|
||||
|
||||
gtk_entry_set_visibility (GTK_ENTRY (password_dialog->details->password_entry), FALSE);
|
||||
gtk_entry_set_visibility (GTK_ENTRY (password_dialog->details->password_entry_secondary), FALSE);
|
||||
|
||||
g_signal_connect (password_dialog->details->username_entry,
|
||||
"activate",
|
||||
G_CALLBACK (username_entry_activate),
|
||||
password_dialog);
|
||||
g_signal_connect (password_dialog->details->domain_entry,
|
||||
"activate",
|
||||
G_CALLBACK (domain_entry_activate),
|
||||
password_dialog);
|
||||
g_signal_connect_swapped (password_dialog->details->password_entry,
|
||||
"activate",
|
||||
G_CALLBACK (gtk_window_activate_default),
|
||||
password_dialog);
|
||||
g_signal_connect_swapped (password_dialog->details->password_entry_secondary,
|
||||
"activate",
|
||||
G_CALLBACK (gtk_window_activate_default),
|
||||
password_dialog);
|
||||
add_table_rows (password_dialog);
|
||||
|
||||
/* Adds some eye-candy to the dialog */
|
||||
hbox = gtk_hbox_new (FALSE, 12);
|
||||
dialog_icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG);
|
||||
gtk_misc_set_alignment (GTK_MISC (dialog_icon), 0.5, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), dialog_icon, FALSE, FALSE, 0);
|
||||
|
||||
gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (password_dialog)->vbox), 12);
|
||||
gtk_container_set_border_width (GTK_CONTAINER(hbox), 6);
|
||||
gtk_box_set_spacing (GTK_BOX (hbox), 12);
|
||||
|
||||
/* Fills the vbox */
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
|
||||
if (message) {
|
||||
message_label = GTK_LABEL (gtk_label_new (message));
|
||||
gtk_label_set_justify (message_label, GTK_JUSTIFY_LEFT);
|
||||
gtk_label_set_line_wrap (message_label, TRUE);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox),
|
||||
GTK_WIDGET (message_label),
|
||||
TRUE, /* expand */
|
||||
TRUE, /* fill */
|
||||
5); /* padding */
|
||||
}
|
||||
gtk_box_pack_start (GTK_BOX (vbox), password_dialog->details->radio_vbox,
|
||||
TRUE, TRUE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), table,
|
||||
TRUE, TRUE, 5);
|
||||
|
||||
/* Configure the table */
|
||||
gtk_container_set_border_width (GTK_CONTAINER (table),
|
||||
CAPTION_TABLE_BORDER_WIDTH);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 5);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (password_dialog)->vbox),
|
||||
hbox,
|
||||
TRUE, /* expand */
|
||||
TRUE, /* fill */
|
||||
0); /* padding */
|
||||
|
||||
gtk_widget_show_all (GTK_DIALOG (password_dialog)->vbox);
|
||||
|
||||
password_dialog->details->remember_session_button =
|
||||
gtk_check_button_new_with_mnemonic (_("_Remember password for this session"));
|
||||
password_dialog->details->remember_forever_button =
|
||||
gtk_check_button_new_with_mnemonic (_("_Save password in keyring"));
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), password_dialog->details->remember_session_button,
|
||||
TRUE, TRUE, 6);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), password_dialog->details->remember_forever_button,
|
||||
TRUE, TRUE, 0);
|
||||
|
||||
|
||||
gnome_two_password_dialog_set_username (password_dialog, username);
|
||||
gnome_two_password_dialog_set_password (password_dialog, password);
|
||||
gnome_two_password_dialog_set_readonly_domain (password_dialog, readonly_username);
|
||||
|
||||
return GTK_WIDGET (password_dialog);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnome_two_password_dialog_run_and_block (GnomeTwoPasswordDialog *password_dialog)
|
||||
{
|
||||
gint button_clicked;
|
||||
|
||||
g_return_val_if_fail (password_dialog != NULL, FALSE);
|
||||
g_return_val_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog), FALSE);
|
||||
|
||||
button_clicked = gtk_dialog_run (GTK_DIALOG (password_dialog));
|
||||
gtk_widget_hide (GTK_WIDGET (password_dialog));
|
||||
|
||||
return button_clicked == GTK_RESPONSE_OK;
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_username (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *username)
|
||||
{
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
g_return_if_fail (password_dialog->details->username_entry != NULL);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (password_dialog->details->username_entry),
|
||||
username?username:"");
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_password (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *password)
|
||||
{
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (password_dialog->details->password_entry),
|
||||
password ? password : "");
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_password_secondary (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *password_secondary)
|
||||
{
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (password_dialog->details->password_entry_secondary),
|
||||
password_secondary ? password_secondary : "");
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_domain (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *domain)
|
||||
{
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
g_return_if_fail (password_dialog->details->domain_entry != NULL);
|
||||
|
||||
gtk_entry_set_text (GTK_ENTRY (password_dialog->details->domain_entry),
|
||||
domain ? domain : "");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_show_username (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show)
|
||||
{
|
||||
g_return_if_fail (password_dialog != NULL);
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
|
||||
show = !!show;
|
||||
if (password_dialog->details->show_username != show) {
|
||||
password_dialog->details->show_username = show;
|
||||
add_table_rows (password_dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_show_domain (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show)
|
||||
{
|
||||
g_return_if_fail (password_dialog != NULL);
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
|
||||
show = !!show;
|
||||
if (password_dialog->details->show_domain != show) {
|
||||
password_dialog->details->show_domain = show;
|
||||
add_table_rows (password_dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_show_password (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show)
|
||||
{
|
||||
g_return_if_fail (password_dialog != NULL);
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
|
||||
show = !!show;
|
||||
if (password_dialog->details->show_password != show) {
|
||||
password_dialog->details->show_password = show;
|
||||
add_table_rows (password_dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_show_password_secondary (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show)
|
||||
{
|
||||
g_return_if_fail (password_dialog != NULL);
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
|
||||
show = !!show;
|
||||
if (password_dialog->details->show_password_secondary != show) {
|
||||
password_dialog->details->show_password_secondary = show;
|
||||
add_table_rows (password_dialog);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_readonly_username (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean readonly)
|
||||
{
|
||||
g_return_if_fail (password_dialog != NULL);
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
|
||||
password_dialog->details->readonly_username = readonly;
|
||||
|
||||
gtk_widget_set_sensitive (password_dialog->details->username_entry,
|
||||
!readonly);
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_readonly_domain (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean readonly)
|
||||
{
|
||||
g_return_if_fail (password_dialog != NULL);
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
|
||||
password_dialog->details->readonly_domain = readonly;
|
||||
|
||||
gtk_widget_set_sensitive (password_dialog->details->domain_entry,
|
||||
!readonly);
|
||||
}
|
||||
|
||||
char *
|
||||
gnome_two_password_dialog_get_username (GnomeTwoPasswordDialog *password_dialog)
|
||||
{
|
||||
g_return_val_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog), NULL);
|
||||
|
||||
return g_strdup (gtk_entry_get_text (GTK_ENTRY (password_dialog->details->username_entry)));
|
||||
}
|
||||
|
||||
char *
|
||||
gnome_two_password_dialog_get_domain (GnomeTwoPasswordDialog *password_dialog)
|
||||
{
|
||||
g_return_val_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog), NULL);
|
||||
|
||||
return g_strdup (gtk_entry_get_text (GTK_ENTRY (password_dialog->details->domain_entry)));
|
||||
}
|
||||
|
||||
char *
|
||||
gnome_two_password_dialog_get_password (GnomeTwoPasswordDialog *password_dialog)
|
||||
{
|
||||
g_return_val_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog), NULL);
|
||||
|
||||
return g_strdup (gtk_entry_get_text (GTK_ENTRY (password_dialog->details->password_entry)));
|
||||
}
|
||||
|
||||
char *
|
||||
gnome_two_password_dialog_get_password_secondary (GnomeTwoPasswordDialog *password_dialog)
|
||||
{
|
||||
g_return_val_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog), NULL);
|
||||
|
||||
return g_strdup (gtk_entry_get_text (GTK_ENTRY (password_dialog->details->password_entry_secondary)));
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_show_userpass_buttons (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show_userpass_buttons)
|
||||
{
|
||||
if (show_userpass_buttons) {
|
||||
password_dialog->details->anon_support_on = TRUE;
|
||||
gtk_widget_show (password_dialog->details->radio_vbox);
|
||||
if (gtk_toggle_button_get_active (
|
||||
GTK_TOGGLE_BUTTON (password_dialog->details->connect_with_no_userpass_button))) {
|
||||
gtk_widget_set_sensitive (password_dialog->details->table, FALSE);
|
||||
}
|
||||
else {
|
||||
gtk_widget_set_sensitive (password_dialog->details->table, TRUE);
|
||||
}
|
||||
} else {
|
||||
password_dialog->details->anon_support_on = FALSE;
|
||||
gtk_widget_hide (password_dialog->details->radio_vbox);
|
||||
gtk_widget_set_sensitive (password_dialog->details->table, TRUE);
|
||||
}
|
||||
|
||||
add_table_rows (password_dialog);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gnome_two_password_dialog_anon_selected (GnomeTwoPasswordDialog *password_dialog)
|
||||
{
|
||||
return password_dialog->details->anon_support_on &&
|
||||
gtk_toggle_button_get_active (
|
||||
GTK_TOGGLE_BUTTON (
|
||||
password_dialog->details->connect_with_no_userpass_button));
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_show_remember (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show_remember)
|
||||
{
|
||||
if (show_remember) {
|
||||
gtk_widget_show (password_dialog->details->remember_session_button);
|
||||
gtk_widget_show (password_dialog->details->remember_forever_button);
|
||||
} else {
|
||||
gtk_widget_hide (password_dialog->details->remember_session_button);
|
||||
gtk_widget_hide (password_dialog->details->remember_forever_button);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gnome_two_password_dialog_set_remember (GnomeTwoPasswordDialog *password_dialog,
|
||||
GnomeTwoPasswordDialogRemember remember)
|
||||
{
|
||||
gboolean session, forever;
|
||||
|
||||
session = FALSE;
|
||||
forever = FALSE;
|
||||
if (remember == GNOME_TWO_PASSWORD_DIALOG_REMEMBER_SESSION) {
|
||||
session = TRUE;
|
||||
} else if (remember == GNOME_TWO_PASSWORD_DIALOG_REMEMBER_FOREVER){
|
||||
forever = TRUE;
|
||||
}
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (password_dialog->details->remember_session_button),
|
||||
session);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (password_dialog->details->remember_forever_button),
|
||||
forever);
|
||||
}
|
||||
|
||||
GnomeTwoPasswordDialogRemember
|
||||
gnome_two_password_dialog_get_remember (GnomeTwoPasswordDialog *password_dialog)
|
||||
{
|
||||
gboolean session, forever;
|
||||
|
||||
session = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (password_dialog->details->remember_session_button));
|
||||
forever = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (password_dialog->details->remember_forever_button));
|
||||
if (forever) {
|
||||
return GNOME_TWO_PASSWORD_DIALOG_REMEMBER_FOREVER;
|
||||
} else if (session) {
|
||||
return GNOME_TWO_PASSWORD_DIALOG_REMEMBER_SESSION;
|
||||
}
|
||||
return GNOME_TWO_PASSWORD_DIALOG_REMEMBER_NOTHING;
|
||||
}
|
||||
|
||||
void gnome_two_password_dialog_set_password_secondary_label (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *password_secondary_label)
|
||||
{
|
||||
g_return_if_fail (password_dialog != NULL);
|
||||
g_return_if_fail (GNOME_IS_TWO_PASSWORD_DIALOG (password_dialog));
|
||||
|
||||
g_free (password_dialog->details->secondary_password_label);
|
||||
password_dialog->details->secondary_password_label = g_strdup (password_secondary_label);
|
||||
|
||||
if (password_dialog->details->show_password_secondary) {
|
||||
add_table_rows (password_dialog);
|
||||
}
|
||||
}
|
||||
116
vpn-daemons/pptp/auth-dialog/gnome-two-password-dialog.h
Normal file
116
vpn-daemons/pptp/auth-dialog/gnome-two-password-dialog.h
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/* gnome-two-password-dialog.h - A use password prompting dialog widget
|
||||
asking for two passwords. Based of
|
||||
gnome-password-dialog.[ch] from libgnomeui
|
||||
|
||||
Copyright (C) 1999, 2000 Eazel, Inc.
|
||||
Copyright (C) 2005, Red Hat, Inc.
|
||||
|
||||
The Gnome Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The Gnome Library 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the Gnome Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
|
||||
Authors: Ramiro Estrugo <ramiro@eazel.com>
|
||||
*/
|
||||
|
||||
#ifndef GNOME_TWO_PASSWORD_DIALOG_H
|
||||
#define GNOME_TWO_PASSWORD_DIALOG_H
|
||||
|
||||
#include <gtk/gtkdialog.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GNOME_TYPE_TWO_PASSWORD_DIALOG (gnome_two_password_dialog_get_type ())
|
||||
#define GNOME_TWO_PASSWORD_DIALOG(obj) (GTK_CHECK_CAST ((obj), GNOME_TYPE_TWO_PASSWORD_DIALOG, GnomeTwoPasswordDialog))
|
||||
#define GNOME_TWO_PASSWORD_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_TWO_PASSWORD_DIALOG, GnomeTwoPasswordDialogClass))
|
||||
#define GNOME_IS_TWO_PASSWORD_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GNOME_TYPE_TWO_PASSWORD_DIALOG))
|
||||
#define GNOME_IS_TWO_PASSWORD_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNOME_TYPE_TWO_PASSWORD_DIALOG))
|
||||
|
||||
typedef struct GnomeTwoPasswordDialog GnomeTwoPasswordDialog;
|
||||
typedef struct GnomeTwoPasswordDialogClass GnomeTwoPasswordDialogClass;
|
||||
typedef struct GnomeTwoPasswordDialogDetails GnomeTwoPasswordDialogDetails;
|
||||
|
||||
struct GnomeTwoPasswordDialog
|
||||
{
|
||||
GtkDialog gtk_dialog;
|
||||
|
||||
GnomeTwoPasswordDialogDetails *details;
|
||||
};
|
||||
|
||||
struct GnomeTwoPasswordDialogClass
|
||||
{
|
||||
GtkDialogClass parent_class;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
GNOME_TWO_PASSWORD_DIALOG_REMEMBER_NOTHING,
|
||||
GNOME_TWO_PASSWORD_DIALOG_REMEMBER_SESSION,
|
||||
GNOME_TWO_PASSWORD_DIALOG_REMEMBER_FOREVER
|
||||
} GnomeTwoPasswordDialogRemember;
|
||||
|
||||
|
||||
GtkType gnome_two_password_dialog_get_type (void);
|
||||
GtkWidget* gnome_two_password_dialog_new (const char *dialog_title,
|
||||
const char *message,
|
||||
const char *username,
|
||||
const char *password,
|
||||
gboolean readonly_username);
|
||||
|
||||
gboolean gnome_two_password_dialog_run_and_block (GnomeTwoPasswordDialog *password_dialog);
|
||||
|
||||
/* Attribute mutators */
|
||||
void gnome_two_password_dialog_set_show_username (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show);
|
||||
void gnome_two_password_dialog_set_show_domain (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show);
|
||||
void gnome_two_password_dialog_set_show_password (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show);
|
||||
void gnome_two_password_dialog_set_show_password_secondary (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show);
|
||||
void gnome_two_password_dialog_set_username (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *username);
|
||||
void gnome_two_password_dialog_set_domain (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *domain);
|
||||
void gnome_two_password_dialog_set_password (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *password);
|
||||
void gnome_two_password_dialog_set_password_secondary (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *password_secondary);
|
||||
void gnome_two_password_dialog_set_readonly_username (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean readonly);
|
||||
void gnome_two_password_dialog_set_readonly_domain (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean readonly);
|
||||
|
||||
void gnome_two_password_dialog_set_password_secondary_label (GnomeTwoPasswordDialog *password_dialog,
|
||||
const char *password_secondary_description);
|
||||
|
||||
void gnome_two_password_dialog_set_show_remember (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show_remember);
|
||||
void gnome_two_password_dialog_set_remember (GnomeTwoPasswordDialog *password_dialog,
|
||||
GnomeTwoPasswordDialogRemember remember);
|
||||
GnomeTwoPasswordDialogRemember gnome_two_password_dialog_get_remember (GnomeTwoPasswordDialog *password_dialog);
|
||||
void gnome_two_password_dialog_set_show_userpass_buttons (GnomeTwoPasswordDialog *password_dialog,
|
||||
gboolean show_userpass_buttons);
|
||||
|
||||
/* Attribute accessors */
|
||||
char * gnome_two_password_dialog_get_username (GnomeTwoPasswordDialog *password_dialog);
|
||||
char * gnome_two_password_dialog_get_domain (GnomeTwoPasswordDialog *password_dialog);
|
||||
char * gnome_two_password_dialog_get_password (GnomeTwoPasswordDialog *password_dialog);
|
||||
char * gnome_two_password_dialog_get_password_secondary (GnomeTwoPasswordDialog *password_dialog);
|
||||
|
||||
gboolean gnome_two_password_dialog_anon_selected (GnomeTwoPasswordDialog *password_dialog);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GNOME_TWO_PASSWORD_DIALOG_H */
|
||||
290
vpn-daemons/pptp/auth-dialog/main.c
Normal file
290
vpn-daemons/pptp/auth-dialog/main.c
Normal file
|
|
@ -0,0 +1,290 @@
|
|||
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <libgnomeui/libgnomeui.h>
|
||||
#include <gnome-keyring.h>
|
||||
|
||||
#include "gnome-two-password-dialog.h"
|
||||
|
||||
#define VPN_SERVICE "org.freedesktop.NetworkManager.pptp"
|
||||
|
||||
static GSList *
|
||||
lookup_pass (const char *vpn_name, const char *vpn_service, gboolean *is_session)
|
||||
{
|
||||
GSList *passwords;
|
||||
GList *keyring_result;
|
||||
|
||||
passwords = NULL;
|
||||
|
||||
if (gnome_keyring_find_network_password_sync (g_get_user_name (), /* user */
|
||||
NULL, /* domain */
|
||||
vpn_name, /* server */
|
||||
NULL, /* object */
|
||||
vpn_service, /* protocol */
|
||||
NULL, /* authtype */
|
||||
0, /* port */
|
||||
&keyring_result) != GNOME_KEYRING_RESULT_OK)
|
||||
return FALSE;
|
||||
|
||||
if (keyring_result != NULL && g_list_length (keyring_result) == 2) {
|
||||
char *username;
|
||||
char *password;
|
||||
GnomeKeyringNetworkPasswordData *data1 = keyring_result->data;
|
||||
GnomeKeyringNetworkPasswordData *data2 = (g_list_next (keyring_result))->data;
|
||||
|
||||
username = NULL;
|
||||
password = NULL;
|
||||
|
||||
if (strcmp (data1->object, "username") == 0) {
|
||||
username = data1->password;
|
||||
} else if (strcmp (data1->object, "password") == 0) {
|
||||
password = data1->password;
|
||||
}
|
||||
|
||||
if (strcmp (data2->object, "username") == 0) {
|
||||
username = data2->password;
|
||||
} else if (strcmp (data2->object, "password") == 0) {
|
||||
password = data2->password;
|
||||
}
|
||||
|
||||
if (password != NULL && username != NULL) {
|
||||
passwords = g_slist_append (passwords, g_strdup (username));
|
||||
passwords = g_slist_append (passwords, g_strdup (password));
|
||||
if (strcmp (data1->keyring, "session") == 0)
|
||||
*is_session = TRUE;
|
||||
else
|
||||
*is_session = FALSE;
|
||||
}
|
||||
|
||||
gnome_keyring_network_password_list_free (keyring_result);
|
||||
}
|
||||
|
||||
return passwords;
|
||||
}
|
||||
|
||||
static void save_vpn_password (const char *vpn_name, const char *vpn_service, const char *keyring,
|
||||
const char *username, const char *password)
|
||||
{
|
||||
guint32 item_id;
|
||||
GnomeKeyringResult keyring_result;
|
||||
|
||||
keyring_result = gnome_keyring_set_network_password_sync (keyring,
|
||||
g_get_user_name (),
|
||||
NULL,
|
||||
vpn_name,
|
||||
"password",
|
||||
vpn_service,
|
||||
NULL,
|
||||
0,
|
||||
password,
|
||||
&item_id);
|
||||
if (keyring_result != GNOME_KEYRING_RESULT_OK)
|
||||
{
|
||||
g_warning ("Couldn't store password in keyring, code %d", (int) keyring_result);
|
||||
}
|
||||
|
||||
keyring_result = gnome_keyring_set_network_password_sync (keyring,
|
||||
g_get_user_name (),
|
||||
NULL,
|
||||
vpn_name,
|
||||
"password",
|
||||
vpn_service,
|
||||
NULL,
|
||||
0,
|
||||
password,
|
||||
&item_id);
|
||||
|
||||
if (keyring_result != GNOME_KEYRING_RESULT_OK)
|
||||
{
|
||||
g_warning ("Couldn't store password in keyring, code %d", (int) keyring_result);
|
||||
}
|
||||
}
|
||||
|
||||
static GSList *
|
||||
get_passwords (const char *vpn_name, const char *vpn_service, gboolean retry)
|
||||
{
|
||||
GSList *result;
|
||||
char *prompt;
|
||||
GtkWidget *dialog;
|
||||
char *keyring_username;
|
||||
char *keyring_password;
|
||||
gboolean keyring_is_session;
|
||||
GSList *keyring_result;
|
||||
GnomeTwoPasswordDialogRemember remember;
|
||||
|
||||
result = NULL;
|
||||
keyring_password = NULL;
|
||||
keyring_username = NULL;
|
||||
keyring_result = NULL;
|
||||
|
||||
g_return_val_if_fail (vpn_name != NULL, NULL);
|
||||
|
||||
/* Use the system user name, since the VPN might have a different user name */
|
||||
if (!retry) {
|
||||
if ((result = lookup_pass (vpn_name, vpn_service, &keyring_is_session)) != NULL) {
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
if ((keyring_result = lookup_pass (vpn_name, vpn_service, &keyring_is_session)) != NULL) {
|
||||
keyring_username = g_strdup ((char *) keyring_result->data);
|
||||
keyring_password = g_strdup ((char *) (g_slist_next (keyring_result))->data);
|
||||
}
|
||||
g_slist_foreach (keyring_result, (GFunc)g_free, NULL);
|
||||
g_slist_free (keyring_result);
|
||||
}
|
||||
|
||||
prompt = g_strdup_printf (_("You need to authenticate to access the Virtual Private Network '%s'."), vpn_name);
|
||||
dialog = gnome_two_password_dialog_new (_("Authenticate PPTP VPN"), prompt, NULL, NULL, FALSE);
|
||||
g_free (prompt);
|
||||
|
||||
gnome_two_password_dialog_set_show_userpass_buttons (GNOME_TWO_PASSWORD_DIALOG (dialog), FALSE);
|
||||
gnome_two_password_dialog_set_show_username (GNOME_TWO_PASSWORD_DIALOG (dialog), TRUE);
|
||||
gnome_two_password_dialog_set_show_domain (GNOME_TWO_PASSWORD_DIALOG (dialog), FALSE);
|
||||
gnome_two_password_dialog_set_show_remember (GNOME_TWO_PASSWORD_DIALOG (dialog), TRUE);
|
||||
gnome_two_password_dialog_set_show_password_secondary (GNOME_TWO_PASSWORD_DIALOG (dialog), FALSE);
|
||||
//gnome_two_password_dialog_set_password_secondary_label (GNOME_TWO_PASSWORD_DIALOG (dialog), _("_Group Password:"));
|
||||
/* use the same keyring storage options as from the items we put in the entry boxes */
|
||||
remember = GNOME_TWO_PASSWORD_DIALOG_REMEMBER_NOTHING;
|
||||
if (keyring_result != NULL) {
|
||||
if (keyring_is_session)
|
||||
remember = GNOME_TWO_PASSWORD_DIALOG_REMEMBER_SESSION;
|
||||
else
|
||||
remember = GNOME_TWO_PASSWORD_DIALOG_REMEMBER_FOREVER;
|
||||
}
|
||||
gnome_two_password_dialog_set_remember (GNOME_TWO_PASSWORD_DIALOG (dialog), remember);
|
||||
|
||||
/* if retrying, put in the passwords from the keyring */
|
||||
if (keyring_username != NULL) {
|
||||
gnome_two_password_dialog_set_username (GNOME_TWO_PASSWORD_DIALOG (dialog), keyring_username);
|
||||
}
|
||||
if (keyring_password != NULL) {
|
||||
gnome_two_password_dialog_set_password (GNOME_TWO_PASSWORD_DIALOG (dialog), keyring_password);
|
||||
}
|
||||
|
||||
gtk_widget_show (dialog);
|
||||
|
||||
if (gnome_two_password_dialog_run_and_block (GNOME_TWO_PASSWORD_DIALOG (dialog)))
|
||||
{
|
||||
char *username;
|
||||
char *password;
|
||||
|
||||
username = gnome_two_password_dialog_get_username (GNOME_TWO_PASSWORD_DIALOG (dialog));
|
||||
password = gnome_two_password_dialog_get_password (GNOME_TWO_PASSWORD_DIALOG (dialog));
|
||||
result = g_slist_append (result, username);
|
||||
result = g_slist_append (result, password);
|
||||
|
||||
switch (gnome_two_password_dialog_get_remember (GNOME_TWO_PASSWORD_DIALOG (dialog)))
|
||||
{
|
||||
case GNOME_TWO_PASSWORD_DIALOG_REMEMBER_SESSION:
|
||||
save_vpn_password (vpn_name, vpn_service, "session", username, password);
|
||||
break;
|
||||
case GNOME_TWO_PASSWORD_DIALOG_REMEMBER_FOREVER:
|
||||
save_vpn_password (vpn_name, vpn_service, NULL, username, password);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
g_free (keyring_username);
|
||||
g_free (keyring_password);
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GSList *i;
|
||||
GSList *passwords;
|
||||
static gboolean retry = FALSE;
|
||||
static gchar *vpn_name = NULL;
|
||||
static gchar *vpn_service = NULL;
|
||||
GError *error = NULL;
|
||||
GOptionContext *context;
|
||||
static GOptionEntry entries[] =
|
||||
{
|
||||
{ "reprompt", 'r', 0, G_OPTION_ARG_NONE, &retry, "Reprompt for passwords", NULL},
|
||||
{ "name", 'n', 0, G_OPTION_ARG_STRING, &vpn_name, "Name of VPN connection", NULL},
|
||||
{ "service", 's', 0, G_OPTION_ARG_STRING, &vpn_service, "VPN service type", NULL},
|
||||
{ NULL }
|
||||
};
|
||||
char buf[1];
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, NULL);
|
||||
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
textdomain (GETTEXT_PACKAGE);
|
||||
|
||||
passwords = NULL;
|
||||
|
||||
context = g_option_context_new ("- pptp auth dialog");
|
||||
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
|
||||
g_option_context_add_group (context, gtk_get_option_group (TRUE));
|
||||
g_option_context_parse (context, &argc, &argv, &error);
|
||||
|
||||
if (vpn_name == NULL || vpn_service == NULL) {
|
||||
fprintf (stderr, "Have to supply both name and service\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (strcmp (vpn_service, VPN_SERVICE) != 0) {
|
||||
fprintf (stderr, "This dialog only works with the '%s' service\n", VPN_SERVICE);
|
||||
goto out;
|
||||
}
|
||||
|
||||
gnome_program_init ("nm-pptp-auth-dialog", VERSION, LIBGNOMEUI_MODULE,
|
||||
argc, argv,
|
||||
GNOME_PARAM_NONE);
|
||||
|
||||
passwords = get_passwords (vpn_name, vpn_service, retry);
|
||||
if (passwords == NULL)
|
||||
goto out;
|
||||
|
||||
/* dump the passwords to stdout */
|
||||
for (i = passwords; i != NULL; i = g_slist_next (i)) {
|
||||
char *password = (char *) i->data;
|
||||
printf ("%s\n", password);
|
||||
}
|
||||
printf ("\n\n");
|
||||
/* for good measure, flush stdout since Kansas is going Bye-Bye */
|
||||
fflush (stdout);
|
||||
|
||||
g_slist_foreach (passwords, (GFunc)g_free, NULL);
|
||||
g_slist_free (passwords);
|
||||
|
||||
/* wait for data on stdin */
|
||||
fread (buf, sizeof (char), sizeof (buf), stdin);
|
||||
|
||||
out:
|
||||
g_option_context_free (context);
|
||||
|
||||
return passwords != NULL ? 0 : 1;
|
||||
}
|
||||
23
vpn-daemons/pptp/autogen.sh
Executable file
23
vpn-daemons/pptp/autogen.sh
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
REQUIRED_AUTOMAKE_VERSION=1.7
|
||||
PKG_NAME=NetworkManager-pptp
|
||||
|
||||
(test -f $srcdir/configure.in \
|
||||
&& test -f $srcdir/auth-dialog/main.c) || {
|
||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||
echo " top-level $PKG_NAME directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
which gnome-autogen.sh || {
|
||||
echo "You need to install gnome-common from the GNOME CVS"
|
||||
exit 1
|
||||
}
|
||||
USE_GNOME2_MACROS=1 . gnome-autogen.sh
|
||||
|
||||
|
||||
131
vpn-daemons/pptp/configure.in
Normal file
131
vpn-daemons/pptp/configure.in
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
AC_PREREQ(2.52)
|
||||
|
||||
AC_INIT(NetworkManager-pptp, 0.1.0, A.J.Mee@ncl.ac.uk, NetworkManager-pptp)
|
||||
AM_INIT_AUTOMAKE([subdir-objects])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
dnl
|
||||
dnl Require programs
|
||||
dnl
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
dnl
|
||||
dnl Required headers
|
||||
dnl
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h paths.h sys/ioctl.h sys/time.h syslog.h unistd.h)
|
||||
|
||||
dnl
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
dnl
|
||||
AC_TYPE_MODE_T
|
||||
AC_TYPE_PID_T
|
||||
AC_HEADER_TIME
|
||||
|
||||
dnl
|
||||
dnl Checks for library functions.
|
||||
dnl
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_MEMCMP
|
||||
AC_CHECK_FUNCS(select socket uname)
|
||||
|
||||
ALL_LINGUAS="da sv"
|
||||
AC_SUBST(ALL_LINGUAS)
|
||||
|
||||
GETTEXT_PACKAGE=NetworkManager-pptp
|
||||
AC_SUBST(GETTEXT_PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package])
|
||||
|
||||
AC_PROG_INTLTOOL([0.27.2])
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
|
||||
PKG_CHECK_MODULES(GTHREAD, gthread-2.0)
|
||||
AC_SUBST(GTHREAD_CFLAGS)
|
||||
AC_SUBST(GTHREAD_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= 0.30)
|
||||
AC_SUBST(DBUS_CFLAGS)
|
||||
AC_SUBST(DBUS_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(NETWORK_MANAGER, NetworkManager >= 0.4.1)
|
||||
AC_SUBST(NETWORK_MANAGER_CFLAGS)
|
||||
AC_SUBST(NETWORK_MANAGER_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.6)
|
||||
AC_SUBST(GTK_CFLAGS)
|
||||
AC_SUBST(GTK_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(GDK_PIXBUF, gdk-pixbuf-2.0)
|
||||
AC_SUBST(GDK_PIXBUF_CFLAGS)
|
||||
AC_SUBST(GDK_PIXBUF_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(GLADE, libglade-2.0)
|
||||
AC_SUBST(GLADE_CFLAGS)
|
||||
AC_SUBST(GLADE_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(LIBGNOMEUI, libgnomeui-2.0)
|
||||
AC_SUBST(LIBGNOMEUI_CFLAGS)
|
||||
AC_SUBST(LIBGNOMEUI_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(GCONF, gconf-2.0)
|
||||
AC_SUBST(GCONF_CFLAGS)
|
||||
AC_SUBST(GCONF_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(GNOMEKEYRING, gnome-keyring-1)
|
||||
AC_SUBST(GNOMEKEYRING_CFLAGS)
|
||||
AC_SUBST(GNOMEKEYRING_LIBS)
|
||||
|
||||
AS_AC_EXPAND(LOCALSTATEDIR, $localstatedir)
|
||||
AS_AC_EXPAND(SYSCONFDIR, $sysconfdir)
|
||||
AS_AC_EXPAND(DATADIR, $datadir)
|
||||
AS_AC_EXPAND(BINDIR, $bindir)
|
||||
AS_AC_EXPAND(SBINDIR, $sbindir)
|
||||
AS_AC_EXPAND(LIBDIR, $libdir)
|
||||
AS_AC_EXPAND(LIBEXECDIR, $libexecdir)
|
||||
|
||||
AC_ARG_ENABLE(more-warnings,
|
||||
AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings]),
|
||||
set_more_warnings="$enableval",[
|
||||
if test -d "$srcdir/{arch}" || test -d "$srcdir/CVS"; then
|
||||
set_more_warnings=yes
|
||||
else
|
||||
set_more_warnings=no
|
||||
fi
|
||||
])
|
||||
AC_MSG_CHECKING(for more warnings, including -Werror)
|
||||
if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
CFLAGS="-Wall -Werror -std=gnu89 $CFLAGS"
|
||||
|
||||
for option in -Wno-unused -Wno-strict-aliasing -Wno-sign-compare -Wdeclaration-after-statement -Wno-pointer-sign ; do
|
||||
SAVE_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $option"
|
||||
AC_MSG_CHECKING([whether gcc understands $option])
|
||||
AC_TRY_COMPILE([], [],
|
||||
has_option=yes,
|
||||
has_option=no,)
|
||||
if test $has_option = no; then
|
||||
CFLAGS="$SAVE_CFLAGS"
|
||||
fi
|
||||
AC_MSG_RESULT($has_option)
|
||||
unset has_option
|
||||
unset SAVE_CFLAGS
|
||||
done
|
||||
unset option
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
auth-dialog/Makefile
|
||||
properties/Makefile
|
||||
po/Makefile.in
|
||||
nm-pptp-service.name
|
||||
])
|
||||
25
vpn-daemons/pptp/doc/example-pptp-system-wide-connection.sh
Executable file
25
vpn-daemons/pptp/doc/example-pptp-system-wide-connection.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This is an example of how to install a system-wide connection that
|
||||
# cannot be edited by unprivileged users using nm-vpn-properties. This
|
||||
# script needs to be run as root and you may need to restart any
|
||||
# gconfd daemons after the script has run (logging in and out will
|
||||
# suffice)
|
||||
|
||||
NAME="pptp-system-wide"
|
||||
ESCAPED_NAME="pptp-system-wide"
|
||||
REMOTE="1.2.3.4"
|
||||
# must be either yes or no
|
||||
USEMPPE="no"
|
||||
|
||||
IPSEC_ROUTES="[172.16.0.0/16,192.168.4.0/24]"
|
||||
|
||||
GCONF_PATH="/system/networking/vpn_connections/$ESCAPED_NAME"
|
||||
|
||||
GCONFTOOL2_OPTS="--direct --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory"
|
||||
|
||||
gconftool-2 $GCONFTOOL2_OPTS --type string --set $GCONF_PATH/name "$NAME"
|
||||
gconftool-2 $GCONFTOOL2_OPTS --type string --set $GCONF_PATH/service_name "org.freedesktop.NetworkManager.pptp"
|
||||
gconftool-2 $GCONFTOOL2_OPTS --type list --list-type=string --set $GCONF_PATH/vpn_data ["remote","$REMOTE","require-mppe",$USEMPPE]
|
||||
gconftool-2 $GCONFTOOL2_OPTS --type list --list-type=string --set $GCONF_PATH/routes $IPSEC_ROUTES
|
||||
|
||||
BIN
vpn-daemons/pptp/gnome-mime-application-x-pptp-settings.png
Normal file
BIN
vpn-daemons/pptp/gnome-mime-application-x-pptp-settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
839
vpn-daemons/pptp/intltool-extract.in
Executable file
839
vpn-daemons/pptp/intltool-extract.in
Executable file
|
|
@ -0,0 +1,839 @@
|
|||
#!@INTLTOOL_PERL@ -w
|
||||
# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
|
||||
#
|
||||
# The Intltool Message Extractor
|
||||
#
|
||||
# Copyright (C) 2000-2001, 2003 Free Software Foundation.
|
||||
#
|
||||
# Intltool 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.
|
||||
#
|
||||
# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
#
|
||||
# Authors: Kenneth Christiansen <kenneth@gnu.org>
|
||||
# Darin Adler <darin@bentspoon.com>
|
||||
#
|
||||
|
||||
## Release information
|
||||
my $PROGRAM = "intltool-extract";
|
||||
my $PACKAGE = "intltool";
|
||||
my $VERSION = "0.34.1";
|
||||
|
||||
## Loaded modules
|
||||
use strict;
|
||||
use File::Basename;
|
||||
use Getopt::Long;
|
||||
|
||||
## Scalars used by the option stuff
|
||||
my $TYPE_ARG = "0";
|
||||
my $LOCAL_ARG = "0";
|
||||
my $HELP_ARG = "0";
|
||||
my $VERSION_ARG = "0";
|
||||
my $UPDATE_ARG = "0";
|
||||
my $QUIET_ARG = "0";
|
||||
my $SRCDIR_ARG = ".";
|
||||
|
||||
my $FILE;
|
||||
my $OUTFILE;
|
||||
|
||||
my $gettext_type = "";
|
||||
my $input;
|
||||
my %messages = ();
|
||||
my %loc = ();
|
||||
my %count = ();
|
||||
my %comments = ();
|
||||
my $strcount = 0;
|
||||
|
||||
my $XMLCOMMENT = "";
|
||||
|
||||
## Use this instead of \w for XML files to handle more possible characters.
|
||||
my $w = "[-A-Za-z0-9._:]";
|
||||
|
||||
## Always print first
|
||||
$| = 1;
|
||||
|
||||
## Handle options
|
||||
GetOptions (
|
||||
"type=s" => \$TYPE_ARG,
|
||||
"local|l" => \$LOCAL_ARG,
|
||||
"help|h" => \$HELP_ARG,
|
||||
"version|v" => \$VERSION_ARG,
|
||||
"update" => \$UPDATE_ARG,
|
||||
"quiet|q" => \$QUIET_ARG,
|
||||
"srcdir=s" => \$SRCDIR_ARG,
|
||||
) or &error;
|
||||
|
||||
&split_on_argument;
|
||||
|
||||
|
||||
## Check for options.
|
||||
## This section will check for the different options.
|
||||
|
||||
sub split_on_argument {
|
||||
|
||||
if ($VERSION_ARG) {
|
||||
&version;
|
||||
|
||||
} elsif ($HELP_ARG) {
|
||||
&help;
|
||||
|
||||
} elsif ($LOCAL_ARG) {
|
||||
&place_local;
|
||||
&extract;
|
||||
|
||||
} elsif ($UPDATE_ARG) {
|
||||
&place_normal;
|
||||
&extract;
|
||||
|
||||
} elsif (@ARGV > 0) {
|
||||
&place_normal;
|
||||
&message;
|
||||
&extract;
|
||||
|
||||
} else {
|
||||
&help;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sub place_normal {
|
||||
$FILE = $ARGV[0];
|
||||
$OUTFILE = "$FILE.h";
|
||||
}
|
||||
|
||||
sub place_local {
|
||||
$FILE = $ARGV[0];
|
||||
$OUTFILE = fileparse($FILE, ());
|
||||
if (!-e "tmp/") {
|
||||
system("mkdir tmp/");
|
||||
}
|
||||
$OUTFILE = "./tmp/$OUTFILE.h"
|
||||
}
|
||||
|
||||
sub determine_type {
|
||||
if ($TYPE_ARG =~ /^gettext\/(.*)/) {
|
||||
$gettext_type=$1
|
||||
}
|
||||
}
|
||||
|
||||
## Sub for printing release information
|
||||
sub version{
|
||||
print <<_EOF_;
|
||||
${PROGRAM} (${PACKAGE}) $VERSION
|
||||
Copyright (C) 2000, 2003 Free Software Foundation, Inc.
|
||||
Written by Kenneth Christiansen, 2000.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
_EOF_
|
||||
exit;
|
||||
}
|
||||
|
||||
## Sub for printing usage information
|
||||
sub help {
|
||||
print <<_EOF_;
|
||||
Usage: ${PROGRAM} [OPTION]... [FILENAME]
|
||||
Generates a header file from an XML source file.
|
||||
|
||||
It grabs all strings between <_translatable_node> and its end tag in
|
||||
XML files. Read manpage (man ${PROGRAM}) for more info.
|
||||
|
||||
--type=TYPE Specify the file type of FILENAME. Currently supports:
|
||||
"gettext/glade", "gettext/ini", "gettext/keys"
|
||||
"gettext/rfc822deb", "gettext/schemas",
|
||||
"gettext/scheme", "gettext/xml"
|
||||
-l, --local Writes output into current working directory
|
||||
(conflicts with --update)
|
||||
--update Writes output into the same directory the source file
|
||||
reside (conflicts with --local)
|
||||
--srcdir Root of the source tree
|
||||
-v, --version Output version information and exit
|
||||
-h, --help Display this help and exit
|
||||
-q, --quiet Quiet mode
|
||||
|
||||
Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE")
|
||||
or send email to <xml-i18n-tools\@gnome.org>.
|
||||
_EOF_
|
||||
exit;
|
||||
}
|
||||
|
||||
## Sub for printing error messages
|
||||
sub error{
|
||||
print STDERR "Try `${PROGRAM} --help' for more information.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub message {
|
||||
print "Generating C format header file for translation.\n" unless $QUIET_ARG;
|
||||
}
|
||||
|
||||
sub extract {
|
||||
&determine_type;
|
||||
|
||||
&convert;
|
||||
|
||||
open OUT, ">$OUTFILE";
|
||||
binmode (OUT) if $^O eq 'MSWin32';
|
||||
&msg_write;
|
||||
close OUT;
|
||||
|
||||
print "Wrote $OUTFILE\n" unless $QUIET_ARG;
|
||||
}
|
||||
|
||||
sub convert {
|
||||
|
||||
## Reading the file
|
||||
{
|
||||
local (*IN);
|
||||
local $/; #slurp mode
|
||||
open (IN, "<$SRCDIR_ARG/$FILE") || die "can't open $SRCDIR_ARG/$FILE: $!";
|
||||
$input = <IN>;
|
||||
}
|
||||
|
||||
&type_ini if $gettext_type eq "ini";
|
||||
&type_keys if $gettext_type eq "keys";
|
||||
&type_xml if $gettext_type eq "xml";
|
||||
&type_glade if $gettext_type eq "glade";
|
||||
&type_scheme if $gettext_type eq "scheme";
|
||||
&type_schemas if $gettext_type eq "schemas";
|
||||
&type_rfc822deb if $gettext_type eq "rfc822deb";
|
||||
}
|
||||
|
||||
sub entity_decode_minimal
|
||||
{
|
||||
local ($_) = @_;
|
||||
|
||||
s/'/'/g; # '
|
||||
s/"/"/g; # "
|
||||
s/&/&/g;
|
||||
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub entity_decode
|
||||
{
|
||||
local ($_) = @_;
|
||||
|
||||
s/'/'/g; # '
|
||||
s/"/"/g; # "
|
||||
s/&/&/g;
|
||||
s/</</g;
|
||||
s/>/>/g;
|
||||
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub escape_char
|
||||
{
|
||||
return '\"' if $_ eq '"';
|
||||
return '\n' if $_ eq "\n";
|
||||
return '\\' if $_ eq '\\';
|
||||
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub escape
|
||||
{
|
||||
my ($string) = @_;
|
||||
return join "", map &escape_char, split //, $string;
|
||||
}
|
||||
|
||||
sub type_ini {
|
||||
### For generic translatable desktop files ###
|
||||
while ($input =~ /^_.*=(.*)$/mg) {
|
||||
$messages{$1} = [];
|
||||
}
|
||||
}
|
||||
|
||||
sub type_keys {
|
||||
### For generic translatable mime/keys files ###
|
||||
while ($input =~ /^\s*_\w+=(.*)$/mg) {
|
||||
$messages{$1} = [];
|
||||
}
|
||||
}
|
||||
|
||||
sub type_xml {
|
||||
### For generic translatable XML files ###
|
||||
my $tree = readXml($input);
|
||||
parseTree(0, $tree);
|
||||
}
|
||||
|
||||
sub print_var {
|
||||
my $var = shift;
|
||||
my $vartype = ref $var;
|
||||
|
||||
if ($vartype =~ /ARRAY/) {
|
||||
my @arr = @{$var};
|
||||
print "[ ";
|
||||
foreach my $el (@arr) {
|
||||
print_var($el);
|
||||
print ", ";
|
||||
}
|
||||
print "] ";
|
||||
} elsif ($vartype =~ /HASH/) {
|
||||
my %hash = %{$var};
|
||||
print "{ ";
|
||||
foreach my $key (keys %hash) {
|
||||
print "$key => ";
|
||||
print_var($hash{$key});
|
||||
print ", ";
|
||||
}
|
||||
print "} ";
|
||||
} else {
|
||||
print $var;
|
||||
}
|
||||
}
|
||||
|
||||
# Same syntax as getAttributeString in intltool-merge.in.in, similar logic (look for ## differences comment)
|
||||
sub getAttributeString
|
||||
{
|
||||
my $sub = shift;
|
||||
my $do_translate = shift || 1;
|
||||
my $language = shift || "";
|
||||
my $translate = shift;
|
||||
my $result = "";
|
||||
foreach my $e (reverse(sort(keys %{ $sub }))) {
|
||||
my $key = $e;
|
||||
my $string = $sub->{$e};
|
||||
my $quote = '"';
|
||||
|
||||
$string =~ s/^[\s]+//;
|
||||
$string =~ s/[\s]+$//;
|
||||
|
||||
if ($string =~ /^'.*'$/)
|
||||
{
|
||||
$quote = "'";
|
||||
}
|
||||
$string =~ s/^['"]//g;
|
||||
$string =~ s/['"]$//g;
|
||||
|
||||
## differences from intltool-merge.in.in
|
||||
if ($key =~ /^_/) {
|
||||
$comments{entity_decode($string)} = $XMLCOMMENT if $XMLCOMMENT;
|
||||
$messages{entity_decode($string)} = [];
|
||||
$$translate = 2;
|
||||
}
|
||||
## differences end here from intltool-merge.in.in
|
||||
$result .= " $key=$quote$string$quote";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
# Verbatim copy from intltool-merge.in.in
|
||||
sub getXMLstring
|
||||
{
|
||||
my $ref = shift;
|
||||
my $spacepreserve = shift || 0;
|
||||
my @list = @{ $ref };
|
||||
my $result = "";
|
||||
|
||||
my $count = scalar(@list);
|
||||
my $attrs = $list[0];
|
||||
my $index = 1;
|
||||
|
||||
$spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/));
|
||||
$spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/));
|
||||
|
||||
while ($index < $count) {
|
||||
my $type = $list[$index];
|
||||
my $content = $list[$index+1];
|
||||
if (! $type ) {
|
||||
# We've got CDATA
|
||||
if ($content) {
|
||||
# lets strip the whitespace here, and *ONLY* here
|
||||
$content =~ s/\s+/ /gs if (!$spacepreserve);
|
||||
$result .= $content;
|
||||
}
|
||||
} elsif ( "$type" ne "1" ) {
|
||||
# We've got another element
|
||||
$result .= "<$type";
|
||||
$result .= getAttributeString(@{$content}[0], 0); # no nested translatable elements
|
||||
if ($content) {
|
||||
my $subresult = getXMLstring($content, $spacepreserve);
|
||||
if ($subresult) {
|
||||
$result .= ">".$subresult . "</$type>";
|
||||
} else {
|
||||
$result .= "/>";
|
||||
}
|
||||
} else {
|
||||
$result .= "/>";
|
||||
}
|
||||
}
|
||||
$index += 2;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
# Verbatim copy from intltool-merge.in.in, except for MULTIPLE_OUTPUT handling removed
|
||||
# Translate list of nodes if necessary
|
||||
sub translate_subnodes
|
||||
{
|
||||
my $fh = shift;
|
||||
my $content = shift;
|
||||
my $language = shift || "";
|
||||
my $singlelang = shift || 0;
|
||||
my $spacepreserve = shift || 0;
|
||||
|
||||
my @nodes = @{ $content };
|
||||
|
||||
my $count = scalar(@nodes);
|
||||
my $index = 0;
|
||||
while ($index < $count) {
|
||||
my $type = $nodes[$index];
|
||||
my $rest = $nodes[$index+1];
|
||||
traverse($fh, $type, $rest, $language, $spacepreserve);
|
||||
$index += 2;
|
||||
}
|
||||
}
|
||||
|
||||
# Based on traverse() in intltool-merge.in.in
|
||||
sub traverse
|
||||
{
|
||||
my $fh = shift; # unused, to allow us to sync code between -merge and -extract
|
||||
my $nodename = shift;
|
||||
my $content = shift;
|
||||
my $language = shift || "";
|
||||
my $spacepreserve = shift || 0;
|
||||
|
||||
if ($nodename && "$nodename" eq "1") {
|
||||
$XMLCOMMENT = $content;
|
||||
} elsif ($nodename) {
|
||||
# element
|
||||
my @all = @{ $content };
|
||||
my $attrs = shift @all;
|
||||
my $translate = 0;
|
||||
my $outattr = getAttributeString($attrs, 1, $language, \$translate);
|
||||
|
||||
if ($nodename =~ /^_/) {
|
||||
$translate = 1;
|
||||
$nodename =~ s/^_//;
|
||||
}
|
||||
my $lookup = '';
|
||||
|
||||
$spacepreserve = 0 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?default["']?$/));
|
||||
$spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/));
|
||||
|
||||
if ($translate) {
|
||||
$lookup = getXMLstring($content, $spacepreserve);
|
||||
if (!$spacepreserve) {
|
||||
$lookup =~ s/^\s+//s;
|
||||
$lookup =~ s/\s+$//s;
|
||||
}
|
||||
|
||||
if ($lookup && $translate != 2) {
|
||||
$comments{$lookup} = $XMLCOMMENT if $XMLCOMMENT;
|
||||
$messages{$lookup} = [];
|
||||
} elsif ($translate == 2) {
|
||||
translate_subnodes($fh, \@all, $language, 1, $spacepreserve);
|
||||
}
|
||||
} else {
|
||||
$XMLCOMMENT = "";
|
||||
my $count = scalar(@all);
|
||||
if ($count > 0) {
|
||||
my $index = 0;
|
||||
while ($index < $count) {
|
||||
my $type = $all[$index];
|
||||
my $rest = $all[$index+1];
|
||||
traverse($fh, $type, $rest, $language, $spacepreserve);
|
||||
$index += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
$XMLCOMMENT = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Verbatim copy from intltool-merge.in.in, $fh for compatibility
|
||||
sub parseTree
|
||||
{
|
||||
my $fh = shift;
|
||||
my $ref = shift;
|
||||
my $language = shift || "";
|
||||
|
||||
my $name = shift @{ $ref };
|
||||
my $cont = shift @{ $ref };
|
||||
|
||||
while (!$name || "$name" eq "1") {
|
||||
$name = shift @{ $ref };
|
||||
$cont = shift @{ $ref };
|
||||
}
|
||||
|
||||
my $spacepreserve = 0;
|
||||
my $attrs = @{$cont}[0];
|
||||
$spacepreserve = 1 if ((exists $attrs->{"xml:space"}) && ($attrs->{"xml:space"} =~ /^["']?preserve["']?$/));
|
||||
|
||||
traverse($fh, $name, $cont, $language, $spacepreserve);
|
||||
}
|
||||
|
||||
# Verbatim copy from intltool-merge.in.in
|
||||
sub intltool_tree_comment
|
||||
{
|
||||
my $expat = shift;
|
||||
my $data = shift;
|
||||
my $clist = $expat->{Curlist};
|
||||
my $pos = $#$clist;
|
||||
|
||||
push @$clist, 1 => $data;
|
||||
}
|
||||
|
||||
# Verbatim copy from intltool-merge.in.in
|
||||
sub intltool_tree_cdatastart
|
||||
{
|
||||
my $expat = shift;
|
||||
my $clist = $expat->{Curlist};
|
||||
my $pos = $#$clist;
|
||||
|
||||
push @$clist, 0 => $expat->original_string();
|
||||
}
|
||||
|
||||
# Verbatim copy from intltool-merge.in.in
|
||||
sub intltool_tree_cdataend
|
||||
{
|
||||
my $expat = shift;
|
||||
my $clist = $expat->{Curlist};
|
||||
my $pos = $#$clist;
|
||||
|
||||
$clist->[$pos] .= $expat->original_string();
|
||||
}
|
||||
|
||||
# Verbatim copy from intltool-merge.in.in
|
||||
sub intltool_tree_char
|
||||
{
|
||||
my $expat = shift;
|
||||
my $text = shift;
|
||||
my $clist = $expat->{Curlist};
|
||||
my $pos = $#$clist;
|
||||
|
||||
# Use original_string so that we retain escaped entities
|
||||
# in CDATA sections.
|
||||
#
|
||||
if ($pos > 0 and $clist->[$pos - 1] eq '0') {
|
||||
$clist->[$pos] .= $expat->original_string();
|
||||
} else {
|
||||
push @$clist, 0 => $expat->original_string();
|
||||
}
|
||||
}
|
||||
|
||||
# Verbatim copy from intltool-merge.in.in
|
||||
sub intltool_tree_start
|
||||
{
|
||||
my $expat = shift;
|
||||
my $tag = shift;
|
||||
my @origlist = ();
|
||||
|
||||
# Use original_string so that we retain escaped entities
|
||||
# in attribute values. We must convert the string to an
|
||||
# @origlist array to conform to the structure of the Tree
|
||||
# Style.
|
||||
#
|
||||
my @original_array = split /\x/, $expat->original_string();
|
||||
my $source = $expat->original_string();
|
||||
|
||||
# Remove leading tag.
|
||||
#
|
||||
$source =~ s|^\s*<\s*(\S+)||s;
|
||||
|
||||
# Grab attribute key/value pairs and push onto @origlist array.
|
||||
#
|
||||
while ($source)
|
||||
{
|
||||
if ($source =~ /^\s*([\w:-]+)\s*[=]\s*["]/)
|
||||
{
|
||||
$source =~ s|^\s*([\w:-]+)\s*[=]\s*["]([^"]*)["]||s;
|
||||
push @origlist, $1;
|
||||
push @origlist, '"' . $2 . '"';
|
||||
}
|
||||
elsif ($source =~ /^\s*([\w:-]+)\s*[=]\s*[']/)
|
||||
{
|
||||
$source =~ s|^\s*([\w:-]+)\s*[=]\s*[']([^']*)[']||s;
|
||||
push @origlist, $1;
|
||||
push @origlist, "'" . $2 . "'";
|
||||
}
|
||||
else
|
||||
{
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
my $ol = [ { @origlist } ];
|
||||
|
||||
push @{ $expat->{Lists} }, $expat->{Curlist};
|
||||
push @{ $expat->{Curlist} }, $tag => $ol;
|
||||
$expat->{Curlist} = $ol;
|
||||
}
|
||||
|
||||
# Copied from intltool-merge.in.in and added comment handler.
|
||||
sub readXml
|
||||
{
|
||||
my $xmldoc = shift || return;
|
||||
my $ret = eval 'require XML::Parser';
|
||||
if(!$ret) {
|
||||
die "You must have XML::Parser installed to run $0\n\n";
|
||||
}
|
||||
my $xp = new XML::Parser(Style => 'Tree');
|
||||
$xp->setHandlers(Char => \&intltool_tree_char);
|
||||
$xp->setHandlers(Start => \&intltool_tree_start);
|
||||
$xp->setHandlers(CdataStart => \&intltool_tree_cdatastart);
|
||||
$xp->setHandlers(CdataEnd => \&intltool_tree_cdataend);
|
||||
|
||||
## differences from intltool-merge.in.in
|
||||
$xp->setHandlers(Comment => \&intltool_tree_comment);
|
||||
## differences end here from intltool-merge.in.in
|
||||
|
||||
my $tree = $xp->parse($xmldoc);
|
||||
#print_var($tree);
|
||||
|
||||
# <foo><!-- comment --><head id="a">Hello <em>there</em></head><bar>Howdy<ref/></bar>do</foo>
|
||||
# would be:
|
||||
# [foo, [{}, 1, "comment", head, [{id => "a"}, 0, "Hello ", em, [{}, 0, "there"]], bar,
|
||||
# [{}, 0, "Howdy", ref, [{}]], 0, "do" ] ]
|
||||
|
||||
return $tree;
|
||||
}
|
||||
|
||||
sub type_schemas {
|
||||
### For schemas XML files ###
|
||||
|
||||
# FIXME: We should handle escaped < (less than)
|
||||
while ($input =~ /
|
||||
<locale\ name="C">\s*
|
||||
(<default>\s*(?:<!--([^>]*?)-->\s*)?(.*?)\s*<\/default>\s*)?
|
||||
(<short>\s*(?:<!--([^>]*?)-->\s*)?(.*?)\s*<\/short>\s*)?
|
||||
(<long>\s*(?:<!--([^>]*?)-->\s*)?(.*?)\s*<\/long>\s*)?
|
||||
<\/locale>
|
||||
/sgx) {
|
||||
my @totranslate = ($3,$6,$9);
|
||||
my @eachcomment = ($2,$5,$8);
|
||||
foreach (@totranslate) {
|
||||
my $currentcomment = shift @eachcomment;
|
||||
next if !$_;
|
||||
s/\s+/ /g;
|
||||
$messages{entity_decode_minimal($_)} = [];
|
||||
$comments{entity_decode_minimal($_)} = $currentcomment if (defined($currentcomment));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub type_rfc822deb {
|
||||
### For rfc822-style Debian configuration files ###
|
||||
|
||||
my $lineno = 1;
|
||||
my $type = '';
|
||||
while ($input =~ /\G(.*?)(^|\n)(_+)([^:]+):[ \t]*(.*?)(?=\n\S|$)/sg)
|
||||
{
|
||||
my ($pre, $newline, $underscore, $tag, $text) = ($1, $2, $3, $4, $5);
|
||||
while ($pre =~ m/\n/g)
|
||||
{
|
||||
$lineno ++;
|
||||
}
|
||||
$lineno += length($newline);
|
||||
my @str_list = rfc822deb_split(length($underscore), $text);
|
||||
for my $str (@str_list)
|
||||
{
|
||||
$strcount++;
|
||||
$messages{$str} = [];
|
||||
$loc{$str} = $lineno;
|
||||
$count{$str} = $strcount;
|
||||
my $usercomment = '';
|
||||
while($pre =~ s/(^|\n)#([^\n]*)$//s)
|
||||
{
|
||||
$usercomment = "\n" . $2 . $usercomment;
|
||||
}
|
||||
$comments{$str} = $tag . $usercomment;
|
||||
}
|
||||
$lineno += ($text =~ s/\n//g);
|
||||
}
|
||||
}
|
||||
|
||||
sub rfc822deb_split {
|
||||
# Debian defines a special way to deal with rfc822-style files:
|
||||
# when a value contain newlines, it consists of
|
||||
# 1. a short form (first line)
|
||||
# 2. a long description, all lines begin with a space,
|
||||
# and paragraphs are separated by a single dot on a line
|
||||
# This routine returns an array of all paragraphs, and reformat
|
||||
# them.
|
||||
# When first argument is 2, the string is a comma separated list of
|
||||
# values.
|
||||
my $type = shift;
|
||||
my $text = shift;
|
||||
$text =~ s/^[ \t]//mg;
|
||||
return (split(/, */, $text, 0)) if $type ne 1;
|
||||
return ($text) if $text !~ /\n/;
|
||||
|
||||
$text =~ s/([^\n]*)\n//;
|
||||
my @list = ($1);
|
||||
my $str = '';
|
||||
for my $line (split (/\n/, $text))
|
||||
{
|
||||
chomp $line;
|
||||
if ($line =~ /^\.\s*$/)
|
||||
{
|
||||
# New paragraph
|
||||
$str =~ s/\s*$//;
|
||||
push(@list, $str);
|
||||
$str = '';
|
||||
}
|
||||
elsif ($line =~ /^\s/)
|
||||
{
|
||||
# Line which must not be reformatted
|
||||
$str .= "\n" if length ($str) && $str !~ /\n$/;
|
||||
$line =~ s/\s+$//;
|
||||
$str .= $line."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
# Continuation line, remove newline
|
||||
$str .= " " if length ($str) && $str !~ /\n$/;
|
||||
$str .= $line;
|
||||
}
|
||||
}
|
||||
$str =~ s/\s*$//;
|
||||
push(@list, $str) if length ($str);
|
||||
return @list;
|
||||
}
|
||||
|
||||
sub type_glade {
|
||||
### For translatable Glade XML files ###
|
||||
|
||||
my $tags = "label|title|text|format|copyright|comments|preview_text|tooltip|message";
|
||||
|
||||
while ($input =~ /<($tags)>([^<]+)<\/($tags)>/sg) {
|
||||
# Glade sometimes uses tags that normally mark translatable things for
|
||||
# little bits of non-translatable content. We work around this by not
|
||||
# translating strings that only includes something like label4 or window1.
|
||||
$messages{entity_decode($2)} = [] unless $2 =~ /^(window|label|dialog)[0-9]+$/;
|
||||
}
|
||||
|
||||
while ($input =~ /<items>(..[^<]*)<\/items>/sg) {
|
||||
for my $item (split (/\n/, $1)) {
|
||||
$messages{entity_decode($item)} = [];
|
||||
}
|
||||
}
|
||||
|
||||
## handle new glade files
|
||||
while ($input =~ /<(property|atkproperty)\s+[^>]*translatable\s*=\s*"yes"(?:\s+[^>]*comments\s*=\s*"([^"]*)")?[^>]*>([^<]+)<\/\1>/sg) {
|
||||
$messages{entity_decode($3)} = [] unless $3 =~ /^(window|label)[0-9]+$/;
|
||||
if (defined($2) and !($3 =~ /^(window|label)[0-9]+$/)) {
|
||||
$comments{entity_decode($3)} = entity_decode($2) ;
|
||||
}
|
||||
}
|
||||
while ($input =~ /<atkaction\s+action_name="([^>]*)"\s+description="([^>]+)"\/>/sg) {
|
||||
$messages{entity_decode_minimal($2)} = [];
|
||||
}
|
||||
}
|
||||
|
||||
sub type_scheme {
|
||||
my ($line, $i, $state, $str, $trcomment, $char);
|
||||
for $line (split(/\n/, $input)) {
|
||||
$i = 0;
|
||||
$state = 0; # 0 - nothing, 1 - string, 2 - translatable string
|
||||
while ($i < length($line)) {
|
||||
if (substr($line,$i,1) eq "\"") {
|
||||
if ($state == 2) {
|
||||
$comments{$str} = $trcomment if ($trcomment);
|
||||
$messages{$str} = [];
|
||||
$str = '';
|
||||
$state = 0; $trcomment = "";
|
||||
} elsif ($state == 1) {
|
||||
$str = '';
|
||||
$state = 0; $trcomment = "";
|
||||
} else {
|
||||
$state = 1;
|
||||
$str = '';
|
||||
if ($i>0 && substr($line,$i-1,1) eq '_') {
|
||||
$state = 2;
|
||||
}
|
||||
}
|
||||
} elsif (!$state) {
|
||||
if (substr($line,$i,1) eq ";") {
|
||||
$trcomment = substr($line,$i+1);
|
||||
$trcomment =~ s/^;*\s*//;
|
||||
$i = length($line);
|
||||
} elsif ($trcomment && substr($line,$i,1) !~ /\s|\(|\)|_/) {
|
||||
$trcomment = "";
|
||||
}
|
||||
} else {
|
||||
if (substr($line,$i,1) eq "\\") {
|
||||
$char = substr($line,$i+1,1);
|
||||
if ($char ne "\"" && $char ne "\\") {
|
||||
$str = $str . "\\";
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$str = $str . substr($line,$i,1);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub msg_write {
|
||||
my @msgids;
|
||||
if (%count)
|
||||
{
|
||||
@msgids = sort { $count{$a} <=> $count{$b} } keys %count;
|
||||
}
|
||||
else
|
||||
{
|
||||
@msgids = sort keys %messages;
|
||||
}
|
||||
for my $message (@msgids)
|
||||
{
|
||||
my $offsetlines = 1;
|
||||
$offsetlines++ if $message =~ /%/;
|
||||
if (defined ($comments{$message}))
|
||||
{
|
||||
while ($comments{$message} =~ m/\n/g)
|
||||
{
|
||||
$offsetlines++;
|
||||
}
|
||||
}
|
||||
print OUT "# ".($loc{$message} - $offsetlines). " \"$FILE\"\n"
|
||||
if defined $loc{$message};
|
||||
print OUT "/* ".$comments{$message}." */\n"
|
||||
if defined $comments{$message};
|
||||
print OUT "/* xgettext:no-c-format */\n" if $message =~ /%/;
|
||||
|
||||
my @lines = split (/\n/, $message, -1);
|
||||
for (my $n = 0; $n < @lines; $n++)
|
||||
{
|
||||
if ($n == 0)
|
||||
{
|
||||
print OUT "char *s = N_(\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
print OUT " \"";
|
||||
}
|
||||
|
||||
print OUT escape($lines[$n]);
|
||||
|
||||
if ($n < @lines - 1)
|
||||
{
|
||||
print OUT "\\n\"\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print OUT "\");\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1356
vpn-daemons/pptp/intltool-merge.in
Executable file
1356
vpn-daemons/pptp/intltool-merge.in
Executable file
File diff suppressed because it is too large
Load diff
1065
vpn-daemons/pptp/intltool-update.in
Executable file
1065
vpn-daemons/pptp/intltool-update.in
Executable file
File diff suppressed because it is too large
Load diff
16
vpn-daemons/pptp/nm-pptp-service.conf
Normal file
16
vpn-daemons/pptp/nm-pptp-service.conf
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE busconfig PUBLIC
|
||||
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||
<busconfig>
|
||||
<policy user="root">
|
||||
<allow own="org.freedesktop.NetworkManager.pptp"/>
|
||||
<allow send_destination="org.freedesktop.NetworkManager.pptp"/>
|
||||
<allow send_interface="org.freedesktop.NetworkManager.pptp"/>
|
||||
</policy>
|
||||
<policy context="default">
|
||||
<deny own="org.freedesktop.NetworkManager.pptp"/>
|
||||
<deny send_destination="org.freedesktop.NetworkManager.pptp"/>
|
||||
<deny send_interface="org.freedesktop.NetworkManager.pptp"/>
|
||||
</policy>
|
||||
</busconfig>
|
||||
|
||||
8
vpn-daemons/pptp/nm-pptp-service.name.in
Normal file
8
vpn-daemons/pptp/nm-pptp-service.name.in
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[VPN Connection]
|
||||
name=pptp
|
||||
service=org.freedesktop.NetworkManager.pptp
|
||||
program=@BINDIR@/nm-pptp-service
|
||||
|
||||
[GNOME]
|
||||
auth-dialog=@LIBEXECDIR@/nm-pptp-auth-dialog
|
||||
properties=@LIBDIR@/libnm-pptp-properties
|
||||
12
vpn-daemons/pptp/nm-pptp.desktop.in
Normal file
12
vpn-daemons/pptp/nm-pptp.desktop.in
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
_Name=VPN Connection Manager (PPTP)
|
||||
_GenericName=VPN Connection Manager (PPTP)
|
||||
_Comment=Add, Remove, and Edit VPN Connections
|
||||
Exec=nm-vpn-properties --import-service org.freedesktop.NetworkManager.pptp --import-file %f
|
||||
Icon=gnome-mime-application-x-pptp-settings
|
||||
Terminal=false
|
||||
Type=Application
|
||||
DocPath=
|
||||
Categories=GNOME;Application;Network;
|
||||
MimeType=application/x-pptp-settings
|
||||
7
vpn-daemons/pptp/po/.cvsignore
Normal file
7
vpn-daemons/pptp/po/.cvsignore
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Makefile.in.in
|
||||
Makefile
|
||||
Makefile.in
|
||||
POTFILES
|
||||
da.gmo
|
||||
sv.gmo
|
||||
*.pot
|
||||
10
vpn-daemons/pptp/po/ChangeLog
Normal file
10
vpn-daemons/pptp/po/ChangeLog
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
2005-06-17 David Zeuthen <davidz@redhat.com>
|
||||
|
||||
* POTFILES.in: Added nm-vpnc.desktop.in
|
||||
|
||||
* da.po: Updated danish translations
|
||||
|
||||
2005-06-16 David Zeuthen <davidz@redhat.com>
|
||||
|
||||
* da.po: Updated danish translations
|
||||
|
||||
10
vpn-daemons/pptp/po/POTFILES.in
Normal file
10
vpn-daemons/pptp/po/POTFILES.in
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# List of source files containing translatable strings.
|
||||
# Please keep this file sorted alphabetically.
|
||||
auth-dialog/gnome-two-password-dialog.c
|
||||
auth-dialog/main.c
|
||||
nm-pptp.desktop.in
|
||||
properties/nm-pptp.c
|
||||
properties/nm-pptp-dialog.glade
|
||||
src/nm-pptp-service.c
|
||||
src/nm-pptp-service-pptp-helper.c
|
||||
|
||||
233
vpn-daemons/pptp/po/da.po
Normal file
233
vpn-daemons/pptp/po/da.po
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
# Danish translation of NetworkManager-vpnc.
|
||||
# Copyright (C) 2005 Dan Williams <dcbw@redhat.com>, David Zeuthen <davidz@redhat.com>
|
||||
# This file is distributed under the same license as the NetworkManager-vpnc package.
|
||||
# David Zeuthen <davidz@redhat.com>, 2005
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: NetworkManager-vpnc\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-06-16 23:50-0400\n"
|
||||
"PO-Revision-Date: 2005-06-11 23:21-0400\n"
|
||||
"Last-Translator: David Zeuthen <davidz@redhat.com>\n"
|
||||
"Language-Team: Danish <dansk@klid.dk>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
|
||||
#: ../auth-dialog/gnome-two-password-dialog.c:147
|
||||
msgid "_Secondary Password:"
|
||||
msgstr "_Sekundær Nøgle:"
|
||||
|
||||
#: ../auth-dialog/gnome-two-password-dialog.c:268
|
||||
msgid "_Username:"
|
||||
msgstr "_Brugernavn:"
|
||||
|
||||
#: ../auth-dialog/gnome-two-password-dialog.c:270
|
||||
msgid "_Domain:"
|
||||
msgstr "_Domæne:"
|
||||
|
||||
#: ../auth-dialog/gnome-two-password-dialog.c:272
|
||||
msgid "_Password:"
|
||||
msgstr "_Nøgle:"
|
||||
|
||||
#: ../auth-dialog/gnome-two-password-dialog.c:355
|
||||
msgid "Connect _anonymously"
|
||||
msgstr "Tilslut _anonymt"
|
||||
|
||||
#: ../auth-dialog/gnome-two-password-dialog.c:360
|
||||
msgid "Connect as _user:"
|
||||
msgstr "Tilslut som _bruger:"
|
||||
|
||||
#: ../auth-dialog/gnome-two-password-dialog.c:466
|
||||
msgid "Remember password for this session"
|
||||
msgstr "Husk adgangskode for denne session"
|
||||
|
||||
#: ../auth-dialog/gnome-two-password-dialog.c:468
|
||||
msgid "Save password in keyring"
|
||||
msgstr "Gem adgangskode i nøglering"
|
||||
|
||||
#: ../auth-dialog/main.c:161
|
||||
#, c-format
|
||||
msgid "You need to authenticate to access the Virtual Private Network '%s'."
|
||||
msgstr ""
|
||||
"Brugerverifikation er påkrævet for at tilslutte til det private netværk '%s'."
|
||||
|
||||
#: ../auth-dialog/main.c:162
|
||||
msgid "Authenticate VPN"
|
||||
msgstr "Brugerverifikation til privat netværk"
|
||||
|
||||
#: ../auth-dialog/main.c:169
|
||||
msgid "_Group Password:"
|
||||
msgstr "_Gruppe nøgle:"
|
||||
|
||||
#
|
||||
#: ../nm-vpnc.desktop.in.h:1
|
||||
msgid "VPN Connection Manager (vpnc)"
|
||||
msgstr "VPN forbindelser (vpnc)"
|
||||
|
||||
#: ../properties/nm-vpnc.c:83
|
||||
msgid "Compatible Cisco VPN client (vpnc)"
|
||||
msgstr "Kompatibel Cisco VPN klient (vpnc)"
|
||||
|
||||
#: ../properties/nm-vpnc.c:448
|
||||
#, c-format
|
||||
msgid "\tUsername: %s\n"
|
||||
msgstr "\tBrugernavn: %s\n"
|
||||
|
||||
#: ../properties/nm-vpnc.c:449
|
||||
#, c-format
|
||||
msgid "\tRoutes: %s\n"
|
||||
msgstr "\tRuter: %s\n"
|
||||
|
||||
#: ../properties/nm-vpnc.c:450
|
||||
#, c-format
|
||||
msgid "\tDomain: %s\n"
|
||||
msgstr "\tDomæne: %s\n"
|
||||
|
||||
#: ../properties/nm-vpnc.c:453
|
||||
#, c-format
|
||||
msgid ""
|
||||
"The following vpnc VPN connection will be created:\n"
|
||||
"\n"
|
||||
"\tName: %s\n"
|
||||
"\n"
|
||||
"\tGateway: %s\n"
|
||||
"\tGroup Name: %s\n"
|
||||
"%s%s%s\n"
|
||||
"The connection details can be changed using the \"Edit\" button.\n"
|
||||
msgstr ""
|
||||
"Flg. private netværks forbindelse via vpnc vil blive oprettet:\n"
|
||||
"\n"
|
||||
"\tNavn: %s\n"
|
||||
"\n"
|
||||
"\tKnudepunkt: %s\n"
|
||||
"\tGruppe navn: %s\n"
|
||||
"%s%s%s\n"
|
||||
"Detaljer for forbindelsen kan senere redigeres vha. \"Redigér\" knappen\n"
|
||||
|
||||
#: ../properties/nm-vpnc.c:545
|
||||
msgid "TCP tunneling not supported"
|
||||
msgstr ""
|
||||
|
||||
#: ../properties/nm-vpnc.c:547
|
||||
#, c-format
|
||||
msgid ""
|
||||
"The VPN settings file '%s' specifies that VPN traffic should be tunneled "
|
||||
"through TCP which is currently not supported in the vpnc software.\n"
|
||||
"\n"
|
||||
"The connection can still be created, with TCP tunneling disabled, however it "
|
||||
"may not work as expected."
|
||||
msgstr ""
|
||||
|
||||
#: ../properties/nm-vpnc.c:571
|
||||
msgid "Cannot import settings"
|
||||
msgstr ""
|
||||
|
||||
#: ../properties/nm-vpnc.c:573
|
||||
#, c-format
|
||||
msgid "The VPN settings file '%s' does not contain valid data."
|
||||
msgstr ""
|
||||
|
||||
#: ../properties/nm-vpnc.c:590
|
||||
msgid "Select file to import"
|
||||
msgstr "Vælg fil der skal importeres"
|
||||
|
||||
#: ../properties/nm-vpnc.c:745
|
||||
msgid "Save as..."
|
||||
msgstr ""
|
||||
|
||||
#: ../properties/nm-vpnc.c:775
|
||||
#, c-format
|
||||
msgid "A file named \"%s\" already exists."
|
||||
msgstr ""
|
||||
|
||||
#: ../properties/nm-vpnc.c:778
|
||||
msgid "Do you want to replace it with the one you are saving?"
|
||||
msgstr ""
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:1
|
||||
msgid "<b>Connection Name</b>"
|
||||
msgstr "<b>Navn på forbindelse</b>"
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:2
|
||||
msgid "<b>Optional Information</b>"
|
||||
msgstr "<b>Andre oplysninger</b>"
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:3
|
||||
msgid "<b>Required Information</b>"
|
||||
msgstr "<b>Påkrævede oplysninger</b>"
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:4
|
||||
msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>"
|
||||
msgstr "<i>eksempel: 172.16.0.0/16 10.11.12.0/24</i>"
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:5
|
||||
msgid "Gateway:"
|
||||
msgstr "Adgangspunkt:"
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:6
|
||||
msgid "Group Name:"
|
||||
msgstr "Gruppe navn:"
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:7
|
||||
msgid ""
|
||||
"Name used to identify the connection to the private network, e.g. \"Campus "
|
||||
"VPN\" or \"Corporate Network\""
|
||||
msgstr ""
|
||||
"Navn brugt til at identificere forbindelsen til det private netværk, f.eks. "
|
||||
"\"Universitets Privat Netværk\" eller \"Arbejds Privat Netværk\""
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:8
|
||||
msgid "Only use VPN connection for these addresses"
|
||||
msgstr "Brug kun det private netværk til flg. adresser"
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:9
|
||||
msgid "Override user name"
|
||||
msgstr "Overskriv brugernavn"
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:10
|
||||
msgid ""
|
||||
"Please enter the information provided by your system administrator below. Do "
|
||||
"not enter your password here as you will be prompted when connecting."
|
||||
msgstr ""
|
||||
"Indtast oplysninger fra din systemadministrator nedenfor. Du skal ikke "
|
||||
"indtaste din nøgle her da du bliver spurgt om den ved forbindelse."
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:11
|
||||
msgid "Use domain for authentication"
|
||||
msgstr "Brug domæne til brugerverifikation"
|
||||
|
||||
#: ../properties/nm-vpnc-dialog.glade.h:12
|
||||
msgid "_Import..."
|
||||
msgstr "_Importér..."
|
||||
|
||||
#: ../src/nm-vpnc-service.c:115
|
||||
msgid ""
|
||||
"The VPN login failed because the user name and password were not accepted."
|
||||
msgstr "VPN-tjenesten fejlede fordi brugernavn og nøgle blev afvist."
|
||||
|
||||
#: ../src/nm-vpnc-service.c:117
|
||||
msgid "The VPN login failed because the VPN program could not be started."
|
||||
msgstr "VPN-tjenesten fejlede fordi VPN programmet ikke kunne starte."
|
||||
|
||||
#: ../src/nm-vpnc-service.c:119
|
||||
msgid ""
|
||||
"The VPN login failed because the VPN program could not connect to the VPN "
|
||||
"server."
|
||||
msgstr ""
|
||||
"VPN-tjenesten fejlede fordi VPN programmet ikke kunne forbinde tilVPN "
|
||||
"knudepunktet"
|
||||
|
||||
#: ../src/nm-vpnc-service.c:121
|
||||
msgid ""
|
||||
"The VPN login failed because the VPN configuration options were invalid."
|
||||
msgstr "VPN-tjenesten fejlede fordi VPN indstillingerne var ugyldige."
|
||||
|
||||
#: ../src/nm-vpnc-service.c:123
|
||||
msgid ""
|
||||
"The VPN login failed because the VPN program received an invalid "
|
||||
"configuration from the VPN server."
|
||||
msgstr ""
|
||||
"VPN-tjenesten fejlede fordi VPN programmet modtog ugyldige indstillingen fra "
|
||||
"VPN værts-maskinen"
|
||||
246
vpn-daemons/pptp/po/sv.po
Normal file
246
vpn-daemons/pptp/po/sv.po
Normal file
|
|
@ -0,0 +1,246 @@
|
|||
# Swedish messages for NetworkManager.
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
# Christian Rose <menthos@menthos.com>, 2004, 2005.
|
||||
#
|
||||
# $Id: sv.po,v 1.1 2005/12/21 21:50:06 ajmee Exp $
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: NetworkManager-vpnc\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2005-06-26 01:20+0200\n"
|
||||
"PO-Revision-Date: 2005-06-26 01:20+0200\n"
|
||||
"Last-Translator: Christian Rose <menthos@menthos.com>\n"
|
||||
"Language-Team: Swedish <sv@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/gnome-two-password-dialog.c:147
|
||||
msgid "_Secondary Password:"
|
||||
msgstr "_Andrahandslösenord:"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/gnome-two-password-dialog.c:268
|
||||
msgid "_Username:"
|
||||
msgstr "_Användarnamn:"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/gnome-two-password-dialog.c:270
|
||||
msgid "_Domain:"
|
||||
msgstr "_Domän:"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/gnome-two-password-dialog.c:272
|
||||
msgid "_Password:"
|
||||
msgstr "_Lösenord:"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/gnome-two-password-dialog.c:355
|
||||
msgid "Connect _anonymously"
|
||||
msgstr "Anslut anon_ymt"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/gnome-two-password-dialog.c:360
|
||||
msgid "Connect as _user:"
|
||||
msgstr "Anslut som _användare:"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/gnome-two-password-dialog.c:466
|
||||
msgid "Remember password for this session"
|
||||
msgstr "Kom ihåg lösenordet för denna session"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/gnome-two-password-dialog.c:468
|
||||
msgid "Save password in keyring"
|
||||
msgstr "Spara lösenordet i nyckelring"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/main.c:161
|
||||
#, c-format
|
||||
msgid "You need to authenticate to access the Virtual Private Network '%s'."
|
||||
msgstr "Du måsta autentisera för att komma åt VPN-nätverket \"%s\"."
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/main.c:162
|
||||
msgid "Authenticate VPN"
|
||||
msgstr "Autentisera VPN"
|
||||
|
||||
#: vpn-daemons/vpnc/auth-dialog/main.c:169
|
||||
msgid "_Group Password:"
|
||||
msgstr "_Grupplösenord:"
|
||||
|
||||
#: vpn-daemons/vpnc/nm-vpnc.desktop.in.h:1
|
||||
msgid "VPN Connection Manager (vpnc)"
|
||||
msgstr "VPN-anslutningshanterare (vpnc)"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:1
|
||||
msgid "<b>Connection Name</b>"
|
||||
msgstr "<b>Anslutningsnamn</b>"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:2
|
||||
msgid "<b>Optional Information</b>"
|
||||
msgstr "<b>Valfri information</b>"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:3
|
||||
msgid "<b>Required Information</b>"
|
||||
msgstr "<b>Nödvändig information</b>"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:4
|
||||
msgid "<i>example: 172.16.0.0/16 10.11.12.0/24</i>"
|
||||
msgstr "<i>exempel: 172.16.0.0/16 10.11.12.0/24</i>"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:5
|
||||
msgid "Gateway:"
|
||||
msgstr "Gateway:"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:6
|
||||
msgid "Group Name:"
|
||||
msgstr "Gruppnamn:"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:7
|
||||
msgid ""
|
||||
"Name used to identify the connection to the private network, e.g. \"Campus "
|
||||
"VPN\" or \"Corporate Network\""
|
||||
msgstr ""
|
||||
"Namn som används för att identifiera anslutningen till det privata "
|
||||
"nätverket, exempelvis \"Campus-VPN\" eller \"Företagsnätverket\""
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:8
|
||||
msgid "Only use VPN connection for these addresses"
|
||||
msgstr "Använd endast VPN-anslutning för dessa adresser"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:9
|
||||
msgid "Override user name"
|
||||
msgstr "Åsidosätt användarnamn"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:10
|
||||
msgid ""
|
||||
"Please enter the information provided by your system administrator below. Do "
|
||||
"not enter your password here as you will be prompted when connecting."
|
||||
msgstr ""
|
||||
"Ange den information som har tillhandahållits av din systemadministratör "
|
||||
"nedan. Ange inte lösenordet här eftersom du kommer att efterfrågas det när "
|
||||
"du ansluter."
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:11
|
||||
msgid "Use domain for authentication"
|
||||
msgstr "Använd domän för autentisering"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc-dialog.glade.h:12
|
||||
msgid "_Import..."
|
||||
msgstr "_Importera..."
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:83
|
||||
msgid "Compatible Cisco VPN client (vpnc)"
|
||||
msgstr "Kompatibel Cisco VPN-klient (vpnc)"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:448
|
||||
#, c-format
|
||||
msgid "\tUsername: %s\n"
|
||||
msgstr "\tAnvändarnamn: %s\n"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:449
|
||||
#, c-format
|
||||
msgid "\tRoutes: %s\n"
|
||||
msgstr "\tVägar: %s\n"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:450
|
||||
#, c-format
|
||||
msgid "\tDomain: %s\n"
|
||||
msgstr "\tDomän: %s\n"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:453
|
||||
#, c-format
|
||||
msgid ""
|
||||
"The following vpnc VPN connection will be created:\n"
|
||||
"\n"
|
||||
"\tName: %s\n"
|
||||
"\n"
|
||||
"\tGateway: %s\n"
|
||||
"\tGroup Name: %s\n"
|
||||
"%s%s%s\n"
|
||||
"The connection details can be changed using the \"Edit\" button.\n"
|
||||
msgstr ""
|
||||
"Följande vpnc-VPN-anslutning kommer att skapas:\n"
|
||||
"\n"
|
||||
"\tNamn: %s\n"
|
||||
"\n"
|
||||
"\tGateway: %s\n"
|
||||
"\tGruppnamn: %s\n"
|
||||
"%s%s%s\n"
|
||||
"Anslutningsdetaljerna kan ändras genom att använda knappen \"Redigera\".\n"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:544
|
||||
msgid "TCP tunneling not supported"
|
||||
msgstr "TCP-tunnling stöds inte"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:546
|
||||
#, c-format
|
||||
msgid ""
|
||||
"The VPN settings file '%s' specifies that VPN traffic should be tunneled "
|
||||
"through TCP which is currently not supported in the vpnc software.\n"
|
||||
"\n"
|
||||
"The connection can still be created, with TCP tunneling disabled, however it "
|
||||
"may not work as expected."
|
||||
msgstr ""
|
||||
"VPN-inställningsfilen \"%s\" anger att VPN-trafiken ska tunnlas genom TCP "
|
||||
"vilket för tillfället inte stöds i vpnc-programvaran.\n"
|
||||
"\n"
|
||||
"Anslutningen kan fortfarande skapas, med inaktiverad TCP-tunnling, men det "
|
||||
"kanske inte fungerar som väntat."
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:570
|
||||
msgid "Cannot import settings"
|
||||
msgstr "Kan inte importera inställningar"
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:572
|
||||
#, c-format
|
||||
msgid "The VPN settings file '%s' does not contain valid data."
|
||||
msgstr "VPN-inställningsfilen \"%s\" innehåller inte giltiga data."
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:589
|
||||
msgid "Select file to import"
|
||||
msgstr "Välj fil att importera"
|
||||
|
||||
#. printf ("in impl_export\n");
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:744
|
||||
msgid "Save as..."
|
||||
msgstr "Spara som..."
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:774
|
||||
#, c-format
|
||||
msgid "A file named \"%s\" already exists."
|
||||
msgstr "En fil med namnet \"%s\" finns redan."
|
||||
|
||||
#: vpn-daemons/vpnc/properties/nm-vpnc.c:777
|
||||
msgid "Do you want to replace it with the one you are saving?"
|
||||
msgstr "Vill du ersätta den med den du håller på att spara?"
|
||||
|
||||
#: vpn-daemons/vpnc/src/nm-vpnc-service.c:115
|
||||
msgid ""
|
||||
"The VPN login failed because the user name and password were not accepted."
|
||||
msgstr ""
|
||||
"VPN-inloggningen misslyckades eftersom användarnamnet och lösenordet inte "
|
||||
"accepterades."
|
||||
|
||||
#: vpn-daemons/vpnc/src/nm-vpnc-service.c:117
|
||||
msgid "The VPN login failed because the VPN program could not be started."
|
||||
msgstr ""
|
||||
"VPN-inloggningen misslyckades eftersom VPN-programmet inte kunde startas."
|
||||
|
||||
#: vpn-daemons/vpnc/src/nm-vpnc-service.c:119
|
||||
msgid ""
|
||||
"The VPN login failed because the VPN program could not connect to the VPN "
|
||||
"server."
|
||||
msgstr ""
|
||||
"VPN-inloggningen misslyckades eftersom VPN-programmet inte kunde ansluta "
|
||||
"till VPN-servern."
|
||||
|
||||
#: vpn-daemons/vpnc/src/nm-vpnc-service.c:121
|
||||
msgid ""
|
||||
"The VPN login failed because the VPN configuration options were invalid."
|
||||
msgstr ""
|
||||
"VPN-inloggningen misslyckades eftersom VPN-konfigurationsalternativen var "
|
||||
"ogiltiga."
|
||||
|
||||
#: vpn-daemons/vpnc/src/nm-vpnc-service.c:123
|
||||
msgid ""
|
||||
"The VPN login failed because the VPN program received an invalid "
|
||||
"configuration from the VPN server."
|
||||
msgstr ""
|
||||
"VPN-inloggningen misslyckades eftersom VPN-programmet mottog en ogiltig "
|
||||
"konfiguration från VPN-servern."
|
||||
|
||||
2
vpn-daemons/pptp/properties/.cvsignore
Normal file
2
vpn-daemons/pptp/properties/.cvsignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Makefile.in
|
||||
Makefile
|
||||
33
vpn-daemons/pptp/properties/Makefile.am
Normal file
33
vpn-daemons/pptp/properties/Makefile.am
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
|
||||
lib_LTLIBRARIES = libnm-pptp-properties.la
|
||||
|
||||
libnm_pptp_properties_la_SOURCES = \
|
||||
nm-pptp.c
|
||||
|
||||
gladedir = $(datadir)/gnome-vpn-properties/pptp
|
||||
glade_DATA = nm-pptp-dialog.glade
|
||||
|
||||
libnm_pptp_properties_la_CFLAGS = \
|
||||
$(GLADE_CFLAGS) \
|
||||
$(GTK_CFLAGS) \
|
||||
$(GCONF_CFLAGS) \
|
||||
$(LIBGNOMEUI_CFLAGS) \
|
||||
-DICONDIR=\""$(datadir)/pixmaps"\" \
|
||||
-DGLADEDIR=\""$(gladedir)"\" \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DGDK_DISABLE_DEPRECATED \
|
||||
-DGNOME_DISABLE_DEPRECATED \
|
||||
-DGNOMELOCALEDIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
|
||||
-DVERSION=\"$(VERSION)\"
|
||||
|
||||
libnm_pptp_properties_la_LIBADD = \
|
||||
$(GLADE_LIBS) \
|
||||
$(GTK_LIBS) \
|
||||
$(GCONF_LIBS) \
|
||||
$(LIBGNOMEUI_LIBS)
|
||||
|
||||
CLEANFILES = *.bak *.gladep *~
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(glade_DATA)
|
||||
778
vpn-daemons/pptp/properties/nm-pptp-dialog.glade
Normal file
778
vpn-daemons/pptp/properties/nm-pptp-dialog.glade
Normal file
|
|
@ -0,0 +1,778 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
<requires lib="gnome"/>
|
||||
|
||||
<widget class="GtkWindow" id="nm-pptp-widget-window">
|
||||
<property name="title" translatable="yes"></property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</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_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="nm-pptp-widget">
|
||||
<property name="border_width">12</property>
|
||||
<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">Please enter the information provided by your system administrator below. Do not enter your password here as you will be prompted when connecting.</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</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">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<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"><b>Connection Name</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</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">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label"></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">12</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="vbox3">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Name used to identify the connection to the private network, e.g. "Campus VPN" or "Corporate Network"</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="use_markup">False</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">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox5">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label12">
|
||||
<property name="visible">True</property>
|
||||
<property name="label"></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">12</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="GtkEntry" id="pptp-connection-name">
|
||||
<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="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>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox9">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label28">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Required Information</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</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="GtkVBox" id="vbox10">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox17">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="nm-pptp-label-gateway">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Gateway:</property>
|
||||
<property name="use_underline">True</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">1</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="mnemonic_widget">pptp-remote</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="pptp-remote">
|
||||
<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="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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notebook1">
|
||||
<property name="border_width">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_tabs">True</property>
|
||||
<property name="show_border">True</property>
|
||||
<property name="tab_pos">GTK_POS_TOP</property>
|
||||
<property name="scrollable">False</property>
|
||||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label"></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">12</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="GtkTable" id="table1">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">1</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">12</property>
|
||||
<property name="column_spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label17">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Username:</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">1</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<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="pptp-username">
|
||||
<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>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label32">
|
||||
<property name="visible">True</property>
|
||||
<property name="label"></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">12</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>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label33">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Your password must be defined
|
||||
in /etc/ppp/chap-secrets</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">True</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>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label29">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">MS CHAP-v1/v2</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="type">tab</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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkExpander" id="pptp-optional-information-expander">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="expanded">True</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox12">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label22">
|
||||
<property name="visible">True</property>
|
||||
<property name="label"></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">12</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="vbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="pptp-use-routes">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">_Only use VPN connection for these addresses</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="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox15">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label25">
|
||||
<property name="visible">True</property>
|
||||
<property name="label"></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">12</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="vbox7">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">6</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label26">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><i>example: 172.16.0.0/16 10.11.12.0/24</i></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</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">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="pptp-routes">
|
||||
<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="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>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="pptp-use-mppc">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Use MPPC compression</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="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="pptp-use-mppe">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Require MPPE encryption</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="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</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>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="pptp-import-button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">0</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox7">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">2</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-add</property>
|
||||
<property name="icon_size">4</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="GtkLabel" id="label15">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">_Import Saved Configuration...</property>
|
||||
<property name="use_underline">True</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>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</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>
|
||||
749
vpn-daemons/pptp/properties/nm-pptp.c
Normal file
749
vpn-daemons/pptp/properties/nm-pptp.c
Normal file
|
|
@ -0,0 +1,749 @@
|
|||
/***************************************************************************
|
||||
* CVSID: $Id$
|
||||
*
|
||||
* nm-pptp.c : GNOME UI dialogs for configuring PPTP connections
|
||||
*
|
||||
* Copyright (C) 2005 Antony Mee <A.J.Mee@ncl.ac.uk>
|
||||
* Based on work by Tim Niemueller <tim@niemueller.de>
|
||||
* and David Zeuthen, <davidz@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
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <string.h>
|
||||
#include <glade/glade.h>
|
||||
|
||||
#define NM_VPN_API_SUBJECT_TO_CHANGE
|
||||
|
||||
#include <NetworkManager/nm-vpn-ui-interface.h>
|
||||
|
||||
typedef struct _NetworkManagerVpnUIImpl NetworkManagerVpnUIImpl;
|
||||
|
||||
|
||||
struct _NetworkManagerVpnUIImpl {
|
||||
NetworkManagerVpnUI parent;
|
||||
|
||||
NetworkManagerVpnUIDialogValidityCallback callback;
|
||||
gpointer callback_user_data;
|
||||
|
||||
GladeXML *xml;
|
||||
|
||||
GtkWidget *widget;
|
||||
|
||||
GtkEntry *w_connection_name;
|
||||
GtkEntry *w_remote;
|
||||
GtkEntry *w_username;
|
||||
GtkCheckButton *w_use_routes;
|
||||
GtkEntry *w_routes;
|
||||
GtkCheckButton *w_use_mppe;
|
||||
GtkCheckButton *w_use_mppc;
|
||||
GtkExpander *w_opt_info_expander;
|
||||
GtkButton *w_import_button;
|
||||
};
|
||||
|
||||
static void
|
||||
pptp_clear_widget (NetworkManagerVpnUIImpl *impl)
|
||||
{
|
||||
gtk_entry_set_text (impl->w_connection_name, "");
|
||||
gtk_entry_set_text (impl->w_remote, "");
|
||||
gtk_entry_set_text (impl->w_username, "");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_routes), FALSE);
|
||||
gtk_entry_set_text (impl->w_routes, "");
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_routes), FALSE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_mppe), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_mppc), TRUE);
|
||||
gtk_expander_set_expanded (impl->w_opt_info_expander, FALSE);
|
||||
}
|
||||
|
||||
static const char *
|
||||
impl_get_display_name (NetworkManagerVpnUI *self)
|
||||
{
|
||||
return _("PPTP Client");
|
||||
}
|
||||
|
||||
static const char *
|
||||
impl_get_service_name (NetworkManagerVpnUI *self)
|
||||
{
|
||||
return "org.freedesktop.NetworkManager.pptp";
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
impl_get_widget (NetworkManagerVpnUI *self, GSList *properties, GSList *routes, const char *connection_name)
|
||||
{
|
||||
GSList *i;
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data;
|
||||
gboolean should_expand;
|
||||
|
||||
pptp_clear_widget (impl);
|
||||
|
||||
should_expand = FALSE;
|
||||
|
||||
if (connection_name != NULL)
|
||||
gtk_entry_set_text (impl->w_connection_name, connection_name);
|
||||
|
||||
for (i = properties; i != NULL && g_slist_next (i) != NULL; i = g_slist_next (g_slist_next (i))) {
|
||||
const char *key;
|
||||
const char *value;
|
||||
|
||||
key = i->data;
|
||||
value = (g_slist_next (i))->data;
|
||||
|
||||
if (strcmp (key, "remote") == 0) {
|
||||
gtk_entry_set_text (impl->w_remote, value);
|
||||
} else if (strcmp (key, "username") == 0) {
|
||||
gtk_entry_set_text (impl->w_username, value);
|
||||
} else if ( (strcmp (key, "comp-mppc") == 0) &&
|
||||
(strcmp (value, "yes")) ) {
|
||||
//gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_mppc), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_routes), TRUE);
|
||||
should_expand = TRUE;
|
||||
} else if ( (strcmp (key, "comp-mppe") == 0) &&
|
||||
(strcmp (value, "yes")) ) {
|
||||
//gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_mppe), TRUE);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_routes), TRUE);
|
||||
should_expand = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (routes != NULL) {
|
||||
GString *route_str;
|
||||
char *str;
|
||||
|
||||
route_str = g_string_new ("");
|
||||
for (i = routes; i != NULL; i = g_slist_next (i)) {
|
||||
const char *route;
|
||||
|
||||
if (i != routes)
|
||||
g_string_append_c(route_str, ' ');
|
||||
|
||||
route = (const char *) i->data;
|
||||
g_string_append(route_str, route);
|
||||
}
|
||||
|
||||
str = g_string_free (route_str, FALSE);
|
||||
gtk_entry_set_text (impl->w_routes, str);
|
||||
g_free (str);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_routes), TRUE);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_routes), TRUE);
|
||||
|
||||
should_expand = TRUE;
|
||||
}
|
||||
|
||||
gtk_expander_set_expanded (impl->w_opt_info_expander, should_expand);
|
||||
gtk_container_resize_children (GTK_CONTAINER (impl->widget));
|
||||
|
||||
return impl->widget;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
impl_get_properties (NetworkManagerVpnUI *self)
|
||||
{
|
||||
GSList *data;
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data;
|
||||
const char *connectionname;
|
||||
const char *remote;
|
||||
const char *username;
|
||||
gboolean use_mppc;
|
||||
gboolean use_mppe;
|
||||
|
||||
connectionname = gtk_entry_get_text (impl->w_connection_name);
|
||||
remote = gtk_entry_get_text (impl->w_remote);
|
||||
username = gtk_entry_get_text (impl->w_username);
|
||||
use_mppc = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_mppc));
|
||||
use_mppe = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_mppe));
|
||||
|
||||
data = NULL;
|
||||
data = g_slist_append (data, g_strdup ("remote"));
|
||||
data = g_slist_append (data, g_strdup (remote));
|
||||
data = g_slist_append (data, g_strdup ("username"));
|
||||
data = g_slist_append (data, g_strdup (username));
|
||||
data = g_slist_append (data, g_strdup ("comp-mppc"));
|
||||
data = g_slist_append (data, use_mppc ? g_strdup ("yes") : g_strdup("no"));
|
||||
data = g_slist_append (data, g_strdup ("encrypt-mppe"));
|
||||
data = g_slist_append (data, use_mppe ? g_strdup ("yes") : g_strdup("no"));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
get_routes (NetworkManagerVpnUIImpl *impl)
|
||||
{
|
||||
GSList *routes;
|
||||
const char *routes_entry;
|
||||
gboolean use_routes;
|
||||
char **substrs;
|
||||
unsigned int i;
|
||||
|
||||
routes = NULL;
|
||||
|
||||
routes_entry = gtk_entry_get_text (impl->w_routes);
|
||||
use_routes = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_routes));
|
||||
|
||||
if (!use_routes)
|
||||
goto out;
|
||||
|
||||
substrs = g_strsplit (routes_entry, " ", 0);
|
||||
for (i = 0; substrs[i] != NULL; i++) {
|
||||
char *route;
|
||||
|
||||
route = substrs[i];
|
||||
if (strlen (route) > 0)
|
||||
routes = g_slist_append (routes, g_strdup (route));
|
||||
}
|
||||
|
||||
g_strfreev (substrs);
|
||||
|
||||
out:
|
||||
return routes;
|
||||
}
|
||||
|
||||
static GSList *
|
||||
impl_get_routes (NetworkManagerVpnUI *self)
|
||||
{
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data;
|
||||
|
||||
return get_routes (impl);
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
impl_get_connection_name (NetworkManagerVpnUI *self)
|
||||
{
|
||||
const char *name;
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data;
|
||||
|
||||
name = gtk_entry_get_text (impl->w_connection_name);
|
||||
if (name != NULL)
|
||||
return g_strdup (name);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
impl_is_valid (NetworkManagerVpnUI *self)
|
||||
{
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data;
|
||||
gboolean is_valid;
|
||||
const char *connectionname;
|
||||
const char *remote;
|
||||
const char *username;
|
||||
gboolean use_routes;
|
||||
const char *routes_entry;
|
||||
|
||||
|
||||
is_valid = FALSE;
|
||||
|
||||
connectionname = gtk_entry_get_text (impl->w_connection_name);
|
||||
remote = gtk_entry_get_text (impl->w_remote);
|
||||
username = gtk_entry_get_text (impl->w_username);
|
||||
use_routes = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_routes));
|
||||
routes_entry = gtk_entry_get_text (impl->w_routes);
|
||||
|
||||
/* initial sanity checking */
|
||||
if (strlen (connectionname) > 0 &&
|
||||
strlen (remote) > 0 &&
|
||||
strlen (username) > 0 &&
|
||||
((!use_routes) || (use_routes && strlen (routes_entry) > 0)) ) {
|
||||
is_valid = TRUE;
|
||||
}
|
||||
|
||||
/* validate gateway: can be a hostname or an IP; do not allow spaces or tabs */
|
||||
if (is_valid &&
|
||||
( (strstr (remote, " ") != NULL) ||
|
||||
(strstr (remote, "\t") != NULL) ||
|
||||
(strstr (username, " ") != NULL) ||
|
||||
(strstr (username, "\t") != NULL) )
|
||||
) {
|
||||
is_valid = FALSE;
|
||||
}
|
||||
|
||||
/* validate routes: each entry must be of the form 'a.b.c.d/mask' */
|
||||
if (is_valid) {
|
||||
GSList *i;
|
||||
GSList *routes;
|
||||
|
||||
routes = get_routes (impl);
|
||||
|
||||
for (i = routes; i != NULL; i = g_slist_next (i)) {
|
||||
int d1, d2, d3, d4, mask;
|
||||
|
||||
const char *route = (const char *) i->data;
|
||||
//printf ("route = '%s'\n", route);
|
||||
|
||||
if (sscanf (route, "%d.%d.%d.%d/%d", &d1, &d2, &d3, &d4, &mask) != 5) {
|
||||
is_valid = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* TODO: this can be improved a bit */
|
||||
if (d1 < 0 || d1 > 255 ||
|
||||
d2 < 0 || d2 > 255 ||
|
||||
d3 < 0 || d3 > 255 ||
|
||||
d4 < 0 || d4 > 255 ||
|
||||
mask < 0 || mask > 32) {
|
||||
is_valid = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
//if (routes != NULL)
|
||||
// printf ("\n");
|
||||
|
||||
if (routes != NULL) {
|
||||
g_slist_foreach (routes, (GFunc)g_free, NULL);
|
||||
g_slist_free (routes);
|
||||
}
|
||||
}
|
||||
|
||||
return is_valid;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
use_routes_toggled (GtkToggleButton *togglebutton, gpointer user_data)
|
||||
{
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) user_data;
|
||||
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_routes),
|
||||
gtk_toggle_button_get_active (togglebutton));
|
||||
|
||||
if (impl->callback != NULL) {
|
||||
gboolean is_valid;
|
||||
|
||||
is_valid = impl_is_valid (&(impl->parent));
|
||||
impl->callback (&(impl->parent), is_valid, impl->callback_user_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
editable_changed (GtkEditable *editable, gpointer user_data)
|
||||
{
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) user_data;
|
||||
|
||||
if (impl->callback != NULL) {
|
||||
gboolean is_valid;
|
||||
|
||||
is_valid = impl_is_valid (&(impl->parent));
|
||||
impl->callback (&(impl->parent), is_valid, impl->callback_user_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
impl_set_validity_changed_callback (NetworkManagerVpnUI *self,
|
||||
NetworkManagerVpnUIDialogValidityCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data;
|
||||
|
||||
impl->callback = callback;
|
||||
impl->callback_user_data = user_data;
|
||||
}
|
||||
|
||||
static void
|
||||
impl_get_confirmation_details (NetworkManagerVpnUI *self, gchar **retval)
|
||||
{
|
||||
GString *buf;
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data;
|
||||
const char *connectionname;
|
||||
const char *remote;
|
||||
const char *username;
|
||||
gboolean use_routes;
|
||||
const char *routes;
|
||||
gboolean use_mppe;
|
||||
gboolean use_mppc;
|
||||
|
||||
connectionname = gtk_entry_get_text (impl->w_connection_name);
|
||||
remote = gtk_entry_get_text (impl->w_remote);
|
||||
username = gtk_entry_get_text (impl->w_username);
|
||||
use_routes = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_routes));
|
||||
routes = gtk_entry_get_text (impl->w_routes);
|
||||
use_mppe = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_mppe));
|
||||
use_mppc = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (impl->w_use_mppc));
|
||||
|
||||
|
||||
// This is risky, should be variable length depending on actual data!
|
||||
buf = g_string_sized_new (512);
|
||||
|
||||
g_string_append (buf, _("The following PPTP connection will be created:"));
|
||||
g_string_append (buf, "\n\n\t");
|
||||
g_string_append_printf (buf, _("Name: %s"), connectionname);
|
||||
g_string_append (buf, "\n\n\t");
|
||||
|
||||
g_string_append_printf (buf, _("Remote: %s"), remote);
|
||||
g_string_append (buf, "\n\t");
|
||||
|
||||
g_string_append_printf (buf, _("Username: %s"), username);
|
||||
|
||||
if (use_routes) {
|
||||
g_string_append (buf, "\n\t");
|
||||
g_string_append_printf (buf, _("Routes: %s"), routes);
|
||||
}
|
||||
|
||||
g_string_append (buf, "\n\t");
|
||||
g_string_append_printf( buf, _("Use MPPC Compression: %s"), ((use_mppc) ? _("Yes") : _("No")));
|
||||
g_string_append (buf, "\n\t");
|
||||
g_string_append_printf( buf, _("Use MPPE Encryption: %s"), ((use_mppe) ? _("Yes") : _("No")));
|
||||
|
||||
g_string_append (buf, "\n\n");
|
||||
g_string_append (buf, _("The connection details can be changed using the \"Edit\" button."));
|
||||
g_string_append (buf, "\n");
|
||||
|
||||
*retval = g_string_free (buf, FALSE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
import_from_file (NetworkManagerVpnUIImpl *impl, const char *path)
|
||||
{
|
||||
char *basename;
|
||||
GKeyFile *keyfile;
|
||||
gboolean file_is_good;
|
||||
|
||||
file_is_good = FALSE;
|
||||
basename = g_path_get_basename (path);
|
||||
|
||||
keyfile = g_key_file_new ();
|
||||
if (g_key_file_load_from_file (keyfile, path, 0, NULL)) {
|
||||
char *connectionname = NULL;
|
||||
char *remote = NULL;
|
||||
char *username = NULL;
|
||||
char *routes = NULL;
|
||||
char *mppc = NULL;
|
||||
char *mppe = NULL;
|
||||
gboolean should_expand;
|
||||
|
||||
connectionname = g_key_file_get_string (keyfile, "main", "Description", NULL);
|
||||
remote = g_key_file_get_string (keyfile, "main", "Remote", NULL);
|
||||
username = g_key_file_get_string (keyfile, "main", "Username", NULL);
|
||||
mppc = g_key_file_get_string (keyfile, "main", "Comp-MPPC", NULL);
|
||||
mppe = g_key_file_get_string (keyfile, "main", "Encrypt-MPPE", NULL);
|
||||
|
||||
/* may not exist */
|
||||
if ((routes = g_key_file_get_string (keyfile, "main", "X-NM-Routes", NULL)) == NULL)
|
||||
routes = g_strdup ("");
|
||||
|
||||
/* sanity check data */
|
||||
if ( ( connectionname != NULL) &&
|
||||
( remote != NULL ) &&
|
||||
( username != NULL ) &&
|
||||
(strlen(connectionname) > 0) &&
|
||||
(strlen(username) > 0) &&
|
||||
(strlen(remote) > 0) ) {
|
||||
|
||||
gtk_entry_set_text (impl->w_connection_name, connectionname);
|
||||
gtk_entry_set_text (impl->w_remote, remote);
|
||||
gtk_entry_set_text (impl->w_username, username);
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_mppc), ((mppc != NULL) && (strcmp(mppc, "yes") == 0)));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_mppe), ((mppe != NULL) && (strcmp(mppe, "yes") == 0)));
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->w_use_routes), strlen (routes) > 0);
|
||||
gtk_entry_set_text (impl->w_routes, routes);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (impl->w_routes), strlen (routes) > 0);
|
||||
|
||||
should_expand = (strlen (routes) > 0) ||
|
||||
((mppc != NULL) && (strcmp(mppc, "yes") == 0)) ||
|
||||
((mppe != NULL) && (strcmp(mppe, "yes") == 0));
|
||||
gtk_expander_set_expanded (impl->w_opt_info_expander, should_expand);
|
||||
|
||||
} else {
|
||||
g_free (connectionname);
|
||||
g_free (remote);
|
||||
g_free (username);
|
||||
g_free (mppe);
|
||||
g_free (mppc);
|
||||
}
|
||||
g_key_file_free (keyfile);
|
||||
|
||||
if (!file_is_good) {
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_CLOSE,
|
||||
_("Cannot import settings"));
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
_("The VPN settings file '%s' does not contain valid data."), basename);
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (basename);
|
||||
|
||||
return file_is_good;
|
||||
}
|
||||
|
||||
static void
|
||||
import_button_clicked (GtkButton *button, gpointer user_data)
|
||||
{
|
||||
char *filename = NULL;
|
||||
GtkWidget *dialog;
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) user_data;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new (_("Select file to import"),
|
||||
NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) {
|
||||
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
/*printf ("User selected '%s'\n", filename);*/
|
||||
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
if (filename != NULL) {
|
||||
import_from_file (impl, filename);
|
||||
g_free (filename);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
impl_can_export (NetworkManagerVpnUI *self)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
impl_import_file (NetworkManagerVpnUI *self, const char *path)
|
||||
{
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data;
|
||||
|
||||
return import_from_file (impl, path);
|
||||
}
|
||||
|
||||
static void
|
||||
export_to_file (NetworkManagerVpnUIImpl *impl, const char *path,
|
||||
GSList *properties, GSList *routes, const char *connection_name)
|
||||
{
|
||||
FILE *f;
|
||||
GSList *i;
|
||||
const char *remote = NULL;
|
||||
const char *username = NULL;
|
||||
const char *mppc = NULL;
|
||||
const char *mppe = NULL;
|
||||
char *routes_str = NULL;
|
||||
|
||||
/*printf ("in export_to_file; path='%s'\n", path);*/
|
||||
|
||||
for (i = properties; i != NULL && g_slist_next (i) != NULL; i = g_slist_next (g_slist_next (i))) {
|
||||
const char *key;
|
||||
const char *value;
|
||||
|
||||
key = i->data;
|
||||
value = (g_slist_next (i))->data;
|
||||
|
||||
if (strcmp (key, "remote") == 0) {
|
||||
remote = value;
|
||||
} else if (strcmp (key, "username") == 0) {
|
||||
username = value;
|
||||
} else if (strcmp (key, "comp-mppc") == 0) {
|
||||
mppc = value;
|
||||
} else if (strcmp (key, "encrypt-mppe") == 0) {
|
||||
mppe = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (routes != NULL) {
|
||||
GString *str;
|
||||
|
||||
str = g_string_new ("X-NM-Routes=");
|
||||
for (i = routes; i != NULL; i = g_slist_next (i)) {
|
||||
const char *route;
|
||||
|
||||
if (i != routes)
|
||||
g_string_append_c (str, ' ');
|
||||
|
||||
route = (const char *) i->data;
|
||||
g_string_append (str, route);
|
||||
}
|
||||
|
||||
g_string_append_c (str, '\n');
|
||||
|
||||
routes_str = g_string_free (str, FALSE);
|
||||
}
|
||||
|
||||
f = fopen (path, "w");
|
||||
if (f != NULL) {
|
||||
|
||||
fprintf (f,
|
||||
"[main]\n"
|
||||
"Description=%s\n"
|
||||
"Remote=%s\n"
|
||||
"Username=%s\n"
|
||||
"Comp-MPPC=%s\n"
|
||||
"Encrypt-MPPE=%s\n"
|
||||
"%s",
|
||||
/* Description */ connection_name,
|
||||
/* Host */ remote,
|
||||
/* Username */ username,
|
||||
/* Comp-MPPC */ mppc,
|
||||
/* Comp-MPPE */ mppe,
|
||||
/* X-NM-Routes */ routes_str != NULL ? routes_str : "");
|
||||
|
||||
fclose (f);
|
||||
}
|
||||
g_free (routes_str);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
impl_export (NetworkManagerVpnUI *self, GSList *properties, GSList *routes, const char *connection_name)
|
||||
{
|
||||
char *suggested_name;
|
||||
char *path = NULL;
|
||||
GtkWidget *dialog;
|
||||
NetworkManagerVpnUIImpl *impl = (NetworkManagerVpnUIImpl *) self->data;
|
||||
|
||||
/*printf ("in impl_export\n");*/
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new (_("Save as..."),
|
||||
NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
suggested_name = g_strdup_printf ("%s.pcf", connection_name);
|
||||
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggested_name);
|
||||
g_free (suggested_name);
|
||||
|
||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
|
||||
path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
/*printf ("User selected '%s'\n", path);*/
|
||||
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
if (path != NULL) {
|
||||
if (g_file_test (path, G_FILE_TEST_EXISTS)) {
|
||||
int response;
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_CANCEL,
|
||||
_("A file named \"%s\" already exists."), path);
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (dialog), "_Replace", GTK_RESPONSE_OK, NULL);
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
_("Do you want to replace it with the one you are saving?"));
|
||||
response = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
if (response == GTK_RESPONSE_OK)
|
||||
export_to_file (impl, path, properties, routes, connection_name);
|
||||
}
|
||||
}
|
||||
|
||||
g_free (path);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static NetworkManagerVpnUI*
|
||||
impl_get_object (void)
|
||||
{
|
||||
char *glade_file;
|
||||
NetworkManagerVpnUIImpl *impl;
|
||||
|
||||
impl = g_new0 (NetworkManagerVpnUIImpl, 1);
|
||||
|
||||
glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-pptp-dialog.glade");
|
||||
impl->xml = glade_xml_new (glade_file, NULL, GETTEXT_PACKAGE);
|
||||
g_free( glade_file );
|
||||
if (impl->xml != NULL) {
|
||||
|
||||
impl->widget = glade_xml_get_widget(impl->xml, "nm-pptp-widget");
|
||||
|
||||
impl->w_connection_name = GTK_ENTRY (glade_xml_get_widget (impl->xml, "pptp-connection-name"));
|
||||
impl->w_remote = GTK_ENTRY (glade_xml_get_widget (impl->xml, "pptp-remote"));
|
||||
impl->w_use_routes = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "pptp-use-routes"));
|
||||
impl->w_routes = GTK_ENTRY (glade_xml_get_widget (impl->xml, "pptp-routes"));
|
||||
impl->w_opt_info_expander = GTK_EXPANDER (glade_xml_get_widget (impl->xml,
|
||||
"pptp-optional-information-expander"));
|
||||
impl->w_import_button = GTK_BUTTON (glade_xml_get_widget (impl->xml,
|
||||
"pptp-import-button"));
|
||||
|
||||
impl->w_username = GTK_ENTRY( glade_xml_get_widget( impl->xml, "pptp-username" ) );
|
||||
|
||||
impl->w_use_mppc = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "pptp-use-mppc"));
|
||||
impl->w_use_mppe = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "pptp-use-mppe"));
|
||||
|
||||
impl->callback = NULL;
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (impl->w_use_routes),
|
||||
"toggled", GTK_SIGNAL_FUNC (use_routes_toggled), impl);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (impl->w_connection_name),
|
||||
"changed", GTK_SIGNAL_FUNC (editable_changed), impl);
|
||||
gtk_signal_connect (GTK_OBJECT (impl->w_remote),
|
||||
"changed", GTK_SIGNAL_FUNC (editable_changed), impl);
|
||||
gtk_signal_connect (GTK_OBJECT (impl->w_routes),
|
||||
"changed", GTK_SIGNAL_FUNC (editable_changed), impl);
|
||||
gtk_signal_connect (GTK_OBJECT (impl->w_username),
|
||||
"changed", GTK_SIGNAL_FUNC (editable_changed), impl);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (impl->w_import_button),
|
||||
"clicked", GTK_SIGNAL_FUNC (import_button_clicked), impl);
|
||||
|
||||
/* make the widget reusable */
|
||||
gtk_signal_connect (GTK_OBJECT (impl->widget), "delete-event",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_hide_on_delete), NULL);
|
||||
|
||||
pptp_clear_widget (impl);
|
||||
|
||||
impl->parent.get_display_name = impl_get_display_name;
|
||||
impl->parent.get_service_name = impl_get_service_name;
|
||||
impl->parent.get_widget = impl_get_widget;
|
||||
impl->parent.get_connection_name = impl_get_connection_name;
|
||||
impl->parent.get_properties = impl_get_properties;
|
||||
impl->parent.get_routes = impl_get_routes;
|
||||
impl->parent.set_validity_changed_callback = impl_set_validity_changed_callback;
|
||||
impl->parent.is_valid = impl_is_valid;
|
||||
impl->parent.get_confirmation_details = impl_get_confirmation_details;
|
||||
impl->parent.can_export = impl_can_export;
|
||||
impl->parent.import_file = impl_import_file;
|
||||
impl->parent.export = impl_export;
|
||||
impl->parent.data = impl;
|
||||
|
||||
return &(impl->parent);
|
||||
} else {
|
||||
g_free (impl);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
NetworkManagerVpnUI*
|
||||
nm_vpn_properties_factory (void)
|
||||
{
|
||||
return impl_get_object();
|
||||
}
|
||||
4
vpn-daemons/pptp/src/.cvsignore
Normal file
4
vpn-daemons/pptp/src/.cvsignore
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Makefile.in
|
||||
Makefile
|
||||
nm-pptp-service
|
||||
nm-pptp-service-pptp-helper
|
||||
42
vpn-daemons/pptp/src/Makefile.am
Normal file
42
vpn-daemons/pptp/src/Makefile.am
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
INCLUDES = -I${top_srcdir} -I${top_srcdir}/utils -I${top_srcdir}/vpn-daemons/pptp
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
$(DBUS_CFLAGS) \
|
||||
$(GTHREAD_CFLAGS) \
|
||||
-Wall \
|
||||
-DDBUS_API_SUBJECT_TO_CHANGE \
|
||||
-DG_DISABLE_DEPRECATED \
|
||||
-DBINDIR=\"$(bindir)\" \
|
||||
-DPREFIX=\""$(prefix)"\" \
|
||||
-DSYSCONFDIR=\""$(sysconfdir)"\" \
|
||||
-DVERSION="\"$(VERSION)\"" \
|
||||
-DLIBDIR=\""$(libdir)"\" \
|
||||
-DLIBEXECDIR=\""$(libexecdir)"\" \
|
||||
-DLOCALSTATEDIR=\""$(localstatedir)"\" \
|
||||
-DDATADIR=\"$(datadir)\"
|
||||
|
||||
bin_PROGRAMS = nm-pptp-service nm-pptp-service-pppd-plugin.so
|
||||
|
||||
nm_pptp_service_SOURCES = \
|
||||
nm-pptp-service.c \
|
||||
nm-pptp-service.h \
|
||||
nm-utils.c \
|
||||
nm-utils.h
|
||||
|
||||
|
||||
nm_pptp_service_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(GTHREAD_LIBS)
|
||||
|
||||
|
||||
nm_pptp_service_pppd_plugin_so_SOURCES = \
|
||||
nm-pptp-service-pppd-plugin.c
|
||||
|
||||
nm_pptp_service_pppd_plugin_so_LDFLAGS = \
|
||||
-shared
|
||||
|
||||
nm_pptp_service_pppd_plugin_so_LDADD = \
|
||||
$(DBUS_LIBS) \
|
||||
$(GTHREAD_LIBS)
|
||||
|
||||
CLEANFILES = *~
|
||||
243
vpn-daemons/pptp/src/nm-pptp-service-pppd-plugin.c
Normal file
243
vpn-daemons/pptp/src/nm-pptp-service-pppd-plugin.c
Normal file
|
|
@ -0,0 +1,243 @@
|
|||
/* nm-pptp-service - pptp integration with NetworkManager
|
||||
*
|
||||
* 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 2005 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include "pppd/pppd.h"
|
||||
#include "pppd/fsm.h"
|
||||
#include "pppd/ipcp.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <regex.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <dbus/dbus.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <NetworkManager/NetworkManager.h>
|
||||
|
||||
#include "nm-pptp-service.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
char pppd_version[] = VERSION;
|
||||
|
||||
static void pptp_ip_up(void *opaque, int arg);
|
||||
static void pptp_ip_down(void *opaque, int arg);
|
||||
int pptp_chap_passwd(char *user, char *passwd);
|
||||
static void send_config_error (DBusConnection *con, const char *item);
|
||||
|
||||
/* nm_warning ("nm-pptp-service-pptp-helper didn't receive a Tunnel Device from pptp, or the tunnel device was not valid UTF-8.");
|
||||
send_config_error (con, "Tunnel Device");
|
||||
nm_warning ("nm-pptp-service-pptp-helper didn't receive an Internal IP4 Address from pptp.");
|
||||
send_config_error (con, "IP4 Address");
|
||||
*/
|
||||
|
||||
int plugin_init()
|
||||
{
|
||||
DBusConnection * con;
|
||||
DBusError error;
|
||||
|
||||
g_type_init ();
|
||||
if (!g_thread_supported ())
|
||||
g_thread_init (NULL);
|
||||
|
||||
dbus_error_init (&error);
|
||||
con = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
|
||||
if ((con == NULL) || dbus_error_is_set (&error))
|
||||
{
|
||||
nm_warning ("Could not get the system bus. Make sure the message bus daemon is running?");
|
||||
return -1;
|
||||
}
|
||||
dbus_connection_set_exit_on_disconnect (con, FALSE);
|
||||
|
||||
// add_options(ldap_options);
|
||||
chap_passwd_hook = pptp_chap_passwd;
|
||||
|
||||
// add_notifier(&ip_down_notifier, pptp_ip_down, (void *) con);
|
||||
add_notifier(&ip_up_notifier, pptp_ip_up, (void *) con);
|
||||
|
||||
info("nm-pptp: plugin initialized.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pptp_chap_passwd(char *user, char *passwd)
|
||||
{
|
||||
memcpy(passwd, "YOUR PASSWORD IN HERE!!",MAXSECRETLEN);
|
||||
passwd[MAXSECRETLEN-1]='\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pptp_ip_down(void *opaque, int arg)
|
||||
{
|
||||
}
|
||||
|
||||
static void pptp_ip_up(void *opaque, int arg)
|
||||
{
|
||||
DBusConnection *con = (DBusConnection *)opaque;
|
||||
DBusMessage *message;
|
||||
char * str_ifname = NULL;
|
||||
// guint32 * uint_ip4_dns = NULL;
|
||||
guint32 uint_ip4_dns1 = 0;
|
||||
guint32 uint_ip4_dns2 = 0;
|
||||
guint32 uint_ip4_dns_len = 0;
|
||||
// guint32 * uint_ip4_wins = NULL;
|
||||
guint32 uint_ip4_wins1 = 0;
|
||||
guint32 uint_ip4_wins2 = 0;
|
||||
guint32 uint_ip4_wins_len = 0;
|
||||
guint32 uint_ip4_address = 0;
|
||||
guint32 uint_ip4_netmask = 0xFFFFFFFF; /* Default mask of 255.255.255.255 */
|
||||
guint32 i=0;
|
||||
|
||||
g_return_if_fail (con != NULL);
|
||||
if (ipcp_gotoptions[ifunit].ouraddr==0) {
|
||||
nm_warning ("nm-pptp-service-pptp-helper didn't receive an Internal IP4 Address from pptp.");
|
||||
send_config_error (con, "IP4 Address");
|
||||
return;
|
||||
}
|
||||
uint_ip4_address=ipcp_gotoptions[ifunit].ouraddr;
|
||||
|
||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE_PPTP, NM_DBUS_PATH_PPTP, NM_DBUS_INTERFACE_PPTP, "signalIP4Config")))
|
||||
{
|
||||
nm_warning ("send_config_error(): Couldn't allocate the dbus message");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ipcp_gotoptions[ifunit].dnsaddr) {
|
||||
if (ipcp_gotoptions[ifunit].dnsaddr[0]!=0) {
|
||||
uint_ip4_dns_len++;
|
||||
uint_ip4_dns1=ipcp_gotoptions[ifunit].dnsaddr[0];
|
||||
if (ipcp_gotoptions[ifunit].dnsaddr[1]!=0) {
|
||||
uint_ip4_dns_len++;
|
||||
uint_ip4_dns2=ipcp_gotoptions[ifunit].dnsaddr[1];
|
||||
}
|
||||
}
|
||||
// if (uint_ip4_dns_len > 0)
|
||||
// {
|
||||
// uint_ip4_dns = g_new0(guint32,uint_ip4_dns_len);
|
||||
// for (i = 0; i < uint_ip4_dns_len; ++i)
|
||||
// uint_ip4_dns[i] = ipcp_gotoptions[ifunit].dnsaddr[i];
|
||||
// }
|
||||
}
|
||||
|
||||
if (ipcp_gotoptions[ifunit].winsaddr) {
|
||||
if (ipcp_gotoptions[ifunit].winsaddr[0]!=0) {
|
||||
uint_ip4_wins_len++;
|
||||
uint_ip4_wins1=ipcp_gotoptions[ifunit].winsaddr[0];
|
||||
if (ipcp_gotoptions[ifunit].winsaddr[1]!=0) {
|
||||
uint_ip4_wins_len++;
|
||||
uint_ip4_wins2=ipcp_gotoptions[ifunit].winsaddr[1];
|
||||
}
|
||||
}
|
||||
// if (uint_ip4_wins_len > 0)
|
||||
// {
|
||||
// uint_ip4_wins = g_new0(guint32,uint_ip4_wins_len);
|
||||
// for (i = 0; i < uint_ip4_wins_len; ++i)
|
||||
// uint_ip4_wins[i] = ipcp_gotoptions[ifunit].winsaddr[i];
|
||||
// }
|
||||
}
|
||||
|
||||
if (ifname==NULL) {
|
||||
nm_warning ("nm-pptp-service-pptp-helper didn't receive a tunnel device name.");
|
||||
send_config_error (con, "IP4 Address");
|
||||
}
|
||||
str_ifname = g_strdup(ifname);
|
||||
|
||||
/* Print out some debug info.
|
||||
nm_warning("Sending config IFNAME: %s",str_ifname);
|
||||
nm_warning("Sending config IPLOCAL: %s", ip_ntoa(uint_ip4_address));
|
||||
nm_warning("Sending config NETMASK: %s", ip_ntoa(uint_ip4_netmask));
|
||||
nm_warning("Sending config DNS1: %s", ip_ntoa(uint_ip4_dns1));
|
||||
nm_warning("Sending config DNS2: %s", ip_ntoa(uint_ip4_dns2));
|
||||
nm_warning("Sending config NDNS: %d", uint_ip4_dns_len);
|
||||
nm_warning("Sending config WINS1: %s", ip_ntoa(uint_ip4_wins1));
|
||||
nm_warning("Sending config WINS2: %s", ip_ntoa(uint_ip4_wins2));
|
||||
nm_warning("Sending config NWINS: %d", uint_ip4_wins_len); */
|
||||
|
||||
dbus_message_append_args (message,
|
||||
DBUS_TYPE_STRING, &str_ifname,
|
||||
DBUS_TYPE_UINT32, &uint_ip4_address,
|
||||
DBUS_TYPE_UINT32, &uint_ip4_netmask,
|
||||
// Array workaround
|
||||
DBUS_TYPE_UINT32, &uint_ip4_dns1,
|
||||
DBUS_TYPE_UINT32, &uint_ip4_dns2,
|
||||
DBUS_TYPE_UINT32, &uint_ip4_dns_len,
|
||||
DBUS_TYPE_UINT32, &uint_ip4_wins1,
|
||||
DBUS_TYPE_UINT32, &uint_ip4_wins2,
|
||||
DBUS_TYPE_UINT32, &uint_ip4_wins_len,
|
||||
//
|
||||
// For some reason DBUS_TYPE_ARRAYs don't seem to like working inside the pppd plugin
|
||||
//
|
||||
// testing with:
|
||||
// pppd pty "/usr/sbin/pptp SOME.SERVER.IP --nolaunchpppd" nodetach remotename SOME.SERVER user MYUSER usepeerdns plugin nm-pptp-service-pppd-plugin.so
|
||||
//
|
||||
// Fails with (given pointers and allocated arrays with g_new0() ):
|
||||
// 13646: assertion failed "value != NULL" file "dbus-string.c" line 235 function _dbus_string_init_const_len
|
||||
// Fatal signal 6
|
||||
//
|
||||
// Or if fixed [2] arrays are used:
|
||||
// Fatal signal 11
|
||||
//
|
||||
// DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &uint_ip4_dns, uint_ip4_dns_len,
|
||||
// DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &uint_ip4_wins, uint_ip4_wins_len,
|
||||
DBUS_TYPE_INVALID);
|
||||
if (!dbus_connection_send (con, message, NULL)) {
|
||||
nm_warning ("pptp_ip_up(): could not send dbus message");
|
||||
dbus_message_unref (message);
|
||||
return;
|
||||
}
|
||||
|
||||
dbus_message_unref (message);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* send_config_error
|
||||
*
|
||||
* Notify nm-pptp-service of a config error from 'pptp'.
|
||||
*
|
||||
*/
|
||||
static void send_config_error (DBusConnection *con, const char *item)
|
||||
{
|
||||
DBusMessage *message;
|
||||
|
||||
g_return_if_fail (con != NULL);
|
||||
g_return_if_fail (item != NULL);
|
||||
|
||||
if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE_PPTP, NM_DBUS_PATH_PPTP, NM_DBUS_INTERFACE_PPTP, "signalConfigError")))
|
||||
{
|
||||
nm_warning ("send_config_error(): Couldn't allocate the dbus message");
|
||||
return;
|
||||
}
|
||||
|
||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &item, DBUS_TYPE_INVALID);
|
||||
if (!dbus_connection_send (con, message, NULL))
|
||||
nm_warning ("send_config_error(): could not send dbus message");
|
||||
|
||||
dbus_message_unref (message);
|
||||
}
|
||||
|
||||
|
||||
1136
vpn-daemons/pptp/src/nm-pptp-service.c
Normal file
1136
vpn-daemons/pptp/src/nm-pptp-service.c
Normal file
File diff suppressed because it is too large
Load diff
30
vpn-daemons/pptp/src/nm-pptp-service.h
Normal file
30
vpn-daemons/pptp/src/nm-pptp-service.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/* nm-pptp-service - pptp integration with NetworkManager
|
||||
*
|
||||
* Antony Mee <a.j.mee@ncl.ac.uk>
|
||||
* Based on work by Tim Niemueller <tim@niemueller.de>
|
||||
* and 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NM_PPTP_SERVICE_H
|
||||
#define NM_PPTP_SERVICE_H
|
||||
|
||||
#define NM_DBUS_SERVICE_PPTP "org.freedesktop.NetworkManager.pptp"
|
||||
#define NM_DBUS_INTERFACE_PPTP "org.freedesktop.NetworkManager.pptp"
|
||||
#define NM_DBUS_PATH_PPTP "/org/freedesktop/NetworkManager/pptp"
|
||||
|
||||
#endif
|
||||
132
vpn-daemons/pptp/src/nm-utils.c
Normal file
132
vpn-daemons/pptp/src/nm-utils.c
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* Ray Strode <rstrode@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 2005 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include "nm-utils.h"
|
||||
|
||||
gchar *nm_dbus_escape_object_path (const gchar *utf8_string)
|
||||
{
|
||||
const gchar *p;
|
||||
gchar *object_path;
|
||||
GString *string;
|
||||
|
||||
g_return_val_if_fail (utf8_string != NULL, NULL);
|
||||
g_return_val_if_fail (g_utf8_validate (utf8_string, -1, NULL), NULL);
|
||||
|
||||
string = g_string_sized_new ((strlen (utf8_string) + 1) * 6);
|
||||
|
||||
for (p = utf8_string; *p != '\0'; p = g_utf8_next_char (p))
|
||||
{
|
||||
gunichar character;
|
||||
|
||||
character = g_utf8_get_char (p);
|
||||
|
||||
if (((character >= ((gunichar) 'a')) &&
|
||||
(character <= ((gunichar) 'z'))) ||
|
||||
((character >= ((gunichar) 'A')) &&
|
||||
(character <= ((gunichar) 'Z'))) ||
|
||||
((character >= ((gunichar) '0')) &&
|
||||
(character <= ((gunichar) '9'))) ||
|
||||
(character == ((gunichar) '/')))
|
||||
{
|
||||
g_string_append_c (string, (gchar) character);
|
||||
continue;
|
||||
}
|
||||
|
||||
g_string_append_printf (string, "_%x_", character);
|
||||
}
|
||||
|
||||
object_path = string->str;
|
||||
|
||||
g_string_free (string, FALSE);
|
||||
|
||||
return object_path;
|
||||
}
|
||||
|
||||
gchar *nm_dbus_unescape_object_path (const gchar *object_path)
|
||||
{
|
||||
const gchar *p;
|
||||
gchar *utf8_string;
|
||||
GString *string;
|
||||
|
||||
g_return_val_if_fail (object_path != NULL, NULL);
|
||||
|
||||
string = g_string_sized_new (strlen (object_path) + 1);
|
||||
|
||||
for (p = object_path; *p != '\0'; p++)
|
||||
{
|
||||
const gchar *q;
|
||||
gchar *hex_digits, *end, utf8_character[6] = { '\0' };
|
||||
gint utf8_character_size;
|
||||
gunichar character;
|
||||
gulong hex_value;
|
||||
|
||||
if (*p != '_')
|
||||
{
|
||||
g_string_append_c (string, *p);
|
||||
continue;
|
||||
}
|
||||
|
||||
q = strchr (p + 1, '_');
|
||||
|
||||
if ((q == NULL) || (q == p + 1))
|
||||
{
|
||||
g_string_free (string, TRUE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
hex_digits = g_strndup (p + 1, (q - 1) - p);
|
||||
|
||||
hex_value = strtoul (hex_digits, &end, 16);
|
||||
|
||||
character = (gunichar) hex_value;
|
||||
|
||||
if (((hex_value == G_MAXLONG) && (errno == ERANGE)) ||
|
||||
(hex_value > G_MAXUINT32) ||
|
||||
(*end != '\0') ||
|
||||
(!g_unichar_validate (character)))
|
||||
{
|
||||
g_free (hex_digits);
|
||||
g_string_free (string, TRUE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
utf8_character_size =
|
||||
g_unichar_to_utf8 (character, utf8_character);
|
||||
|
||||
g_assert (utf8_character_size > 0);
|
||||
|
||||
g_string_append_len (string, utf8_character,
|
||||
utf8_character_size);
|
||||
|
||||
p = q;
|
||||
}
|
||||
|
||||
utf8_string = string->str;
|
||||
|
||||
g_string_free (string, FALSE);
|
||||
|
||||
return utf8_string;
|
||||
}
|
||||
131
vpn-daemons/pptp/src/nm-utils.h
Normal file
131
vpn-daemons/pptp/src/nm-utils.h
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
/* NetworkManager -- Network link manager
|
||||
*
|
||||
* Ray Strode <rstrode@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 2005 Red Hat, Inc.
|
||||
*/
|
||||
|
||||
#ifndef NM_UTILS_H
|
||||
#define NM_UTILS_H
|
||||
|
||||
#include <glib.h>
|
||||
#include <execinfo.h>
|
||||
|
||||
#define nm_print_backtrace() \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
void *_call_stack[512]; \
|
||||
int _call_stack_size; \
|
||||
char **_symbols; \
|
||||
_call_stack_size = backtrace (_call_stack, \
|
||||
G_N_ELEMENTS (_call_stack)); \
|
||||
_symbols = backtrace_symbols (_call_stack, _call_stack_size); \
|
||||
if (_symbols != NULL) \
|
||||
{ \
|
||||
int _i; \
|
||||
_i = 0; \
|
||||
g_critical ("traceback:\n"); \
|
||||
while (_i < _call_stack_size) \
|
||||
{ \
|
||||
g_critical ("\t%s\n", _symbols[_i]); \
|
||||
_i++; \
|
||||
} \
|
||||
free (_symbols); \
|
||||
} \
|
||||
} \
|
||||
G_STMT_END
|
||||
|
||||
#define nm_get_timestamp(timestamp) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
GTimeVal _tv; \
|
||||
g_get_current_time (&_tv); \
|
||||
*timestamp = (_tv.tv_sec * (1.0 * G_USEC_PER_SEC) + \
|
||||
_tv.tv_usec) / G_USEC_PER_SEC; \
|
||||
} \
|
||||
G_STMT_END
|
||||
|
||||
#define nm_info(fmt, args...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
g_message ("<information>\t" fmt "\n", ##args); \
|
||||
} G_STMT_END
|
||||
|
||||
#define nm_info_str(fmt_str, args...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
g_message ("<information>\t%s\n", fmt_str, ##args); \
|
||||
} G_STMT_END
|
||||
|
||||
#define nm_debug(fmt, args...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
gdouble _timestamp; \
|
||||
nm_get_timestamp (&_timestamp); \
|
||||
g_debug ("<debug info>\t[%f] %s (): " fmt "\n", _timestamp, \
|
||||
G_GNUC_PRETTY_FUNCTION, ##args); \
|
||||
} G_STMT_END
|
||||
|
||||
#define nm_debug_str(fmt_str, args...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
gdouble _timestamp; \
|
||||
nm_get_timestamp (&_timestamp); \
|
||||
g_debug ("<debug info>\t[%f] %s (): %s\n", _timestamp, \
|
||||
G_GNUC_PRETTY_FUNCTION, fmt_str, ##args); \
|
||||
} G_STMT_END
|
||||
|
||||
#define nm_warning(fmt, args...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
g_warning ("<WARNING>\t %s (): " fmt "\n", \
|
||||
G_GNUC_PRETTY_FUNCTION, ##args); \
|
||||
} G_STMT_END
|
||||
|
||||
#define nm_warning_str(fmt_str, args...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
g_warning ("<WARNING>\t %s (): %s\n", \
|
||||
G_GNUC_PRETTY_FUNCTION, fmt_str, ##args); \
|
||||
} G_STMT_END
|
||||
|
||||
#define nm_error(fmt, args...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
gdouble _timestamp; \
|
||||
nm_get_timestamp (&_timestamp); \
|
||||
g_critical ("<ERROR>\t[%f] %s (): " fmt "\n", _timestamp, \
|
||||
G_GNUC_PRETTY_FUNCTION, ##args); \
|
||||
nm_print_backtrace (); \
|
||||
G_BREAKPOINT (); \
|
||||
} G_STMT_END
|
||||
|
||||
#define nm_error_str(fmt_str, args...) \
|
||||
G_STMT_START \
|
||||
{ \
|
||||
gdouble _timestamp; \
|
||||
nm_get_timestamp (&_timestamp); \
|
||||
g_critical ("<ERROR>\t[%f] %s (): %s\n", _timestamp, \
|
||||
G_GNUC_PRETTY_FUNCTION, fmt_str, ##args); \
|
||||
nm_print_backtrace (); \
|
||||
G_BREAKPOINT (); \
|
||||
} G_STMT_END
|
||||
|
||||
gchar *nm_dbus_escape_object_path (const gchar *utf8_string);
|
||||
gchar *nm_dbus_unescape_object_path (const gchar *object_path);
|
||||
|
||||
#endif /* NM_UTILS_H */
|
||||
168
vpn-daemons/pptp/src/pppd/fsm.h
Normal file
168
vpn-daemons/pptp/src/pppd/fsm.h
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
* fsm.h - {Link, IP} Control Protocol Finite State Machine definitions.
|
||||
*
|
||||
* Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The name "Carnegie Mellon University" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For permission or any legal
|
||||
* details, please contact
|
||||
* Office of Technology Transfer
|
||||
* Carnegie Mellon University
|
||||
* 5000 Forbes Avenue
|
||||
* Pittsburgh, PA 15213-3890
|
||||
* (412) 268-4387, fax: (412) 268-7395
|
||||
* tech-transfer@andrew.cmu.edu
|
||||
*
|
||||
* 4. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by Computing Services
|
||||
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
|
||||
*
|
||||
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
|
||||
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Packet header = Code, id, length.
|
||||
*/
|
||||
#define HEADERLEN 4
|
||||
|
||||
|
||||
/*
|
||||
* CP (LCP, IPCP, etc.) codes.
|
||||
*/
|
||||
#define CONFREQ 1 /* Configuration Request */
|
||||
#define CONFACK 2 /* Configuration Ack */
|
||||
#define CONFNAK 3 /* Configuration Nak */
|
||||
#define CONFREJ 4 /* Configuration Reject */
|
||||
#define TERMREQ 5 /* Termination Request */
|
||||
#define TERMACK 6 /* Termination Ack */
|
||||
#define CODEREJ 7 /* Code Reject */
|
||||
|
||||
|
||||
/*
|
||||
* Each FSM is described by an fsm structure and fsm callbacks.
|
||||
*/
|
||||
typedef struct fsm {
|
||||
int unit; /* Interface unit number */
|
||||
int protocol; /* Data Link Layer Protocol field value */
|
||||
int state; /* State */
|
||||
int flags; /* Contains option bits */
|
||||
u_char id; /* Current id */
|
||||
u_char reqid; /* Current request id */
|
||||
u_char seen_ack; /* Have received valid Ack/Nak/Rej to Req */
|
||||
int timeouttime; /* Timeout time in milliseconds */
|
||||
int maxconfreqtransmits; /* Maximum Configure-Request transmissions */
|
||||
int retransmits; /* Number of retransmissions left */
|
||||
int maxtermtransmits; /* Maximum Terminate-Request transmissions */
|
||||
int nakloops; /* Number of nak loops since last ack */
|
||||
int rnakloops; /* Number of naks received */
|
||||
int maxnakloops; /* Maximum number of nak loops tolerated */
|
||||
struct fsm_callbacks *callbacks; /* Callback routines */
|
||||
char *term_reason; /* Reason for closing protocol */
|
||||
int term_reason_len; /* Length of term_reason */
|
||||
} fsm;
|
||||
|
||||
|
||||
typedef struct fsm_callbacks {
|
||||
void (*resetci) /* Reset our Configuration Information */
|
||||
__P((fsm *));
|
||||
int (*cilen) /* Length of our Configuration Information */
|
||||
__P((fsm *));
|
||||
void (*addci) /* Add our Configuration Information */
|
||||
__P((fsm *, u_char *, int *));
|
||||
int (*ackci) /* ACK our Configuration Information */
|
||||
__P((fsm *, u_char *, int));
|
||||
int (*nakci) /* NAK our Configuration Information */
|
||||
__P((fsm *, u_char *, int, int));
|
||||
int (*rejci) /* Reject our Configuration Information */
|
||||
__P((fsm *, u_char *, int));
|
||||
int (*reqci) /* Request peer's Configuration Information */
|
||||
__P((fsm *, u_char *, int *, int));
|
||||
void (*up) /* Called when fsm reaches OPENED state */
|
||||
__P((fsm *));
|
||||
void (*down) /* Called when fsm leaves OPENED state */
|
||||
__P((fsm *));
|
||||
void (*starting) /* Called when we want the lower layer */
|
||||
__P((fsm *));
|
||||
void (*finished) /* Called when we don't want the lower layer */
|
||||
__P((fsm *));
|
||||
void (*protreject) /* Called when Protocol-Reject received */
|
||||
__P((int));
|
||||
void (*retransmit) /* Retransmission is necessary */
|
||||
__P((fsm *));
|
||||
int (*extcode) /* Called when unknown code received */
|
||||
__P((fsm *, int, int, u_char *, int));
|
||||
char *proto_name; /* String name for protocol (for messages) */
|
||||
} fsm_callbacks;
|
||||
|
||||
|
||||
/*
|
||||
* Link states.
|
||||
*/
|
||||
#define INITIAL 0 /* Down, hasn't been opened */
|
||||
#define STARTING 1 /* Down, been opened */
|
||||
#define CLOSED 2 /* Up, hasn't been opened */
|
||||
#define STOPPED 3 /* Open, waiting for down event */
|
||||
#define CLOSING 4 /* Terminating the connection, not open */
|
||||
#define STOPPING 5 /* Terminating, but open */
|
||||
#define REQSENT 6 /* We've sent a Config Request */
|
||||
#define ACKRCVD 7 /* We've received a Config Ack */
|
||||
#define ACKSENT 8 /* We've sent a Config Ack */
|
||||
#define OPENED 9 /* Connection available */
|
||||
|
||||
|
||||
/*
|
||||
* Flags - indicate options controlling FSM operation
|
||||
*/
|
||||
#define OPT_PASSIVE 1 /* Don't die if we don't get a response */
|
||||
#define OPT_RESTART 2 /* Treat 2nd OPEN as DOWN, UP */
|
||||
#define OPT_SILENT 4 /* Wait for peer to speak first */
|
||||
|
||||
|
||||
/*
|
||||
* Timeouts.
|
||||
*/
|
||||
#define DEFTIMEOUT 3 /* Timeout time in seconds */
|
||||
#define DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */
|
||||
#define DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */
|
||||
#define DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */
|
||||
|
||||
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
void fsm_init __P((fsm *));
|
||||
void fsm_lowerup __P((fsm *));
|
||||
void fsm_lowerdown __P((fsm *));
|
||||
void fsm_open __P((fsm *));
|
||||
void fsm_close __P((fsm *, char *));
|
||||
void fsm_input __P((fsm *, u_char *, int));
|
||||
void fsm_protreject __P((fsm *));
|
||||
void fsm_sdata __P((fsm *, int, int, u_char *, int));
|
||||
|
||||
|
||||
/*
|
||||
* Variables
|
||||
*/
|
||||
extern int peer_mru[]; /* currently negotiated peer MRU (per unit) */
|
||||
96
vpn-daemons/pptp/src/pppd/ipcp.h
Normal file
96
vpn-daemons/pptp/src/pppd/ipcp.h
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* ipcp.h - IP Control Protocol definitions.
|
||||
*
|
||||
* Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The name "Carnegie Mellon University" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For permission or any legal
|
||||
* details, please contact
|
||||
* Office of Technology Transfer
|
||||
* Carnegie Mellon University
|
||||
* 5000 Forbes Avenue
|
||||
* Pittsburgh, PA 15213-3890
|
||||
* (412) 268-4387, fax: (412) 268-7395
|
||||
* tech-transfer@andrew.cmu.edu
|
||||
*
|
||||
* 4. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by Computing Services
|
||||
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
|
||||
*
|
||||
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
|
||||
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Options.
|
||||
*/
|
||||
#define CI_ADDRS 1 /* IP Addresses */
|
||||
#define CI_COMPRESSTYPE 2 /* Compression Type */
|
||||
#define CI_ADDR 3
|
||||
|
||||
#define CI_MS_DNS1 129 /* Primary DNS value */
|
||||
#define CI_MS_WINS1 130 /* Primary WINS value */
|
||||
#define CI_MS_DNS2 131 /* Secondary DNS value */
|
||||
#define CI_MS_WINS2 132 /* Secondary WINS value */
|
||||
|
||||
#define MAX_STATES 16 /* from slcompress.h */
|
||||
|
||||
#define IPCP_VJMODE_OLD 1 /* "old" mode (option # = 0x0037) */
|
||||
#define IPCP_VJMODE_RFC1172 2 /* "old-rfc"mode (option # = 0x002d) */
|
||||
#define IPCP_VJMODE_RFC1332 3 /* "new-rfc"mode (option # = 0x002d, */
|
||||
/* maxslot and slot number compression) */
|
||||
|
||||
#define IPCP_VJ_COMP 0x002d /* current value for VJ compression option*/
|
||||
#define IPCP_VJ_COMP_OLD 0x0037 /* "old" (i.e, broken) value for VJ */
|
||||
/* compression option*/
|
||||
|
||||
typedef struct ipcp_options {
|
||||
bool neg_addr; /* Negotiate IP Address? */
|
||||
bool old_addrs; /* Use old (IP-Addresses) option? */
|
||||
bool req_addr; /* Ask peer to send IP address? */
|
||||
bool default_route; /* Assign default route through interface? */
|
||||
bool proxy_arp; /* Make proxy ARP entry for peer? */
|
||||
bool neg_vj; /* Van Jacobson Compression? */
|
||||
bool old_vj; /* use old (short) form of VJ option? */
|
||||
bool accept_local; /* accept peer's value for ouraddr */
|
||||
bool accept_remote; /* accept peer's value for hisaddr */
|
||||
bool req_dns1; /* Ask peer to send primary DNS address? */
|
||||
bool req_dns2; /* Ask peer to send secondary DNS address? */
|
||||
int vj_protocol; /* protocol value to use in VJ option */
|
||||
int maxslotindex; /* values for RFC1332 VJ compression neg. */
|
||||
bool cflag;
|
||||
u_int32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */
|
||||
u_int32_t dnsaddr[2]; /* Primary and secondary MS DNS entries */
|
||||
u_int32_t winsaddr[2]; /* Primary and secondary MS WINS entries */
|
||||
} ipcp_options;
|
||||
|
||||
extern fsm ipcp_fsm[];
|
||||
extern ipcp_options ipcp_wantoptions[];
|
||||
extern ipcp_options ipcp_gotoptions[];
|
||||
extern ipcp_options ipcp_allowoptions[];
|
||||
extern ipcp_options ipcp_hisoptions[];
|
||||
|
||||
char *ip_ntoa __P((u_int32_t));
|
||||
|
||||
extern struct protent ipcp_protent;
|
||||
4
vpn-daemons/pptp/src/pppd/patchlevel.h
Normal file
4
vpn-daemons/pptp/src/pppd/patchlevel.h
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
/* $Id$ */
|
||||
|
||||
#define VERSION "2.4.3"
|
||||
#define DATE "13 November 2004"
|
||||
910
vpn-daemons/pptp/src/pppd/pppd.h
Normal file
910
vpn-daemons/pptp/src/pppd/pppd.h
Normal file
|
|
@ -0,0 +1,910 @@
|
|||
/*
|
||||
* pppd.h - PPP daemon global declarations.
|
||||
*
|
||||
* Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. The name "Carnegie Mellon University" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For permission or any legal
|
||||
* details, please contact
|
||||
* Office of Technology Transfer
|
||||
* Carnegie Mellon University
|
||||
* 5000 Forbes Avenue
|
||||
* Pittsburgh, PA 15213-3890
|
||||
* (412) 268-4387, fax: (412) 268-7395
|
||||
* tech-transfer@andrew.cmu.edu
|
||||
*
|
||||
* 4. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by Computing Services
|
||||
* at Carnegie Mellon University (http://www.cmu.edu/computing/)."
|
||||
*
|
||||
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
|
||||
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
*/
|
||||
|
||||
#ifndef __PPPD_H__
|
||||
#define __PPPD_H__
|
||||
|
||||
#include <stdio.h> /* for FILE */
|
||||
#include <limits.h> /* for NGROUPS_MAX */
|
||||
#include <sys/param.h> /* for MAXPATHLEN and BSD4_4, if defined */
|
||||
#include <sys/types.h> /* for u_int32_t, if defined */
|
||||
#include <sys/time.h> /* for struct timeval */
|
||||
#include <net/ppp_defs.h>
|
||||
#include "patchlevel.h"
|
||||
|
||||
#if defined(__STDC__)
|
||||
#include <stdarg.h>
|
||||
#define __V(x) x
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#define __V(x) (va_alist) va_dcl
|
||||
#define const
|
||||
#define volatile
|
||||
#endif
|
||||
|
||||
#ifdef INET6
|
||||
#include "eui64.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Limits.
|
||||
*/
|
||||
|
||||
#define NUM_PPP 1 /* One PPP interface supported (per process) */
|
||||
#define MAXWORDLEN 1024 /* max length of word in file (incl null) */
|
||||
#define MAXARGS 1 /* max # args to a command */
|
||||
#define MAXNAMELEN 256 /* max length of hostname or name for auth */
|
||||
#define MAXSECRETLEN 256 /* max length of password or secret */
|
||||
|
||||
/*
|
||||
* Option descriptor structure.
|
||||
*/
|
||||
|
||||
typedef unsigned char bool;
|
||||
|
||||
enum opt_type {
|
||||
o_special_noarg = 0,
|
||||
o_special = 1,
|
||||
o_bool,
|
||||
o_int,
|
||||
o_uint32,
|
||||
o_string,
|
||||
o_wild
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *name; /* name of the option */
|
||||
enum opt_type type;
|
||||
void *addr;
|
||||
char *description;
|
||||
unsigned int flags;
|
||||
void *addr2;
|
||||
int upper_limit;
|
||||
int lower_limit;
|
||||
const char *source;
|
||||
short int priority;
|
||||
short int winner;
|
||||
} option_t;
|
||||
|
||||
/* Values for flags */
|
||||
#define OPT_VALUE 0xff /* mask for presupplied value */
|
||||
#define OPT_HEX 0x100 /* int option is in hex */
|
||||
#define OPT_NOARG 0x200 /* option doesn't take argument */
|
||||
#define OPT_OR 0x400 /* OR in argument to value */
|
||||
#define OPT_INC 0x800 /* increment value */
|
||||
#define OPT_A2OR 0x800 /* for o_bool, OR arg to *(u_char *)addr2 */
|
||||
#define OPT_PRIV 0x1000 /* privileged option */
|
||||
#define OPT_STATIC 0x2000 /* string option goes into static array */
|
||||
#define OPT_LLIMIT 0x4000 /* check value against lower limit */
|
||||
#define OPT_ULIMIT 0x8000 /* check value against upper limit */
|
||||
#define OPT_LIMITS (OPT_LLIMIT|OPT_ULIMIT)
|
||||
#define OPT_ZEROOK 0x10000 /* 0 value is OK even if not within limits */
|
||||
#define OPT_HIDE 0x10000 /* for o_string, print value as ?????? */
|
||||
#define OPT_A2LIST 0x10000 /* for o_special, keep list of values */
|
||||
#define OPT_A2CLRB 0x10000 /* o_bool, clr val bits in *(u_char *)addr2 */
|
||||
#define OPT_NOINCR 0x20000 /* value mustn't be increased */
|
||||
#define OPT_ZEROINF 0x40000 /* with OPT_NOINCR, 0 == infinity */
|
||||
#define OPT_PRIO 0x80000 /* process option priorities for this option */
|
||||
#define OPT_PRIOSUB 0x100000 /* subsidiary member of priority group */
|
||||
#define OPT_ALIAS 0x200000 /* option is alias for previous option */
|
||||
#define OPT_A2COPY 0x400000 /* addr2 -> second location to rcv value */
|
||||
#define OPT_ENABLE 0x800000 /* use *addr2 as enable for option */
|
||||
#define OPT_A2CLR 0x1000000 /* clear *(bool *)addr2 */
|
||||
#define OPT_PRIVFIX 0x2000000 /* user can't override if set by root */
|
||||
#define OPT_INITONLY 0x4000000 /* option can only be set in init phase */
|
||||
#define OPT_DEVEQUIV 0x8000000 /* equiv to device name */
|
||||
#define OPT_DEVNAM (OPT_INITONLY | OPT_DEVEQUIV)
|
||||
#define OPT_A2PRINTER 0x10000000 /* *addr2 is a fn for printing option */
|
||||
#define OPT_A2STRVAL 0x20000000 /* *addr2 points to current string value */
|
||||
#define OPT_NOPRINT 0x40000000 /* don't print this option at all */
|
||||
|
||||
#define OPT_VAL(x) ((x) & OPT_VALUE)
|
||||
|
||||
/* Values for priority */
|
||||
#define OPRIO_DEFAULT 0 /* a default value */
|
||||
#define OPRIO_CFGFILE 1 /* value from a configuration file */
|
||||
#define OPRIO_CMDLINE 2 /* value from the command line */
|
||||
#define OPRIO_SECFILE 3 /* value from options in a secrets file */
|
||||
#define OPRIO_ROOT 100 /* added to priority if OPT_PRIVFIX && root */
|
||||
|
||||
#ifndef GIDSET_TYPE
|
||||
#define GIDSET_TYPE gid_t
|
||||
#endif
|
||||
|
||||
/* Structure representing a list of permitted IP addresses. */
|
||||
struct permitted_ip {
|
||||
int permit; /* 1 = permit, 0 = forbid */
|
||||
u_int32_t base; /* match if (addr & mask) == base */
|
||||
u_int32_t mask; /* base and mask are in network byte order */
|
||||
};
|
||||
|
||||
/*
|
||||
* Unfortunately, the linux kernel driver uses a different structure
|
||||
* for statistics from the rest of the ports.
|
||||
* This structure serves as a common representation for the bits
|
||||
* pppd needs.
|
||||
*/
|
||||
struct pppd_stats {
|
||||
unsigned int bytes_in;
|
||||
unsigned int bytes_out;
|
||||
unsigned int pkts_in;
|
||||
unsigned int pkts_out;
|
||||
};
|
||||
|
||||
/* Used for storing a sequence of words. Usually malloced. */
|
||||
struct wordlist {
|
||||
struct wordlist *next;
|
||||
char *word;
|
||||
};
|
||||
|
||||
/* An endpoint discriminator, used with multilink. */
|
||||
#define MAX_ENDP_LEN 20 /* maximum length of discriminator value */
|
||||
struct epdisc {
|
||||
unsigned char class;
|
||||
unsigned char length;
|
||||
unsigned char value[MAX_ENDP_LEN];
|
||||
};
|
||||
|
||||
/* values for epdisc.class */
|
||||
#define EPD_NULL 0 /* null discriminator, no data */
|
||||
#define EPD_LOCAL 1
|
||||
#define EPD_IP 2
|
||||
#define EPD_MAC 3
|
||||
#define EPD_MAGIC 4
|
||||
#define EPD_PHONENUM 5
|
||||
|
||||
typedef void (*notify_func) __P((void *, int));
|
||||
|
||||
struct notifier {
|
||||
struct notifier *next;
|
||||
notify_func func;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
/*
|
||||
* Global variables.
|
||||
*/
|
||||
|
||||
extern int hungup; /* Physical layer has disconnected */
|
||||
extern int ifunit; /* Interface unit number */
|
||||
extern char ifname[]; /* Interface name */
|
||||
extern char hostname[]; /* Our hostname */
|
||||
extern u_char outpacket_buf[]; /* Buffer for outgoing packets */
|
||||
extern int devfd; /* fd of underlying device */
|
||||
extern int fd_ppp; /* fd for talking PPP */
|
||||
extern int phase; /* Current state of link - see values below */
|
||||
extern int baud_rate; /* Current link speed in bits/sec */
|
||||
extern char *progname; /* Name of this program */
|
||||
extern int redirect_stderr;/* Connector's stderr should go to file */
|
||||
extern char peer_authname[];/* Authenticated name of peer */
|
||||
extern int auth_done[NUM_PPP]; /* Methods actually used for auth */
|
||||
extern int privileged; /* We were run by real-uid root */
|
||||
extern int need_holdoff; /* Need holdoff period after link terminates */
|
||||
extern char **script_env; /* Environment variables for scripts */
|
||||
extern int detached; /* Have detached from controlling tty */
|
||||
extern GIDSET_TYPE groups[NGROUPS_MAX]; /* groups the user is in */
|
||||
extern int ngroups; /* How many groups valid in groups */
|
||||
extern struct pppd_stats link_stats; /* byte/packet counts etc. for link */
|
||||
extern int link_stats_valid; /* set if link_stats is valid */
|
||||
extern unsigned link_connect_time; /* time the link was up for */
|
||||
extern int using_pty; /* using pty as device (notty or pty opt.) */
|
||||
extern int log_to_fd; /* logging to this fd as well as syslog */
|
||||
extern bool log_default; /* log_to_fd is default (stdout) */
|
||||
extern char *no_ppp_msg; /* message to print if ppp not in kernel */
|
||||
extern volatile int status; /* exit status for pppd */
|
||||
extern bool devnam_fixed; /* can no longer change devnam */
|
||||
extern int unsuccess; /* # unsuccessful connection attempts */
|
||||
extern int do_callback; /* set if we want to do callback next */
|
||||
extern int doing_callback; /* set if this is a callback */
|
||||
extern int error_count; /* # of times error() has been called */
|
||||
extern char ppp_devnam[MAXPATHLEN];
|
||||
extern char remote_number[MAXNAMELEN]; /* Remote telephone number, if avail. */
|
||||
extern int ppp_session_number; /* Session number (eg PPPoE session) */
|
||||
extern int fd_devnull; /* fd open to /dev/null */
|
||||
|
||||
extern int listen_time; /* time to listen first (ms) */
|
||||
extern bool doing_multilink;
|
||||
extern bool multilink_master;
|
||||
extern bool bundle_eof;
|
||||
extern bool bundle_terminating;
|
||||
|
||||
extern struct notifier *pidchange; /* for notifications of pid changing */
|
||||
extern struct notifier *phasechange; /* for notifications of phase changes */
|
||||
extern struct notifier *exitnotify; /* for notification that we're exiting */
|
||||
extern struct notifier *sigreceived; /* notification of received signal */
|
||||
extern struct notifier *ip_up_notifier; /* IPCP has come up */
|
||||
extern struct notifier *ip_down_notifier; /* IPCP has gone down */
|
||||
extern struct notifier *auth_up_notifier; /* peer has authenticated */
|
||||
extern struct notifier *link_down_notifier; /* link has gone down */
|
||||
extern struct notifier *fork_notifier; /* we are a new child process */
|
||||
|
||||
/* Values for do_callback and doing_callback */
|
||||
#define CALLBACK_DIALIN 1 /* we are expecting the call back */
|
||||
#define CALLBACK_DIALOUT 2 /* we are dialling out to call back */
|
||||
|
||||
/*
|
||||
* Variables set by command-line options.
|
||||
*/
|
||||
|
||||
extern int debug; /* Debug flag */
|
||||
extern int kdebugflag; /* Tell kernel to print debug messages */
|
||||
extern int default_device; /* Using /dev/tty or equivalent */
|
||||
extern char devnam[MAXPATHLEN]; /* Device name */
|
||||
extern int crtscts; /* Use hardware flow control */
|
||||
extern bool modem; /* Use modem control lines */
|
||||
extern int inspeed; /* Input/Output speed requested */
|
||||
extern u_int32_t netmask; /* IP netmask to set on interface */
|
||||
extern bool lockflag; /* Create lock file to lock the serial dev */
|
||||
extern bool nodetach; /* Don't detach from controlling tty */
|
||||
extern bool updetach; /* Detach from controlling tty when link up */
|
||||
extern char *initializer; /* Script to initialize physical link */
|
||||
extern char *connect_script; /* Script to establish physical link */
|
||||
extern char *disconnect_script; /* Script to disestablish physical link */
|
||||
extern char *welcomer; /* Script to welcome client after connection */
|
||||
extern char *ptycommand; /* Command to run on other side of pty */
|
||||
extern int maxconnect; /* Maximum connect time (seconds) */
|
||||
extern char user[MAXNAMELEN];/* Our name for authenticating ourselves */
|
||||
extern char passwd[MAXSECRETLEN]; /* Password for PAP or CHAP */
|
||||
extern bool auth_required; /* Peer is required to authenticate */
|
||||
extern bool persist; /* Reopen link after it goes down */
|
||||
extern bool uselogin; /* Use /etc/passwd for checking PAP */
|
||||
extern char our_name[MAXNAMELEN];/* Our name for authentication purposes */
|
||||
extern char remote_name[MAXNAMELEN]; /* Peer's name for authentication */
|
||||
extern bool explicit_remote;/* remote_name specified with remotename opt */
|
||||
extern bool demand; /* Do dial-on-demand */
|
||||
extern bool killoldaddr; /* If our IP is reassigned on
|
||||
reconnect, kill active TCP
|
||||
connections using the old IP. */
|
||||
extern char *ipparam; /* Extra parameter for ip up/down scripts */
|
||||
extern bool cryptpap; /* Others' PAP passwords are encrypted */
|
||||
extern int idle_time_limit;/* Shut down link if idle for this long */
|
||||
extern int holdoff; /* Dead time before restarting */
|
||||
extern bool holdoff_specified; /* true if user gave a holdoff value */
|
||||
extern bool notty; /* Stdin/out is not a tty */
|
||||
extern char *pty_socket; /* Socket to connect to pty */
|
||||
extern char *record_file; /* File to record chars sent/received */
|
||||
extern bool sync_serial; /* Device is synchronous serial device */
|
||||
extern int maxfail; /* Max # of unsuccessful connection attempts */
|
||||
extern char linkname[MAXPATHLEN]; /* logical name for link */
|
||||
extern bool tune_kernel; /* May alter kernel settings as necessary */
|
||||
extern int connect_delay; /* Time to delay after connect script */
|
||||
extern int max_data_rate; /* max bytes/sec through charshunt */
|
||||
extern int req_unit; /* interface unit number to use */
|
||||
extern bool multilink; /* enable multilink operation */
|
||||
extern bool noendpoint; /* don't send or accept endpt. discrim. */
|
||||
extern char *bundle_name; /* bundle name for multilink */
|
||||
extern bool dump_options; /* print out option values */
|
||||
extern bool dryrun; /* check everything, print options, exit */
|
||||
extern int child_wait; /* # seconds to wait for children at end */
|
||||
|
||||
#ifdef MAXOCTETS
|
||||
extern unsigned int maxoctets; /* Maximum octetes per session (in bytes) */
|
||||
extern int maxoctets_dir; /* Direction :
|
||||
0 - in+out (default)
|
||||
1 - in
|
||||
2 - out
|
||||
3 - max(in,out) */
|
||||
extern int maxoctets_timeout; /* Timeout for check of octets limit */
|
||||
#define PPP_OCTETS_DIRECTION_SUM 0
|
||||
#define PPP_OCTETS_DIRECTION_IN 1
|
||||
#define PPP_OCTETS_DIRECTION_OUT 2
|
||||
#define PPP_OCTETS_DIRECTION_MAXOVERAL 3
|
||||
/* same as previos, but little different on RADIUS side */
|
||||
#define PPP_OCTETS_DIRECTION_MAXSESSION 4
|
||||
#endif
|
||||
|
||||
#ifdef PPP_FILTER
|
||||
extern struct bpf_program pass_filter; /* Filter for pkts to pass */
|
||||
extern struct bpf_program active_filter; /* Filter for link-active pkts */
|
||||
#endif
|
||||
|
||||
#ifdef MSLANMAN
|
||||
extern bool ms_lanman; /* Use LanMan password instead of NT */
|
||||
/* Has meaning only with MS-CHAP challenges */
|
||||
#endif
|
||||
|
||||
/* Values for auth_pending, auth_done */
|
||||
#define PAP_WITHPEER 0x1
|
||||
#define PAP_PEER 0x2
|
||||
#define CHAP_WITHPEER 0x4
|
||||
#define CHAP_PEER 0x8
|
||||
#define EAP_WITHPEER 0x10
|
||||
#define EAP_PEER 0x20
|
||||
|
||||
/* Values for auth_done only */
|
||||
#define CHAP_MD5_WITHPEER 0x40
|
||||
#define CHAP_MD5_PEER 0x80
|
||||
#define CHAP_MS_SHIFT 8 /* LSB position for MS auths */
|
||||
#define CHAP_MS_WITHPEER 0x100
|
||||
#define CHAP_MS_PEER 0x200
|
||||
#define CHAP_MS2_WITHPEER 0x400
|
||||
#define CHAP_MS2_PEER 0x800
|
||||
|
||||
extern char *current_option; /* the name of the option being parsed */
|
||||
extern int privileged_option; /* set iff the current option came from root */
|
||||
extern char *option_source; /* string saying where the option came from */
|
||||
extern int option_priority; /* priority of current options */
|
||||
|
||||
/*
|
||||
* Values for phase.
|
||||
*/
|
||||
#define PHASE_DEAD 0
|
||||
#define PHASE_INITIALIZE 1
|
||||
#define PHASE_SERIALCONN 2
|
||||
#define PHASE_DORMANT 3
|
||||
#define PHASE_ESTABLISH 4
|
||||
#define PHASE_AUTHENTICATE 5
|
||||
#define PHASE_CALLBACK 6
|
||||
#define PHASE_NETWORK 7
|
||||
#define PHASE_RUNNING 8
|
||||
#define PHASE_TERMINATE 9
|
||||
#define PHASE_DISCONNECT 10
|
||||
#define PHASE_HOLDOFF 11
|
||||
#define PHASE_MASTER 12
|
||||
|
||||
/*
|
||||
* The following struct gives the addresses of procedures to call
|
||||
* for a particular protocol.
|
||||
*/
|
||||
struct protent {
|
||||
u_short protocol; /* PPP protocol number */
|
||||
/* Initialization procedure */
|
||||
void (*init) __P((int unit));
|
||||
/* Process a received packet */
|
||||
void (*input) __P((int unit, u_char *pkt, int len));
|
||||
/* Process a received protocol-reject */
|
||||
void (*protrej) __P((int unit));
|
||||
/* Lower layer has come up */
|
||||
void (*lowerup) __P((int unit));
|
||||
/* Lower layer has gone down */
|
||||
void (*lowerdown) __P((int unit));
|
||||
/* Open the protocol */
|
||||
void (*open) __P((int unit));
|
||||
/* Close the protocol */
|
||||
void (*close) __P((int unit, char *reason));
|
||||
/* Print a packet in readable form */
|
||||
int (*printpkt) __P((u_char *pkt, int len,
|
||||
void (*printer) __P((void *, char *, ...)),
|
||||
void *arg));
|
||||
/* Process a received data packet */
|
||||
void (*datainput) __P((int unit, u_char *pkt, int len));
|
||||
bool enabled_flag; /* 0 iff protocol is disabled */
|
||||
char *name; /* Text name of protocol */
|
||||
char *data_name; /* Text name of corresponding data protocol */
|
||||
option_t *options; /* List of command-line options */
|
||||
/* Check requested options, assign defaults */
|
||||
void (*check_options) __P((void));
|
||||
/* Configure interface for demand-dial */
|
||||
int (*demand_conf) __P((int unit));
|
||||
/* Say whether to bring up link for this pkt */
|
||||
int (*active_pkt) __P((u_char *pkt, int len));
|
||||
};
|
||||
|
||||
/* Table of pointers to supported protocols */
|
||||
extern struct protent *protocols[];
|
||||
|
||||
/*
|
||||
* This struct contains pointers to a set of procedures for
|
||||
* doing operations on a "channel". A channel provides a way
|
||||
* to send and receive PPP packets - the canonical example is
|
||||
* a serial port device in PPP line discipline (or equivalently
|
||||
* with PPP STREAMS modules pushed onto it).
|
||||
*/
|
||||
struct channel {
|
||||
/* set of options for this channel */
|
||||
option_t *options;
|
||||
/* find and process a per-channel options file */
|
||||
void (*process_extra_options) __P((void));
|
||||
/* check all the options that have been given */
|
||||
void (*check_options) __P((void));
|
||||
/* get the channel ready to do PPP, return a file descriptor */
|
||||
int (*connect) __P((void));
|
||||
/* we're finished with the channel */
|
||||
void (*disconnect) __P((void));
|
||||
/* put the channel into PPP `mode' */
|
||||
int (*establish_ppp) __P((int));
|
||||
/* take the channel out of PPP `mode', restore loopback if demand */
|
||||
void (*disestablish_ppp) __P((int));
|
||||
/* set the transmit-side PPP parameters of the channel */
|
||||
void (*send_config) __P((int, u_int32_t, int, int));
|
||||
/* set the receive-side PPP parameters of the channel */
|
||||
void (*recv_config) __P((int, u_int32_t, int, int));
|
||||
/* cleanup on error or normal exit */
|
||||
void (*cleanup) __P((void));
|
||||
/* close the device, called in children after fork */
|
||||
void (*close) __P((void));
|
||||
};
|
||||
|
||||
extern struct channel *the_channel;
|
||||
|
||||
/*
|
||||
* Prototypes.
|
||||
*/
|
||||
|
||||
/* Procedures exported from main.c. */
|
||||
void set_ifunit __P((int)); /* set stuff that depends on ifunit */
|
||||
void detach __P((void)); /* Detach from controlling tty */
|
||||
void die __P((int)); /* Cleanup and exit */
|
||||
void quit __P((void)); /* like die(1) */
|
||||
void novm __P((char *)); /* Say we ran out of memory, and die */
|
||||
void timeout __P((void (*func)(void *), void *arg, int s, int us));
|
||||
/* Call func(arg) after s.us seconds */
|
||||
void untimeout __P((void (*func)(void *), void *arg));
|
||||
/* Cancel call to func(arg) */
|
||||
void record_child __P((int, char *, void (*) (void *), void *));
|
||||
pid_t safe_fork __P((int, int, int)); /* Fork & close stuff in child */
|
||||
int device_script __P((char *cmd, int in, int out, int dont_wait));
|
||||
/* Run `cmd' with given stdin and stdout */
|
||||
pid_t run_program __P((char *prog, char **args, int must_exist,
|
||||
void (*done)(void *), void *arg));
|
||||
/* Run program prog with args in child */
|
||||
void reopen_log __P((void)); /* (re)open the connection to syslog */
|
||||
void print_link_stats __P((void)); /* Print stats, if available */
|
||||
void reset_link_stats __P((int)); /* Reset (init) stats when link goes up */
|
||||
void update_link_stats __P((int)); /* Get stats at link termination */
|
||||
void script_setenv __P((char *, char *, int)); /* set script env var */
|
||||
void script_unsetenv __P((char *)); /* unset script env var */
|
||||
void new_phase __P((int)); /* signal start of new phase */
|
||||
void add_notifier __P((struct notifier **, notify_func, void *));
|
||||
void remove_notifier __P((struct notifier **, notify_func, void *));
|
||||
void notify __P((struct notifier *, int));
|
||||
int ppp_send_config __P((int, int, u_int32_t, int, int));
|
||||
int ppp_recv_config __P((int, int, u_int32_t, int, int));
|
||||
const char *protocol_name __P((int));
|
||||
void remove_pidfiles __P((void));
|
||||
void lock_db __P((void));
|
||||
void unlock_db __P((void));
|
||||
|
||||
/* Procedures exported from tty.c. */
|
||||
void tty_init __P((void));
|
||||
|
||||
/* Procedures exported from utils.c. */
|
||||
void log_packet __P((u_char *, int, char *, int));
|
||||
/* Format a packet and log it with syslog */
|
||||
void print_string __P((char *, int, void (*) (void *, char *, ...),
|
||||
void *)); /* Format a string for output */
|
||||
int slprintf __P((char *, int, char *, ...)); /* sprintf++ */
|
||||
int vslprintf __P((char *, int, char *, va_list)); /* vsprintf++ */
|
||||
size_t strlcpy __P((char *, const char *, size_t)); /* safe strcpy */
|
||||
size_t strlcat __P((char *, const char *, size_t)); /* safe strncpy */
|
||||
void dbglog __P((char *, ...)); /* log a debug message */
|
||||
void info __P((char *, ...)); /* log an informational message */
|
||||
void notice __P((char *, ...)); /* log a notice-level message */
|
||||
void warn __P((char *, ...)); /* log a warning message */
|
||||
void error __P((char *, ...)); /* log an error message */
|
||||
void fatal __P((char *, ...)); /* log an error message and die(1) */
|
||||
void init_pr_log __P((char *, int)); /* initialize for using pr_log */
|
||||
void pr_log __P((void *, char *, ...)); /* printer fn, output to syslog */
|
||||
void end_pr_log __P((void)); /* finish up after using pr_log */
|
||||
void dump_packet __P((const char *, u_char *, int));
|
||||
/* dump packet to debug log if interesting */
|
||||
ssize_t complete_read __P((int, void *, size_t));
|
||||
/* read a complete buffer */
|
||||
|
||||
/* Procedures exported from auth.c */
|
||||
void link_required __P((int)); /* we are starting to use the link */
|
||||
void start_link __P((int)); /* bring the link up now */
|
||||
void link_terminated __P((int)); /* we are finished with the link */
|
||||
void link_down __P((int)); /* the LCP layer has left the Opened state */
|
||||
void upper_layers_down __P((int));/* take all NCPs down */
|
||||
void link_established __P((int)); /* the link is up; authenticate now */
|
||||
void start_networks __P((int)); /* start all the network control protos */
|
||||
void continue_networks __P((int)); /* start network [ip, etc] control protos */
|
||||
void np_up __P((int, int)); /* a network protocol has come up */
|
||||
void np_down __P((int, int)); /* a network protocol has gone down */
|
||||
void np_finished __P((int, int)); /* a network protocol no longer needs link */
|
||||
void auth_peer_fail __P((int, int));
|
||||
/* peer failed to authenticate itself */
|
||||
void auth_peer_success __P((int, int, int, char *, int));
|
||||
/* peer successfully authenticated itself */
|
||||
void auth_withpeer_fail __P((int, int));
|
||||
/* we failed to authenticate ourselves */
|
||||
void auth_withpeer_success __P((int, int, int));
|
||||
/* we successfully authenticated ourselves */
|
||||
void auth_check_options __P((void));
|
||||
/* check authentication options supplied */
|
||||
void auth_reset __P((int)); /* check what secrets we have */
|
||||
int check_passwd __P((int, char *, int, char *, int, char **));
|
||||
/* Check peer-supplied username/password */
|
||||
int get_secret __P((int, char *, char *, char *, int *, int));
|
||||
/* get "secret" for chap */
|
||||
int get_srp_secret __P((int unit, char *client, char *server, char *secret,
|
||||
int am_server));
|
||||
int auth_ip_addr __P((int, u_int32_t));
|
||||
/* check if IP address is authorized */
|
||||
int auth_number __P((void)); /* check if remote number is authorized */
|
||||
int bad_ip_adrs __P((u_int32_t));
|
||||
/* check if IP address is unreasonable */
|
||||
|
||||
/* Procedures exported from demand.c */
|
||||
void demand_conf __P((void)); /* config interface(s) for demand-dial */
|
||||
void demand_block __P((void)); /* set all NPs to queue up packets */
|
||||
void demand_unblock __P((void)); /* set all NPs to pass packets */
|
||||
void demand_discard __P((void)); /* set all NPs to discard packets */
|
||||
void demand_rexmit __P((int)); /* retransmit saved frames for an NP */
|
||||
int loop_chars __P((unsigned char *, int)); /* process chars from loopback */
|
||||
int loop_frame __P((unsigned char *, int)); /* should we bring link up? */
|
||||
|
||||
/* Procedures exported from multilink.c */
|
||||
#ifdef HAVE_MULTILINK
|
||||
void mp_check_options __P((void)); /* Check multilink-related options */
|
||||
int mp_join_bundle __P((void)); /* join our link to an appropriate bundle */
|
||||
void mp_exit_bundle __P((void)); /* have disconnected our link from bundle */
|
||||
void mp_bundle_terminated __P((void));
|
||||
char *epdisc_to_str __P((struct epdisc *)); /* string from endpoint discrim. */
|
||||
int str_to_epdisc __P((struct epdisc *, char *)); /* endpt disc. from str */
|
||||
#else
|
||||
#define mp_bundle_terminated() /* nothing */
|
||||
#define mp_exit_bundle() /* nothing */
|
||||
#define doing_multilink 0
|
||||
#define multilink_master 0
|
||||
#endif
|
||||
|
||||
/* Procedures exported from sys-*.c */
|
||||
void sys_init __P((void)); /* Do system-dependent initialization */
|
||||
void sys_cleanup __P((void)); /* Restore system state before exiting */
|
||||
int sys_check_options __P((void)); /* Check options specified */
|
||||
void sys_close __P((void)); /* Clean up in a child before execing */
|
||||
int ppp_available __P((void)); /* Test whether ppp kernel support exists */
|
||||
int get_pty __P((int *, int *, char *, int)); /* Get pty master/slave */
|
||||
int open_ppp_loopback __P((void)); /* Open loopback for demand-dialling */
|
||||
int tty_establish_ppp __P((int)); /* Turn serial port into a ppp interface */
|
||||
void tty_disestablish_ppp __P((int)); /* Restore port to normal operation */
|
||||
void generic_disestablish_ppp __P((int dev_fd)); /* Restore device setting */
|
||||
int generic_establish_ppp __P((int dev_fd)); /* Make a ppp interface */
|
||||
void make_new_bundle __P((int, int, int, int)); /* Create new bundle */
|
||||
int bundle_attach __P((int)); /* Attach link to existing bundle */
|
||||
void cfg_bundle __P((int, int, int, int)); /* Configure existing bundle */
|
||||
void destroy_bundle __P((void)); /* Tell driver to destroy bundle */
|
||||
void clean_check __P((void)); /* Check if line was 8-bit clean */
|
||||
void set_up_tty __P((int, int)); /* Set up port's speed, parameters, etc. */
|
||||
void restore_tty __P((int)); /* Restore port's original parameters */
|
||||
void setdtr __P((int, int)); /* Raise or lower port's DTR line */
|
||||
void output __P((int, u_char *, int)); /* Output a PPP packet */
|
||||
void wait_input __P((struct timeval *));
|
||||
/* Wait for input, with timeout */
|
||||
void add_fd __P((int)); /* Add fd to set to wait for */
|
||||
void remove_fd __P((int)); /* Remove fd from set to wait for */
|
||||
int read_packet __P((u_char *)); /* Read PPP packet */
|
||||
int get_loop_output __P((void)); /* Read pkts from loopback */
|
||||
void tty_send_config __P((int, u_int32_t, int, int));
|
||||
/* Configure i/f transmit parameters */
|
||||
void tty_set_xaccm __P((ext_accm));
|
||||
/* Set extended transmit ACCM */
|
||||
void tty_recv_config __P((int, u_int32_t, int, int));
|
||||
/* Configure i/f receive parameters */
|
||||
int ccp_test __P((int, u_char *, int, int));
|
||||
/* Test support for compression scheme */
|
||||
void ccp_flags_set __P((int, int, int));
|
||||
/* Set kernel CCP state */
|
||||
int ccp_fatal_error __P((int)); /* Test for fatal decomp error in kernel */
|
||||
int get_idle_time __P((int, struct ppp_idle *));
|
||||
/* Find out how long link has been idle */
|
||||
int get_ppp_stats __P((int, struct pppd_stats *));
|
||||
/* Return link statistics */
|
||||
void netif_set_mtu __P((int, int)); /* Set PPP interface MTU */
|
||||
int netif_get_mtu __P((int)); /* Get PPP interface MTU */
|
||||
int sifvjcomp __P((int, int, int, int));
|
||||
/* Configure VJ TCP header compression */
|
||||
int sifup __P((int)); /* Configure i/f up for one protocol */
|
||||
int sifnpmode __P((int u, int proto, enum NPmode mode));
|
||||
/* Set mode for handling packets for proto */
|
||||
int sifdown __P((int)); /* Configure i/f down for one protocol */
|
||||
int sifaddr __P((int, u_int32_t, u_int32_t, u_int32_t));
|
||||
/* Configure IPv4 addresses for i/f */
|
||||
int cifaddr __P((int, u_int32_t, u_int32_t));
|
||||
/* Reset i/f IP addresses */
|
||||
#ifdef INET6
|
||||
int sif6addr __P((int, eui64_t, eui64_t));
|
||||
/* Configure IPv6 addresses for i/f */
|
||||
int cif6addr __P((int, eui64_t, eui64_t));
|
||||
/* Remove an IPv6 address from i/f */
|
||||
#endif
|
||||
int sifdefaultroute __P((int, u_int32_t, u_int32_t));
|
||||
/* Create default route through i/f */
|
||||
int cifdefaultroute __P((int, u_int32_t, u_int32_t));
|
||||
/* Delete default route through i/f */
|
||||
int sifproxyarp __P((int, u_int32_t));
|
||||
/* Add proxy ARP entry for peer */
|
||||
int cifproxyarp __P((int, u_int32_t));
|
||||
/* Delete proxy ARP entry for peer */
|
||||
u_int32_t GetMask __P((u_int32_t)); /* Get appropriate netmask for address */
|
||||
int lock __P((char *)); /* Create lock file for device */
|
||||
int relock __P((int)); /* Rewrite lock file with new pid */
|
||||
void unlock __P((void)); /* Delete previously-created lock file */
|
||||
void logwtmp __P((const char *, const char *, const char *));
|
||||
/* Write entry to wtmp file */
|
||||
int get_host_seed __P((void)); /* Get host-dependent random number seed */
|
||||
int have_route_to __P((u_int32_t)); /* Check if route to addr exists */
|
||||
#ifdef PPP_FILTER
|
||||
int set_filters __P((struct bpf_program *pass, struct bpf_program *active));
|
||||
/* Set filter programs in kernel */
|
||||
#endif
|
||||
#ifdef IPX_CHANGE
|
||||
int sipxfaddr __P((int, unsigned long, unsigned char *));
|
||||
int cipxfaddr __P((int));
|
||||
#endif
|
||||
int get_if_hwaddr __P((u_char *addr, char *name));
|
||||
char *get_first_ethernet __P((void));
|
||||
|
||||
/* Procedures exported from options.c */
|
||||
int setipaddr __P((char *, char **, int)); /* Set local/remote ip addresses */
|
||||
int parse_args __P((int argc, char **argv));
|
||||
/* Parse options from arguments given */
|
||||
int options_from_file __P((char *filename, int must_exist, int check_prot,
|
||||
int privileged));
|
||||
/* Parse options from an options file */
|
||||
int options_from_user __P((void)); /* Parse options from user's .ppprc */
|
||||
int options_for_tty __P((void)); /* Parse options from /etc/ppp/options.tty */
|
||||
int options_from_list __P((struct wordlist *, int privileged));
|
||||
/* Parse options from a wordlist */
|
||||
int getword __P((FILE *f, char *word, int *newlinep, char *filename));
|
||||
/* Read a word from a file */
|
||||
void option_error __P((char *fmt, ...));
|
||||
/* Print an error message about an option */
|
||||
int int_option __P((char *, int *));
|
||||
/* Simplified number_option for decimal ints */
|
||||
void add_options __P((option_t *)); /* Add extra options */
|
||||
void check_options __P((void)); /* check values after all options parsed */
|
||||
int override_value __P((const char *, int, const char *));
|
||||
/* override value if permitted by priority */
|
||||
void print_options __P((void (*) __P((void *, char *, ...)), void *));
|
||||
/* print out values of all options */
|
||||
|
||||
int parse_dotted_ip __P((char *, u_int32_t *));
|
||||
|
||||
/*
|
||||
* Hooks to enable plugins to change various things.
|
||||
*/
|
||||
extern int (*new_phase_hook) __P((int));
|
||||
extern int (*idle_time_hook) __P((struct ppp_idle *));
|
||||
extern int (*holdoff_hook) __P((void));
|
||||
extern int (*pap_check_hook) __P((void));
|
||||
extern int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp,
|
||||
struct wordlist **paddrs,
|
||||
struct wordlist **popts));
|
||||
extern void (*pap_logout_hook) __P((void));
|
||||
extern int (*pap_passwd_hook) __P((char *user, char *passwd));
|
||||
extern int (*allowed_address_hook) __P((u_int32_t addr));
|
||||
extern void (*ip_up_hook) __P((void));
|
||||
extern void (*ip_down_hook) __P((void));
|
||||
extern void (*ip_choose_hook) __P((u_int32_t *));
|
||||
|
||||
extern int (*chap_check_hook) __P((void));
|
||||
extern int (*chap_passwd_hook) __P((char *user, char *passwd));
|
||||
|
||||
/* Let a plugin snoop sent and received packets. Useful for L2TP */
|
||||
extern void (*snoop_recv_hook) __P((unsigned char *p, int len));
|
||||
extern void (*snoop_send_hook) __P((unsigned char *p, int len));
|
||||
|
||||
/*
|
||||
* Inline versions of get/put char/short/long.
|
||||
* Pointer is advanced; we assume that both arguments
|
||||
* are lvalues and will already be in registers.
|
||||
* cp MUST be u_char *.
|
||||
*/
|
||||
#define GETCHAR(c, cp) { \
|
||||
(c) = *(cp)++; \
|
||||
}
|
||||
#define PUTCHAR(c, cp) { \
|
||||
*(cp)++ = (u_char) (c); \
|
||||
}
|
||||
|
||||
|
||||
#define GETSHORT(s, cp) { \
|
||||
(s) = *(cp)++ << 8; \
|
||||
(s) |= *(cp)++; \
|
||||
}
|
||||
#define PUTSHORT(s, cp) { \
|
||||
*(cp)++ = (u_char) ((s) >> 8); \
|
||||
*(cp)++ = (u_char) (s); \
|
||||
}
|
||||
|
||||
#define GETLONG(l, cp) { \
|
||||
(l) = *(cp)++ << 8; \
|
||||
(l) |= *(cp)++; (l) <<= 8; \
|
||||
(l) |= *(cp)++; (l) <<= 8; \
|
||||
(l) |= *(cp)++; \
|
||||
}
|
||||
#define PUTLONG(l, cp) { \
|
||||
*(cp)++ = (u_char) ((l) >> 24); \
|
||||
*(cp)++ = (u_char) ((l) >> 16); \
|
||||
*(cp)++ = (u_char) ((l) >> 8); \
|
||||
*(cp)++ = (u_char) (l); \
|
||||
}
|
||||
|
||||
#define INCPTR(n, cp) ((cp) += (n))
|
||||
#define DECPTR(n, cp) ((cp) -= (n))
|
||||
|
||||
/*
|
||||
* System dependent definitions for user-level 4.3BSD UNIX implementation.
|
||||
*/
|
||||
|
||||
#define TIMEOUT(r, f, t) timeout((r), (f), (t), 0)
|
||||
#define UNTIMEOUT(r, f) untimeout((r), (f))
|
||||
|
||||
#define BCOPY(s, d, l) memcpy(d, s, l)
|
||||
#define BZERO(s, n) memset(s, 0, n)
|
||||
#define BCMP(s1, s2, l) memcmp(s1, s2, l)
|
||||
|
||||
#define PRINTMSG(m, l) { info("Remote message: %0.*v", l, m); }
|
||||
|
||||
/*
|
||||
* MAKEHEADER - Add Header fields to a packet.
|
||||
*/
|
||||
#define MAKEHEADER(p, t) { \
|
||||
PUTCHAR(PPP_ALLSTATIONS, p); \
|
||||
PUTCHAR(PPP_UI, p); \
|
||||
PUTSHORT(t, p); }
|
||||
|
||||
/*
|
||||
* Exit status values.
|
||||
*/
|
||||
#define EXIT_OK 0
|
||||
#define EXIT_FATAL_ERROR 1
|
||||
#define EXIT_OPTION_ERROR 2
|
||||
#define EXIT_NOT_ROOT 3
|
||||
#define EXIT_NO_KERNEL_SUPPORT 4
|
||||
#define EXIT_USER_REQUEST 5
|
||||
#define EXIT_LOCK_FAILED 6
|
||||
#define EXIT_OPEN_FAILED 7
|
||||
#define EXIT_CONNECT_FAILED 8
|
||||
#define EXIT_PTYCMD_FAILED 9
|
||||
#define EXIT_NEGOTIATION_FAILED 10
|
||||
#define EXIT_PEER_AUTH_FAILED 11
|
||||
#define EXIT_IDLE_TIMEOUT 12
|
||||
#define EXIT_CONNECT_TIME 13
|
||||
#define EXIT_CALLBACK 14
|
||||
#define EXIT_PEER_DEAD 15
|
||||
#define EXIT_HANGUP 16
|
||||
#define EXIT_LOOPBACK 17
|
||||
#define EXIT_INIT_FAILED 18
|
||||
#define EXIT_AUTH_TOPEER_FAILED 19
|
||||
#ifdef MAXOCTETS
|
||||
#define EXIT_TRAFFIC_LIMIT 20
|
||||
#endif
|
||||
#define EXIT_CNID_AUTH_FAILED 21
|
||||
|
||||
/*
|
||||
* Debug macros. Slightly useful for finding bugs in pppd, not particularly
|
||||
* useful for finding out why your connection isn't being established.
|
||||
*/
|
||||
#ifdef DEBUGALL
|
||||
#define DEBUGMAIN 1
|
||||
#define DEBUGFSM 1
|
||||
#define DEBUGLCP 1
|
||||
#define DEBUGIPCP 1
|
||||
#define DEBUGIPV6CP 1
|
||||
#define DEBUGUPAP 1
|
||||
#define DEBUGCHAP 1
|
||||
#endif
|
||||
|
||||
#ifndef LOG_PPP /* we use LOG_LOCAL2 for syslog by default */
|
||||
#if defined(DEBUGMAIN) || defined(DEBUGFSM) || defined(DEBUGSYS) \
|
||||
|| defined(DEBUGLCP) || defined(DEBUGIPCP) || defined(DEBUGUPAP) \
|
||||
|| defined(DEBUGCHAP) || defined(DEBUG) || defined(DEBUGIPV6CP)
|
||||
#define LOG_PPP LOG_LOCAL2
|
||||
#else
|
||||
#define LOG_PPP LOG_DAEMON
|
||||
#endif
|
||||
#endif /* LOG_PPP */
|
||||
|
||||
#ifdef DEBUGMAIN
|
||||
#define MAINDEBUG(x) if (debug) dbglog x
|
||||
#else
|
||||
#define MAINDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGSYS
|
||||
#define SYSDEBUG(x) if (debug) dbglog x
|
||||
#else
|
||||
#define SYSDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGFSM
|
||||
#define FSMDEBUG(x) if (debug) dbglog x
|
||||
#else
|
||||
#define FSMDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGLCP
|
||||
#define LCPDEBUG(x) if (debug) dbglog x
|
||||
#else
|
||||
#define LCPDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGIPCP
|
||||
#define IPCPDEBUG(x) if (debug) dbglog x
|
||||
#else
|
||||
#define IPCPDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGIPV6CP
|
||||
#define IPV6CPDEBUG(x) if (debug) dbglog x
|
||||
#else
|
||||
#define IPV6CPDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGUPAP
|
||||
#define UPAPDEBUG(x) if (debug) dbglog x
|
||||
#else
|
||||
#define UPAPDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGCHAP
|
||||
#define CHAPDEBUG(x) if (debug) dbglog x
|
||||
#else
|
||||
#define CHAPDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGIPXCP
|
||||
#define IPXCPDEBUG(x) if (debug) dbglog x
|
||||
#else
|
||||
#define IPXCPDEBUG(x)
|
||||
#endif
|
||||
|
||||
#ifndef SIGTYPE
|
||||
#if defined(sun) || defined(SYSV) || defined(POSIX_SOURCE)
|
||||
#define SIGTYPE void
|
||||
#else
|
||||
#define SIGTYPE int
|
||||
#endif /* defined(sun) || defined(SYSV) || defined(POSIX_SOURCE) */
|
||||
#endif /* SIGTYPE */
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b)? (a): (b))
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a) > (b)? (a): (b))
|
||||
#endif
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(type, member) ((size_t) &((type *)0)->member)
|
||||
#endif
|
||||
|
||||
#endif /* __PPP_H__ */
|
||||
Loading…
Add table
Reference in a new issue