aboutsummaryrefslogtreecommitdiffstats
path: root/packages/gpe-conf/gpe-conf-0.1.20/password-if.patch
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2005-06-30 08:19:37 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2005-06-30 08:19:37 +0000
commitc8e5702127e507e82e6f68a4b8c546803accea9d (patch)
tree00583491f40ecc640f2b28452af995e3a63a09d7 /packages/gpe-conf/gpe-conf-0.1.20/password-if.patch
parent87ec8ca4d2e2eb4d1c1e1e1a6b46a395d56805b9 (diff)
downloadopenembedded-c8e5702127e507e82e6f68a4b8c546803accea9d.tar.gz
import clean BK tree at cset 1.3670
Diffstat (limited to 'packages/gpe-conf/gpe-conf-0.1.20/password-if.patch')
-rw-r--r--packages/gpe-conf/gpe-conf-0.1.20/password-if.patch442
1 files changed, 442 insertions, 0 deletions
diff --git a/packages/gpe-conf/gpe-conf-0.1.20/password-if.patch b/packages/gpe-conf/gpe-conf-0.1.20/password-if.patch
index e69de29bb2..1e1b578cd3 100644
--- a/packages/gpe-conf/gpe-conf-0.1.20/password-if.patch
+++ b/packages/gpe-conf/gpe-conf-0.1.20/password-if.patch
@@ -0,0 +1,442 @@
+Index: cfgfile.c
+===================================================================
+RCS file: /cvs/gpe/base/gpe-conf/cfgfile.c,v
+retrieving revision 1.13
+diff -u -r1.13 cfgfile.c
+--- cfgfile.c 29 Aug 2004 13:20:25 -0000 1.13
++++ cfgfile.c 16 Oct 2004 15:50:30 -0000
+@@ -436,26 +436,28 @@
+ iflen = l;
+
+ fd = fopen(_PATH_PROCNET_WIRELESS, "r");
+- fgets(buffer, 256, fd); // chuck first two lines;
+- fgets(buffer, 256, fd);
+- while (!feof(fd)) {
+- if (fgets(buffer, 256, fd) == NULL)
+- break;
+- name = buffer;
+- sep = strrchr(buffer, ':');
+- if (sep) *sep = 0;
+- while(*name == ' ') name++;
+-
+- for (i = 0; i < iflen; i++)
+- {
+- if (!strcmp (name, iflist[i].name))
++ if (fd)
++ {
++ fgets(buffer, 256, fd); // chuck first two lines;
++ fgets(buffer, 256, fd);
++ while (!feof(fd)) {
++ if (fgets(buffer, 256, fd) == NULL)
++ break;
++ name = buffer;
++ sep = strrchr(buffer, ':');
++ if (sep) *sep = 0;
++ while(*name == ' ') name++;
++
++ for (i = 0; i < iflen; i++)
+ {
+- iflist[i].iswireless = TRUE;
++ if (!strcmp (name, iflist[i].name))
++ {
++ iflist[i].iswireless = TRUE;
++ }
+ }
+ }
++ fclose(fd);
+ }
+- fclose(fd);
+-
+ return l;
+ }
+
+Index: main.c
+===================================================================
+RCS file: /cvs/gpe/base/gpe-conf/main.c,v
+retrieving revision 1.69
+diff -u -r1.69 main.c
+--- main.c 10 Oct 2004 21:48:39 -0000 1.69
++++ main.c 16 Oct 2004 15:50:30 -0000
+@@ -188,6 +188,9 @@
+ self.cur_applet = i;
+
+ self.applet = applets[i].Build_Objects(useronly);
++
++ if (self.applet)
++ {
+ gtk_container_add(GTK_CONTAINER(self.viewport),self.applet);
+
+ gtk_window_set_title(GTK_WINDOW(self.w), applets[i].frame_label);
+@@ -220,6 +223,7 @@
+ }
+ else
+ gtk_widget_hide(self.cancel);
++ }
+ }
+
+
+@@ -289,9 +293,11 @@
+ void main_one(int argc, char **argv,int applet)
+ {
+ int handled = FALSE;
+- gboolean user_only_setup = FALSE; /* Don't change to suid mode. */
++ gboolean special_flag = FALSE; /* Don't change to suid mode or similar. */
++ gboolean standalone = FALSE; /* applet creates its own window */
+
+ self.alone_applet = 1;
++ self.applet = NULL;
+
+ my_icons[count_icons - 1].filename = applets[applet].icon_file;
+
+@@ -315,7 +321,12 @@
+ }
+ if (!strcmp(argv[2],"user_only"))
+ {
+- user_only_setup = TRUE;
++ special_flag = TRUE;
++ }
++ if (!strcmp(argv[2],"password"))
++ {
++ special_flag = TRUE;
++ standalone = TRUE;
+ }
+ if (!strcmp(argv[1],"task_sound"))
+ {
+@@ -331,23 +342,23 @@
+ /* If no task? - start applet */
+ if (!handled)
+ {
+- initwindow();
+-
+- self.vbox = gtk_vbox_new(FALSE,0);
+- gtk_container_add(GTK_CONTAINER(self.w),self.vbox);
+-
+ self.cur_applet = -1;
+- self.applet = NULL;
+-
+- make_container();
+-
+- gpe_set_window_icon(self.w, "icon");
+- gtk_widget_show_all(self.w);
+-
+- gtk_widget_show(self.w);
+-
++ self.applet = NULL; if (!standalone)
++ {
++ initwindow();
++
++ self.vbox = gtk_vbox_new(FALSE,0);
++ gtk_container_add(GTK_CONTAINER(self.w),self.vbox);
++
++ make_container();
++
++ gpe_set_window_icon(self.w, "icon");
++ gtk_widget_show_all(self.w);
++
++ gtk_widget_show(self.w);
++ }
+
+- item_select(user_only_setup, (gpointer)applet);
++ item_select(special_flag, (gpointer)applet);
+ gtk_main();
+ gtk_exit(0);
+ }
+Index: network.c
+===================================================================
+RCS file: /cvs/gpe/base/gpe-conf/network.c,v
+retrieving revision 1.37
+diff -u -r1.37 network.c
+--- network.c 8 Sep 2004 22:14:12 -0000 1.37
++++ network.c 16 Oct 2004 15:50:30 -0000
+@@ -123,9 +123,34 @@
+ free (buffer);
+ }
+
++void
++copy_new_interfaces(void)
++{
++ struct interface *ife;
++ struct interface *int_list;
++
++ int_list = if_getlist ();
++
++ system_printf ("/bin/cp %s %s", NET_NEWFILE, NET_CONFIGFILE);
++ system_printf ("chmod 0644 %s", NET_CONFIGFILE);
++ system_printf ("/bin/rm -f %s", NET_NEWFILE);
++
++ for (ife = int_list; ife; ife = ife->next)
++ {
++ if ((ife->flags & IFF_UP) && !(ife->flags & IFF_LOOPBACK))
++ {
++ gchar *cmd = g_strdup_printf("/sbin/ifdown %s", ife->name);
++ system(cmd);
++ g_free(cmd);
++ cmd = g_strdup_printf("/sbin/ifup %s", ife->name);
++ system(cmd);
++ g_free(cmd);
++ }
++ }
++}
+
+ static GList *
+-get_unconfigured_interfaces ()
++get_unconfigured_interfaces (void)
+ {
+ #define num_suggestions 3
+
+@@ -139,34 +164,34 @@
+ gchar suggestions[num_suggestions][6] = {"eth0", "wlan0", "bnep0"};
+
+ fd = fopen(_PATH_PROCNET_DEV, "r");
+- fgets(buffer, 256, fd); // chuck first two lines;
+- fgets(buffer, 256, fd);
+- while (!feof(fd)) {
+- if (fgets(buffer, 256, fd) == NULL)
+- break;
+- name = buffer;
+- sep = strrchr(buffer, ':');
+- if (sep) *sep = 0;
+- while(*name == ' ') name++;
+-
+- found = FALSE;
+- for (i = 0; i < iflen; i++)
+- {
+- if (!strcmp (name, iflist[i].name))
+- {
+- found = TRUE;
++ if (fd)
++ {
++ fgets(buffer, 256, fd); // chuck first two lines;
++ fgets(buffer, 256, fd);
++ while (!feof(fd)) {
++ if (fgets(buffer, 256, fd) == NULL)
+ break;
++ name = buffer;
++ sep = strrchr(buffer, ':');
++ if (sep) *sep = 0;
++ while(*name == ' ') name++;
++
++ found = FALSE;
++ for (i = 0; i < iflen; i++)
++ {
++ if (!strcmp (name, iflist[i].name))
++ {
++ found = TRUE;
++ break;
++ }
++ }
++ if (!found)
++ {
++ result = g_list_append (result, g_strdup (name));
+ }
+ }
+- if (!found)
+- {
+- result = g_list_append (result, g_strdup (name));
+- }
+-
+-
++ fclose(fd);
+ }
+- fclose(fd);
+-
+ for (j = 0; j < num_suggestions; j++)
+ {
+ found = FALSE;
+Index: suid.c
+===================================================================
+RCS file: /cvs/gpe/base/gpe-conf/suid.c,v
+retrieving revision 1.51
+diff -u -r1.51 suid.c
+--- suid.c 12 Oct 2004 21:07:02 -0000 1.51
++++ suid.c 16 Oct 2004 15:50:30 -0000
+@@ -45,6 +45,7 @@
+ #include "cardinfo.h"
+ #include "timeanddate.h"
+ #include "users/passwd.h"
++#include "network.h"
+
+ static GtkWidget *passwd_entry;
+ static int retv;
+@@ -359,13 +360,7 @@
+ else if (strcmp (cmd, "CPIF") == 0) // installs a new interfaces file
+ {
+ fscanf (in, "%100s", arg2); // to forget soon...
+- strcpy (arg1, "/tmp/interfaces");
+- strcpy (arg2, "/etc/network/interfaces");
+- system ("/etc/init.d/networking stop");
+- system_printf ("/bin/cp %s %s", arg1, arg2);
+- system_printf ("chmod 0644 %s", arg2);
+- system_printf ("/bin/rm -f %s", arg1);
+- system ("/etc/init.d/networking start");
++ copy_new_interfaces();
+ }
+ else if (strcmp (cmd, "CPOI") == 0) // rewrites owner information data
+ {
+Index: network.h
+===================================================================
+RCS file: /cvs/gpe/base/gpe-conf/network.h,v
+retrieving revision 1.4
+diff -u -r1.4 network.h
+--- network.h 25 Aug 2004 10:16:31 -0000 1.4
++++ network.h 16 Oct 2004 15:50:30 -0000
+@@ -1,3 +1,6 @@
++#ifndef _GPE_CONF_NETWORK_H
++#define _GPE_CONF_NETWORK_H
++
+ #define _PATH_PROCNET_DEV "/proc/net/dev"
+ #define _PATH_PROCNET_WIRELESS "/proc/net/wireless"
+
+@@ -5,3 +8,6 @@
+ void Network_Save();
+ void Network_Free_Objects();
+ void Network_Restore();
++void copy_new_interfaces(void);
++
++#endif
+Index: users.h
+===================================================================
+RCS file: /cvs/gpe/base/gpe-conf/users.h,v
+retrieving revision 1.2
+diff -u -r1.2 users.h
+--- users.h 7 Sep 2002 22:34:06 -0000 1.2
++++ users.h 16 Oct 2004 15:50:30 -0000
+@@ -1,4 +1,4 @@
+-GtkWidget *Users_Build_Objects();
++GtkWidget *Users_Build_Objects(gboolean password_only);
+ void Users_Save();
+ void Users_Free_Objects();
+ void Users_Restore();
+Index: users/interface.c
+===================================================================
+RCS file: /cvs/gpe/base/gpe-conf/users/interface.c,v
+retrieving revision 1.22
+diff -u -r1.22 interface.c
+--- users/interface.c 8 Sep 2004 22:14:12 -0000 1.22
++++ users/interface.c 16 Oct 2004 15:50:30 -0000
+@@ -202,15 +202,15 @@
+ }
+
+ GtkWidget*
+-Users_Build_Objects (void)
++Users_Build_Objects (gboolean password_only)
+ {
+- GtkWidget *vbox1;
+- GtkWidget *pw;
+- GtkWidget *toolbar;
+- GtkWidget *button1;
+- GtkWidget *button2;
+- GtkWidget *button3;
+- GtkWidget *button4;
++ GtkWidget *vbox1 = NULL;
++ GtkWidget *pw = NULL;
++ GtkWidget *toolbar = NULL;
++ GtkWidget *button1 = NULL;
++ GtkWidget *button2 = NULL;
++ GtkWidget *button3 = NULL;
++ GtkWidget *button4 = NULL;
+
+ listTitles[0] = _("User Name");
+ listTitles[1] = _("User Info");
+@@ -218,6 +218,8 @@
+
+ InitSpacings ();
+
++ if (!password_only)
++ {
+ vbox1 = gtk_vbox_new (FALSE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (vbox1), border_width);
+
+@@ -254,28 +256,40 @@
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(pw),
+ GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_container_add (GTK_CONTAINER (pw), user_list);
++ }
+
+ InitPwList();
+- ReloadList();
++ if (!password_only)
++ {
++ ReloadList();
+
+- gtk_widget_show (user_list);
+-
+- gtk_box_pack_start (GTK_BOX (vbox1), pw, TRUE, TRUE, 0);
++ gtk_widget_show (user_list);
++ gtk_box_pack_start (GTK_BOX (vbox1), pw, TRUE, TRUE, 0);
+
+- /* check if we have the permissions to change users */
+- if (suid_exec("CHEK",""))
+- {
+- gtk_widget_set_sensitive(user_list, FALSE);
+- gtk_widget_set_sensitive(button1, FALSE);
+- gtk_widget_set_sensitive(button2, FALSE);
+- gtk_widget_set_sensitive(button3, FALSE);
+- have_access = FALSE;
+- }
++ /* check if we have the permissions to change users */
++ if (suid_exec("CHEK",""))
++ {
++ gtk_widget_set_sensitive(user_list, FALSE);
++ gtk_widget_set_sensitive(button1, FALSE);
++ gtk_widget_set_sensitive(button2, FALSE);
++ gtk_widget_set_sensitive(button3, FALSE);
++ have_access = FALSE;
++ }
++ else
++ {
++ have_access = TRUE;
++ }
++ }
+ else
+- {
+- have_access = TRUE;
+- }
+- return vbox1;
++ have_access = FALSE;
++
++ if (password_only)
++ {
++ gtk_widget_show(create_passwindow(pwroot, NULL));
++ return NULL;
++ }
++ else
++ return vbox1;
+ }
+
+ GtkWidget*
+@@ -440,7 +454,7 @@
+ }
+
+ GtkWidget*
+-create_passwindow (pwlist *init,GtkWidget *parent)
++create_passwindow (pwlist *init, GtkWidget *parent)
+ {
+ GtkWidget *passwindow;
+ GtkWidget *vbox3;
+@@ -463,9 +477,8 @@
+ gtk_window_set_transient_for (GTK_WINDOW(passwindow), GTK_WINDOW(parent));
+ gtk_window_set_title (GTK_WINDOW (passwindow), _("Change Password"));
+ gtk_window_set_modal (GTK_WINDOW (passwindow), TRUE);
+-
+ vbox3 = GTK_DIALOG (passwindow)->vbox;
+-
++
+ table3 = gtk_table_new (3, 3, FALSE);
+
+ gtk_widget_show (table3);
+@@ -561,9 +574,12 @@
+ GTK_SIGNAL_FUNC (users_on_changepasswd_clicked),
+ (gpointer)self);
+
+- /* in case of destruction by close (X) button */
+- gtk_signal_connect (GTK_OBJECT(passwindow) , "destroy",
++ if (parent)
++ gtk_signal_connect (GTK_OBJECT(passwindow) , "destroy",
+ (GtkSignalFunc) freedata, (gpointer)self);
++ else
++ gtk_signal_connect (GTK_OBJECT(passwindow) , "destroy",
++ gtk_main_quit, NULL);
+
+ return passwindow;
+ }