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

« back to all changes in this revision

Viewing changes to ivle/makeuser.py

  • Committer: Matt Giuca
  • Date: 2010-02-11 05:54:45 UTC
  • Revision ID: matt.giuca@gmail.com-20100211055445-151qrs4xczzl5rns
Docs: Completed Tour of IVLE (finished Admin section). Apologies for the mess on the previous commit -- committed an unfinished document.

Show diffs side-by-side

added added

removed removed

Lines of Context:
211
211
    """
212
212
    # filename is, eg, /var/lib/ivle/svn/ivle.auth
213
213
    filename = config['paths']['svn']['auth_ivle']
214
 
    passwd = hashlib.md5(uuid.uuid4().bytes).hexdigest()
215
214
    if os.path.exists(filename):
216
215
        create = ""
217
216
    else:
218
217
        create = "c"
219
218
 
220
219
    user = User.get_by_login(store, login)
221
 
    user.svn_pass = unicode(passwd)
 
220
 
 
221
    if user.svn_pass is None:
 
222
        passwd = hashlib.md5(uuid.uuid4().bytes).hexdigest()
 
223
        user.svn_pass = unicode(passwd)
222
224
 
223
225
    res = subprocess.call(['htpasswd', '-%smb' % create,
224
 
                           filename, login, passwd])
 
226
                           filename, login, user.svn_pass])
225
227
    if res != 0 and throw_on_error:
226
228
        raise Exception("Unable to create ivle-auth for %s" % login)
227
229
 
229
231
    if create == "c":
230
232
        chown_to_webserver(filename)
231
233
 
232
 
    return passwd
 
234
    return user.svn_pass
233
235
 
234
236
def make_jail(user, config, force=True):
235
237
    """Create or update a user's jail.
267
269
        # User jail already exists. Blow it away but preserve their home
268
270
        # directory. It should be all that is there anyway, but you never
269
271
        # know!
270
 
        # Ignore warnings about the use of tmpnam
 
272
        # Ignore warnings about the use of tempnam
271
273
        warnings.simplefilter('ignore')
272
274
        homebackup = os.tempnam(tempdir)
273
275
        warnings.resetwarnings()