Fix a few errors, some more cleanup.

This commit is contained in:
Ricky Zhou (周家杰) 2009-03-13 20:35:20 -04:00
parent 7ed036399a
commit 627a5008de
2 changed files with 26 additions and 26 deletions

View file

@ -5,7 +5,7 @@ to date ;)
Alias /repo/pkgs/ /repo/pkgs/ Alias /repo/pkgs/ /repo/pkgs/
<Directory /repo/pkgs/> <Directory /repo/pkgs/>
SSLVerifyClient optional SSLVerifyClient optional
SSLVerifyDepth 1 SSLVerifyDepth 1
SSLOptions +StrictRequire +StdEnvVars +OptRenegotiate SSLOptions +StrictRequire +StdEnvVars +OptRenegotiate
@ -15,13 +15,13 @@ Alias /repo/pkgs/ /repo/pkgs/
and %{SSL_CLIENT_S_DN_O} eq "Fedora Project" \ and %{SSL_CLIENT_S_DN_O} eq "Fedora Project" \
and %{SSL_CLIENT_I_DN_O} eq "Fedora Project" \ and %{SSL_CLIENT_I_DN_O} eq "Fedora Project" \
and %{SSL_CLIENT_I_DN_OU} eq "Upload Files" ) and %{SSL_CLIENT_I_DN_OU} eq "Upload Files" )
</Directory> </Directory>
<Location "/repo/pkgs/upload.cgi"> <Location "/repo/pkgs/upload.cgi">
SetHandler cgi-script SetHandler cgi-script
Options ExecCGI Options ExecCGI
Order Allow,Deny Order Allow,Deny
Allow from all Allow from all
SSLRequireSSL SSLRequireSSL
</Location> </Location>

View file

@ -96,8 +96,7 @@ else:
print >> sys.stderr, 'Processing upload request: NAME=%s FILENAME=%s MD5SUM=%s' % (name, filename, md5sum) print >> sys.stderr, 'Processing upload request: NAME=%s FILENAME=%s MD5SUM=%s' % (name, filename, md5sum)
module_dir = os.path.join(CACHE_DIR, name) module_dir = os.path.join(CACHE_DIR, name)
file_dir = os.path.join(module_dir, filename) md5_dir = os.path.join(module_dir, filename, md5sum)
md5_dir = os.path.join(file_dir, md5sum)
# first test if the module really exists # first test if the module really exists
cvs_dir = os.path.join(CVSREPO, name) cvs_dir = os.path.join(CVSREPO, name)
@ -126,19 +125,20 @@ if not os.path.isdir(module_dir):
os.makedirs(module_dir, 02775) os.makedirs(module_dir, 02775)
# grab a temporary filename and dump our file in there # grab a temporary filename and dump our file in there
tempfile.tempdir = my_moddir tempfile.tempdir = module_dir
tmpfile = tempfile.mktemp(md5sum) tmpfile = tempfile.mktemp(md5sum)
tmpfd = open(tmpfile, 'w') tmpfd = open(tmpfile, 'w')
# now read the whole file in # now read the whole file in
m = md5_constructor() m = md5_constructor()
filesize = 0 filesize = 0
while s = upload_file.file.read(BUFFER_SIZE): while True:
if not s: data = upload_file.file.read(BUFFER_SIZE)
if not data:
break break
tmpfd.write(s) tmpfd.write(data)
m.update(s) m.update(data)
filesize += len(s) filesize += len(data)
# now we're done reading, check the MD5 sum of what we got # now we're done reading, check the MD5 sum of what we got
tmpfd.close() tmpfd.close()