Ignore:
Timestamp:
29/06/06 16:40:28 (13 years ago)
Author:
spascoe
Message:

Client-side authentication handling is implemented but currently broken.
I'm still working out what's wrong.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/test/runclient.py

    r1248 r1259  
    66""" 
    77 
    8 import os, sys 
     8import os, sys, time 
    99from glob import glob 
    1010 
    1111HOME = os.path.abspath(os.getenv('NDG_DELIVERY_HOME', os.curdir)) 
    1212BUILDDIR = glob('%s/build/lib.*' % HOME)[0] 
     13VERSION = open('%s/VERSION' % HOME).read() 
     14NDG_MESSAGE_LEN = 256 
     15 
     16NDG_HANDSHAKE = "NDG-Delivery-server %s" % VERSION 
     17 
     18 
    1319sys.path.append(BUILDDIR) 
    1420 
    1521import delivery.bbftpc as BC 
     22 
     23 
     24class AuthClientHandler(object): 
     25    def __init__(self, privatestr=""): 
     26        self.privatestr = privatestr 
     27 
     28    def authenticate(self): 
     29        print >>sys.stderr, "Waiting 20s for gdb connect: pid=%d" % os.getpid(), 
     30        time.sleep(20) 
     31        print >>sys.stderr, "continueing" 
     32 
     33        BC.send(NDG_HANDSHAKE) 
     34        resp = BC.recv() 
     35 
     36        BC.send(self.privatestr) 
     37 
     38        return True 
     39 
    1640 
    1741# Extract the command (-e) since bbftpc doesn't use it any more 
     
    2852    args = args[:ei] + args[ei+2:] 
    2953 
    30 BC.connect(args) 
     54try: 
     55    i = args.index('-P') 
     56except ValueError: 
     57    privatestr = "" 
     58    pass 
     59else: 
     60    privatestr = args[i+1] 
     61    args = args[:i] + args[i+2:] 
     62 
     63ach = AuthClientHandler(privatestr) 
     64 
     65BC.connect(ach, args) 
    3166for cmd in cmds: 
    3267    BC.docommand(cmd) 
Note: See TracChangeset for help on using the changeset viewer.