chiark / gitweb /
Introduce transform_apply_return_badseq
[secnet.git] / make-secnet-sites
index ebf7468cdfa90e2960ff2999a91ae55ccde03b6d..5f271e3bc80731c27fe112d6b2c7c62191ae2bbc 100755 (executable)
@@ -1,19 +1,21 @@
 #! /usr/bin/env python
-# Copyright (C) 2001-2002 Stephen Early <steve@greenend.org.uk>
 #
-# 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
+# This file is part of secnet.
+# See README for full list of copyright holders.
+#
+# secnet 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 3 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.
+# secnet 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
+# version 3 along with secnet; if not, see
+# https://www.gnu.org/licenses/gpl.html.
 
 """VPN sites file manipulation.
 
@@ -265,7 +267,6 @@ class sitelevel(level):
         'networks':None,
         'peer':None,
         'pubkey':(lambda n,v:"key %s;\n"%v),
-        'address':(lambda n,v:"address %s;\n"%v),
         'mobile':sp,
        })
        require_properties={
@@ -379,13 +380,16 @@ def pline(i,allow_include=False):
                        current=nl
                obstack.append(current)
                return [i]
-       if current.allow_properties.has_key(keyword):
-               set_property(current,w)
-               return [i]
-       else:
+       if not current.allow_properties.has_key(keyword):
                complain("Property %s not allowed at %s level"%
                        (keyword,current.type))
                return []
+       elif current.depth == vpnlevel.depth < allow_defs:
+               complain("Not allowed to set VPN properties here")
+               return []
+       else:
+               set_property(current,w)
+               return [i]
 
        complain("unknown keyword '%s'"%(keyword))