Changeset 7036 for TI12-security/trunk


Ignore:
Timestamp:
18/06/10 16:28:16 (9 years ago)
Author:
spascoe
Message:

Forgot redirecting stdout doesn't allow you to see the password prompt.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/MyProxyClient/myproxy/script.py

    r7035 r7036  
    2828 
    2929def make_optparser(): 
    30     usage = "usage: %prog [options] username" 
     30    usage = "usage: %prog [options] [proxyfile]" 
    3131    op = optparse.OptionParser(usage=usage) 
    3232 
     
    5151    op.add_option('-k', '--keyfile', dest='keyfile',  
    5252                  action='store', type='string', metavar='KEYFILE', 
    53                   help='Write the private key to KEYFILE rather than stdout') 
     53                  help='Write the private key to KEYFILE rather than proxyfile') 
    5454    op.add_option('-c', '--certfile', dest='certfile', 
    5555                  action='store', type='string', metavar='CERTFILE', 
    56                   help='Write the proxy certificate to CERTFILE rather than stdout') 
     56                  help='Write the proxy certificate to CERTFILE rather than proxyfile') 
    5757    op.add_option('-O', '--openid', dest='openid', 
    5858                  action='store', type='string', metavar='OPENID', 
     
    8282 
    8383    options, args = op.parse_args(argv[1:]) 
    84     #!NOTE: no arguments 
     84    if args: 
     85        outfile = args[0] 
     86    else: 
     87        outfile = None 
    8588 
    8689    if options.openid: 
     
    114117    cert, key = creds 
    115118 
     119    if outfile: 
     120        fout = open(outfile, 'w') 
     121    else: 
     122        fout = sys.stdout 
     123 
    116124    if options.certfile: 
    117125        fh = open(options.certfile, 'w') 
     
    119127        fh.close() 
    120128    else: 
    121         sys.stdout.write(cert) 
     129        fout.write(cert) 
    122130 
    123131    if options.keyfile: 
     
    126134        fh.close() 
    127135    else: 
    128         sys.stdout.write(key) 
     136        fout.write(key) 
    129137 
    130138 
Note: See TracChangeset for help on using the changeset viewer.