Changeset 101 in openpam for trunk/lib/pam_get_authtok.c


Ignore:
Timestamp:
Apr 6, 2002, 5:17:44 PM (19 years ago)
Author:
Dag-Erling Smørgrav
Message:

Plug memory leak, reduce differences between these very similar
functions, and {add,tweak} documentation.

Sponsored by: DARPA, NAI Labs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/pam_get_authtok.c

    r100 r101  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_get_authtok.c#13 $
     34 * $P4: //depot/projects/openpam/lib/pam_get_authtok.c#14 $
    3535 */
    3636
    3737#include <sys/param.h>
     38
     39#include <stdlib.h>
    3840
    3941#include <security/pam_appl.h>
     
    9698        if (r != PAM_SUCCESS)
    9799                return (r);
    98         *authtok = resp;
    99         return (pam_set_item(pamh, item, *authtok));
     100        r = pam_set_item(pamh, pitem, resp);
     101        free(resp);
     102        if (r != PAM_SUCCESS)
     103                return (r);
     104        return (pam_get_item(pamh, pitem, (const void **)authtok));
    100105}
    101106
     
    125130 *
    126131 * The =prompt argument specifies a prompt to use if no token is cached.
    127  * If =NULL, the =PAM_AUTHTOK_PROMPT or =PAM_OLDAUTHTOK_PROMPT item, as
    128  * appropriate, will be used.  If that item is also =NULL, a hardcoded
     132 * If it is =NULL, the =PAM_AUTHTOK_PROMPT or =PAM_OLDAUTHTOK_PROMPT item,
     133 * as appropriate, will be used.  If that item is also =NULL, a hardcoded
    129134 * default prompt will be used.
    130135 *
    131136 * >pam_get_item
     137 * >pam_get_user
    132138 */
Note: See TracChangeset for help on using the changeset viewer.