Changeset 2786

Show
Ignore:
Timestamp:
03/05/06 22:16:17 (18 years ago)
Author:
jerome
Message:

Combining cupspykota, pknotify and PyKotIcon? now work fine to check user's credentials.

Location:
pykota/trunk/bin
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/cupspykota

    r2766 r2786  
    295295            self.logdebug("Launching subprocess [%s] to overwrite the job ticket." \ 
    296296                                     % jobticketcommand) 
     297            self.regainPriv()                          
    297298            inputfile = os.popen(jobticketcommand, "r") 
    298299            for line in inputfile.xreadlines() : 
    299300                line = line.strip() 
    300                 if line == "DENY" : 
    301                     self.logdebug("Seen DENY command.") 
     301                if line in ("DENY", "AUTH=NO", "AUTH=IMPOSSIBLE") : 
     302                    self.logdebug("Seen %s command." % line) 
    302303                    action = "DENY" 
    303304                elif line == "CANCEL" : 
     
    313314                    action = None 
    314315            inputfile.close()     
     316            self.dropPriv() 
    315317             
    316318            # now overwrite the job's ticket if new data was supplied 
  • pykota/trunk/bin/pknotify

    r2785 r2786  
    6161                             user. Then pknotify will output the result. 
    6262                        
    63   -C | --checkauth           When --ask is used and an 'username' and a  
     63  -C | --checkauth           When --ask is used and both an 'username' and a 
    6464                             'password' are asked to the end user, then 
    6565                             pknotify will try to authenticate the user 
     
    6767                             will print "AUTH=YES", else "AUTH=NO". 
    6868                             If a field is missing, "AUTH=IMPOSSIBLE" will 
    69                              be printed. 
     69                             be printed. If the user is authenticated, then 
     70                             "USERNAME=xxxx" will be printed as well. 
    7071                              
    7172  -c | --confirm             Tells pknotify to ask for either a confirmation                        
     
    188189                result = server.askDatas(labels, varnames, varvalues)     
    189190                if result["isValid"] : 
    190                     for varname in varnames : 
    191                         result[varname] = result[varname].data 
    192                         if (varname != "password") : 
    193                             print "%s=%s" % (varname.upper(), result[varname]) 
     191                    authok = None 
    194192                    if options["checkauth"] : 
    195193                        if ("username" in varnames) and ("password" in varnames) : 
    196                             if self.checkAuth(result["username"], result["password"]) : 
    197                                 print "AUTH=YES" 
     194                            if self.checkAuth(result["username"].data, result["password"].data) : 
     195                                authok = "AUTH=YES" 
    198196                            else :     
    199                                 print "AUTH=NO" 
     197                                authok = "AUTH=NO" 
    200198                        else :         
    201                             print "AUTH=IMPOSSIBLE" 
     199                            authok = "AUTH=IMPOSSIBLE"         
     200                    for varname in varnames : 
     201                        if (varname != "password") \ 
     202                           and ((varname != "username") or (authok == "AUTH=YES")) : 
     203                            print "%s=%s" % (varname.upper(), result[varname].data) 
     204                    if authok is not None :         
     205                        print authok         
    202206            elif options["confirm"] : 
    203207                print server.showDialog(self.sanitizeMessage(arguments[0]), True)