{
    "content": [
        {
            "type": "text",
            "text": "# PAM_GET_AUTHTOK(3) (man)\n\n**Summary:** pamgetauthtok, pamgetauthtokverify, pamgetauthtoknoverify - get authentication token\n\n**Synopsis:** #include <security/pamext.h>\nint pamgetauthtok(pamhandlet *pamh, int item, const char authtok, const char *prompt);\nint pamgetauthtoknoverify(pamhandlet *pamh, const char authtok, const char *prompt);\nint pamgetauthtokverify(pamhandlet *pamh, const char authtok, const char *prompt);\n\n## See Also\n\n- pam(7)\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **SYNOPSIS** (8 lines)\n- **DESCRIPTION** (32 lines)\n- **OPTIONS** (20 lines)\n- **RETURN VALUES** (15 lines)\n- **SEE ALSO** (2 lines)\n- **STANDARDS** (5 lines)\n\n## Full Content\n\n### NAME\n\npamgetauthtok, pamgetauthtokverify, pamgetauthtoknoverify - get authentication token\n\n### SYNOPSIS\n\n#include <security/pamext.h>\n\nint pamgetauthtok(pamhandlet *pamh, int item, const char authtok, const char *prompt);\n\nint pamgetauthtoknoverify(pamhandlet *pamh, const char authtok, const char *prompt);\n\nint pamgetauthtokverify(pamhandlet *pamh, const char authtok, const char *prompt);\n\n### DESCRIPTION\n\nThe pamgetauthtok function returns the cached authentication token, or prompts the user if\nno token is currently cached. It is intended for internal use by Linux-PAM and PAM service\nmodules. Upon successful return, authtok contains a pointer to the value of the\nauthentication token. Note, this is a pointer to the actual data and should not be free()'ed\nor over-written!\n\nThe prompt argument specifies a prompt to use if no token is cached. If a NULL pointer is\ngiven, pamgetauthtok uses pre-defined prompts.\n\nThe following values are supported for item:\n\nPAMAUTHTOK\nReturns the current authentication token. Called from pamsmchauthtok(3) pamgetauthtok\nwill ask the user to confirm the new token by retyping it. If a prompt was specified,\n\"Retype\" will be used as prefix.\n\nPAMOLDAUTHTOK\nReturns the previous authentication token when changing authentication tokens.\n\nThe pamgetauthtoknoverify function can only be used for changing the password (from\npamsmchauthtok(3)). It returns the cached authentication token, or prompts the user if no\ntoken is currently cached. The difference to pamgetauthtok is, that this function does not\nask a second time for the password to verify it. Upon successful return, authtok contains a\npointer to the value of the authentication token. Note, this is a pointer to the actual data\nand should not be free()'ed or over-written!\n\nThe pamgetauthtokverify function can only be used to verify a password for mistypes gotten\nby pamgetauthtoknoverify(3). This function asks a second time for the password and verify\nit with the password provided by authtok argument. In case of an error, the value of authtok\nis undefined. Else this argument will point to the actual data and should not be free()'ed or\nover-written!\n\n### OPTIONS\n\npamgetauthtok honours the following module options:\n\ntryfirstpass\nBefore prompting the user for their password, the module first tries the previous stacked\nmodule's password in case that satisfies this module as well.\n\nusefirstpass\nThe argument usefirstpass forces the module to use a previous stacked modules password\nand will never prompt the user - if no password is available or the password is not\nappropriate, the user will be denied access.\n\nuseauthtok\nWhen password changing enforce the module to set the new token to the one provided by a\npreviously stacked password module. If no token is available token changing will fail.\n\nauthtoktype=XXX\nThe default action is for the module to use the following prompts when requesting\npasswords: \"New UNIX password: \" and \"Retype UNIX password: \". The example word UNIX can\nbe replaced with this option, by default it is empty.\n\n### RETURN VALUES\n\nPAMAUTHERR\nAuthentication token could not be retrieved.\n\nPAMAUTHTOKERR\nNew authentication could not be retrieved.\n\nPAMSUCCESS\nAuthentication token was successfully retrieved.\n\nPAMSYSTEMERR\nNo space for an authentication token was provided.\n\nPAMTRYAGAIN\nNew authentication tokens mismatch.\n\n### SEE ALSO\n\npam(7)\n\n### STANDARDS\n\nThe pamgetauthtok function is a Linux-PAM extensions.\n\n\n\nLinux-PAM Manual                             06/08/2020                           PAMGETAUTHTOK(3)\n\n"
        }
    ],
    "structuredContent": {
        "command": "PAM_GET_AUTHTOK",
        "section": "3",
        "mode": "man",
        "summary": "pamgetauthtok, pamgetauthtokverify, pamgetauthtoknoverify - get authentication token",
        "synopsis": "#include <security/pamext.h>\nint pamgetauthtok(pamhandlet *pamh, int item, const char authtok, const char *prompt);\nint pamgetauthtoknoverify(pamhandlet *pamh, const char authtok, const char *prompt);\nint pamgetauthtokverify(pamhandlet *pamh, const char authtok, const char *prompt);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "pam",
                "section": "7",
                "url": "https://www.chedong.com/phpMan.php/man/pam/7/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 32,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "RETURN VALUES",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "STANDARDS",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}