]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/gpe-shield/gpe-shield-0.6/backend-iptables.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / gpe-shield / gpe-shield-0.6 / backend-iptables.patch
1 Index: backend.c
2 ===================================================================
3 RCS file: /cvs/gpe/base/gpe-shield/backend.c,v
4 retrieving revision 1.8
5 diff -u -r1.8 backend.c
6 --- backend.c   21 Jun 2004 08:54:53 -0000      1.8
7 +++ backend.c   16 Aug 2004 12:17:54 -0000
8 @@ -41,6 +41,7 @@
9  #define IPTABLES_CMD1 "/usr/sbin/iptables"
10  #define IPTABLES_CMD2 "/sbin/iptables"
11  #define IPTABLES_CMD3 "/usr/local/sbin/iptables"
12 +#define IPTABLES_CMD4 "/usr/bin/iptables"
13  
14  static const char* IPTABLES_CMD = NULL;
15  
16 @@ -144,13 +145,17 @@
17  void
18  do_clear(void)
19  {
20 -       char* cmd = g_strdup_printf("%s %s",IPTABLES_CMD,"--flush");
21 +       char* cmd;
22 +       
23 +       cmd = g_strdup_printf("%s %s",IPTABLES_CMD,"--flush");
24         system(cmd);
25 +       
26         g_free(cmd);
27         cmd = g_strdup_printf("%s %s",IPTABLES_CMD,"-P INPUT ACCEPT"); /* reset input policy */
28         system(cmd);
29         g_free(cmd);
30         g_free(rule_info);
31 +       
32         rule_info = NULL;
33         rule_count = 0;
34  }
35 @@ -387,6 +392,7 @@
36  
37         pfd[0].fd = sock;
38         pfd[0].events = (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI);
39 +       
40         while (poll (pfd, 1, -1) > 0)
41         {
42                 if ((pfd[0].revents & POLLERR) || (pfd[0].revents & POLLHUP))
43 @@ -497,7 +503,8 @@
44                 IPTABLES_CMD = IPTABLES_CMD2;
45         else if (!access(IPTABLES_CMD3,X_OK))
46                 IPTABLES_CMD = IPTABLES_CMD3;
47 -       
48 +       else if (!access(IPTABLES_CMD4,X_OK))
49 +               IPTABLES_CMD = IPTABLES_CMD4;
50  }
51  
52  /* app mainloop */
53 @@ -505,8 +512,16 @@
54  int
55  suidloop (int csock)
56  {
57 -        find_iptables();
58 -
59 +       find_iptables();
60 +       
61 +       if (IPTABLES_CMD == NULL)
62 +       {
63 +               fprintf(stderr, "Iptables not found, exiting.\n");
64 +               close (sock);
65 +               unlink (PK_SOCKET);
66 +               exit (2);
67 +       }
68 +       
69         sock = csock;
70  
71         while (wait_message ()) ;