RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 819244 - functions not returning actual return codes
Summary: functions not returning actual return codes
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: PyPAM
Version: 6.4
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: Red Hat Satellite QA List
URL:
Whiteboard:
Depends On:
Blocks: 836169 947782 1159825
TreeView+ depends on / blocked
 
Reported: 2012-05-05 21:47 UTC by Ted X Toth
Modified: 2016-07-21 11:23 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-21 11:23:41 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Ted X Toth 2012-05-05 21:47:23 UTC
Description of problem:
acct_mgmt and other functions don't return the actual return code so you can't handle situations like password expiration because you never get PAM.PAM_NEW_AUTHTOK_REQD. I think all function should use PyPAM_Err to return their actual return code.

Version-Release number of selected component (if applicable):


How reproducible:
Using the System->Administration->Users and Groups set  User Properties->Password Info->'Force password change on next login' on some user then run the test code supplied. 'acct_mgmt' will throw an exception but does not supply 'code' which is needed to figure out what to do next.

Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Test code:

#!/usr/bin/env python

import sys
import PAM
from getpass import getpass

def pam_conv(auth, query_list):

    resp = []

    print query_list

    for i in range(len(query_list)):
        query, type = query_list[i]
        if type == PAM.PAM_PROMPT_ECHO_ON:
            val = raw_input(query)
            resp.append((val, 0))
        elif type == PAM.PAM_PROMPT_ECHO_OFF:
            val = getpass(query)
            resp.append((val, 0))
        elif type == PAM.PAM_PROMPT_ERROR_MSG or type == PAM.PAM_PROMPT_TEXT_INFO:
            print query
            resp.append(('', 0));
        else:
            return None

    return resp

service = 'passwd'

if len(sys.argv) == 2:
    user = sys.argv[1]
else:
    user = None

auth = PAM.pam()
auth.start(service)

if user != None:
    auth.set_item(PAM.PAM_USER, user)

auth.set_item(PAM.PAM_CONV, pam_conv)

try:
    auth.authenticate()
    auth.acct_mgmt()
except PAM.error, (resp, code):
    print 'Exception: (%s)' % resp

if code == PAM.PAM_NEW_AUTHTOK_REQD:
    while True:
        try:
            auth.chauthtok(PAM.PAM_CHANGE_EXPIRED_AUTHTOK)
        except PAM.error, (resp, code):
            print resp, code
        if code == PAM.PAM_AUTHTOK_ERR or code == PAM.PAM_TRY_AGAIN:
            continue
        else:
            break

auth.setcred(PAM.PAM_ESTABLISH_CRED)

Comment 6 Tomas Mraz 2016-07-21 11:23:41 UTC
This is fixed in Red Hat Enterprise Linux 7.


Note You need to log in before you can comment on or make changes to this bug.