]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
- 'public' (from www iface) connections must try to log in before doing
authorMariusz Mazur <mmazur@pld-linux.org>
Mon, 10 Jan 2005 19:08:53 +0000 (19:08 +0000)
committerMariusz Mazur <mmazur@pld-linux.org>
Mon, 10 Jan 2005 19:08:53 +0000 (19:08 +0000)
  anything else, or they will be terminated

Changed files:
    ftpiod/ftpiod.py -> 1.3
    modules/cmds.py -> 1.4
    modules/cons.py -> 1.3

ftpiod/ftpiod.py
modules/cmds.py
modules/cons.py

index 5411cfbc7beccf6df30cfe685eee6b7a919bc469..1726904b022bd0d27c6d720da4a9dd3857f73b08 100755 (executable)
@@ -27,10 +27,10 @@ while True:
     for readable in cons.readables():
         if readable==cons.privlistener:
             newsock,addr=readable.accept()
-            cons.add(cons.Connection(newsock, False))
+            cons.add(cons.Connection(newsock, True))
         elif readable==cons.publistener:
             newsock,addr=readable.accept()
-            cons.add(cons.Connection(newsock, True))
+            cons.add(cons.Connection(newsock, False))
         else:
             readable.handleinput()
 
index 46bb55b286bcadc746246305615841229700164e..e58d3fbf0f85543d3f05c38ce971160579e23e16 100644 (file)
@@ -3,7 +3,7 @@
 import os
 import time
 
-CmdError="CmdError"
+BailOut="BailOut"
 
 def parse(con):
     if '\0' not in con.data:
@@ -13,10 +13,13 @@ def parse(con):
     for cmd in cmds:
         con.data=con.data[len(cmd)+1:]
         cmdname=cmd[:4]
+        if not con.authorized and not (cmdname=='linp' or cmdname=='linc'):
+            raise BailOut
+            # TODO: log unauthorized access
         if cmdname in cmdlist:
             cmdlist[cmdname](con, cmd[5:])
         else:
-            raise CmdError
+            raise BailOut
             # TODO: log this
 
 locks={}
index f7b1159dad4ae9195ca9e0139d1e0a5462da9e63..6fc02f27d5b303f3de6c8116edd9b4344a215aef 100644 (file)
@@ -25,7 +25,7 @@ class Connection:
         self.data=self.data+newdata
         try:
             cmds.parse(self)
-        except cmds.CmdError:
+        except cmds.BailOut:
             self.destroy()
 
 def add(con):
This page took 0.425867 seconds and 4 git commands to generate.