~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to src/bin/python-server

  • Committer: drtomc
  • Date: 2007-12-19 00:00:09 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:84
Add some auth fu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
        while i != -1:
28
28
            l = buf[0:i]
29
29
            yield l
30
 
            buf = buf[i+1:]
 
30
            buf = buf[i+2:]
31
31
            i = buf.find('\r\n')
32
32
        s = sok.recv(4096)
33
33
 
 
34
def auth_lines(lines, magic):
 
35
    for line in lines:
 
36
        digest = line[0:32]
 
37
        txt = line[32:]
 
38
        sum = md5.new(txt + magic).digest().encode('hex')
 
39
        if sum != digest:
 
40
            raise Exception, "digest failed!"
 
41
        yeild txt
 
42
 
34
43
shutup_shop_on_timeout = False
35
44
keep_going = True
36
45
 
113
122
        sys.exit(1)
114
123
 
115
124
    # establish the chrooted environment
116
 
    setup_environment(uid, jail, cwd)
 
125
    jail.setup(uid, jail, cwd)
117
126
 
118
127
    signal.signal(signal.SIGALRM, timeout)
119
128
 
142
151
 
143
152
        try:
144
153
            first = True
 
154
            # for line in auth_lines(req_lines(new_sok), magic):
145
155
            for line in req_lines(new_sok):
146
156
                if first:
147
157
                    src = line