Changeset 186 in openpam for trunk


Ignore:
Timestamp:
Dec 12, 2002, 5:04:04 PM (17 years ago)
Author:
Dag-Erling Smørgrav
Message:

Record which primitive is currently executing before calling the
service module. Use that information to generate a much better
error message when indirect recursion is detected.

Instrument openpam_dispatch()'s entry and exit points.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/openpam_dispatch.c

    r161 r186  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_dispatch.c#17 $
     34 * $P4: //depot/projects/openpam/lib/openpam_dispatch.c#18 $
    3535 */
    3636
     
    6161        int err, fail, r;
    6262
     63        ENTER();
    6364        if (pamh == NULL)
    64                 return (PAM_SYSTEM_ERR);
     65                RETURNC(PAM_SYSTEM_ERR);
    6566
    6667        /* prevent recursion */
    6768        if (pamh->current != NULL) {
    68                 openpam_log(PAM_LOG_ERROR, "indirect recursion");
    69                 return (PAM_ABORT);
     69                openpam_log(PAM_LOG_ERROR,
     70                    "%s() called while %s::%s() is in progress",
     71                    _pam_func_name[primitive],
     72                    pamh->current->module->path,
     73                    _pam_sm_func_name[pamh->primitive]);
     74                RETURNC(PAM_ABORT);
    7075        }
    7176
     
    8792                break;
    8893        default:
    89                 return (PAM_SYSTEM_ERR);
     94                RETURNC(PAM_SYSTEM_ERR);
    9095        }
    9196
     
    99104                        continue;
    100105                } else {
     106                        pamh->primitive = primitive;
    101107                        pamh->current = chain;
    102108                        r = (chain->module->func[primitive])(pamh, flags,
     
    154160        if (!fail && err != PAM_NEW_AUTHTOK_REQD)
    155161                err = PAM_SUCCESS;
    156         openpam_log(PAM_LOG_DEBUG, "returning: %s", pam_strerror(pamh, err));
    157         return (err);
     162        RETURNC(err);
    158163}
    159164
Note: See TracChangeset for help on using the changeset viewer.