Changeset 277 in openpam


Ignore:
Timestamp:
Dec 11, 2003, 5:41:17 PM (14 years ago)
Author:
Dag-Erling Smørgrav
Message:

I originally thought the XSSO was wrong to declare pam_get_data()'s
final argument as void rather than const void , but having seen
the strict aliasing warnings gcc generates at higher -O levels, it
makes a lot more sense. Change the prototype and definition back to
what the XSSO specifies, and make the necessary changes to avoid
warnings in code that calls pam_get_data().

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/security/pam_appl.h

    r245 r277  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/include/security/pam_appl.h#13 $
     34 * $P4: //depot/projects/openpam/include/security/pam_appl.h#14 $
    3535 */
    3636
     
    7272pam_get_data(pam_handle_t *_pamh,
    7373        const char *_module_data_name,
    74         const void **_data);
     74        void **_data);
    7575
    7676int
  • trunk/lib/openpam_borrow_cred.c

    r267 r277  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_borrow_cred.c#10 $
     34 * $P4: //depot/projects/openpam/lib/openpam_borrow_cred.c#11 $
    3535 */
    3636
     
    5858{
    5959        struct pam_saved_cred *scred;
     60        void *scredp;
    6061        int r;
    6162
    6263        ENTERI(pwd->pw_uid);
    63         r = pam_get_data(pamh, PAM_SAVED_CRED, (const void **)&scred);
    64         if (r == PAM_SUCCESS && scred != NULL) {
     64        r = pam_get_data(pamh, PAM_SAVED_CRED, &scredp);
     65        if (r == PAM_SUCCESS && scredp != NULL) {
    6566                openpam_log(PAM_LOG_DEBUG,
    6667                    "already operating under borrowed credentials");
  • trunk/lib/openpam_restore_cred.c

    r267 r277  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/openpam_restore_cred.c#9 $
     34 * $P4: //depot/projects/openpam/lib/openpam_restore_cred.c#10 $
    3535 */
    3636
     
    5757{
    5858        struct pam_saved_cred *scred;
     59        void *scredp;
    5960        int r;
    6061
    6162        ENTER();
    62         r = pam_get_data(pamh, PAM_SAVED_CRED, (const void **)&scred);
     63        r = pam_get_data(pamh, PAM_SAVED_CRED, &scredp);
    6364        if (r != PAM_SUCCESS)
    6465                RETURNC(r);
    65         if (scred == NULL)
     66        if (scredp == NULL)
    6667                RETURNC(PAM_SYSTEM_ERR);
     68        scred = scredp;
    6769        if (scred->euid != geteuid()) {
    6870                if (seteuid(scred->euid) < 0 ||
  • trunk/lib/pam_get_authtok.c

    r261 r277  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_get_authtok.c#26 $
     34 * $P4: //depot/projects/openpam/lib/pam_get_authtok.c#27 $
    3535 */
    3636
     
    6161        const char *prompt)
    6262{
    63         const void *oldauthtok;
     63        const void *oldauthtok, *prevauthtok, *promptp;
    6464        const char *default_prompt;
    6565        char *resp, *resp2;
     
    9191        if (openpam_get_option(pamh, "try_first_pass") ||
    9292            openpam_get_option(pamh, "use_first_pass")) {
    93                 r = pam_get_item(pamh, item, (const void **)authtok);
    94                 if (r == PAM_SUCCESS && *authtok != NULL)
     93                r = pam_get_item(pamh, item, &prevauthtok);
     94                if (r == PAM_SUCCESS && prevauthtok != NULL) {
     95                        *authtok = prevauthtok;
    9596                        RETURNC(PAM_SUCCESS);
     97                }
    9698                else if (openpam_get_option(pamh, "use_first_pass"))
    9799                        RETURNC(r == PAM_SUCCESS ? PAM_AUTH_ERR : r);
    98100        }
    99101        if (prompt == NULL) {
    100                 r = pam_get_item(pamh, pitem, (const void **)&prompt);
    101                 if (r != PAM_SUCCESS || prompt == NULL)
     102                r = pam_get_item(pamh, pitem, &promptp);
     103                if (r != PAM_SUCCESS || promptp == NULL)
    102104                        prompt = default_prompt;
     105                else
     106                        prompt = promptp;
    103107        }
    104108        style = openpam_get_option(pamh, "echo_pass") ?
  • trunk/lib/pam_get_data.c

    r245 r277  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_get_data.c#12 $
     34 * $P4: //depot/projects/openpam/lib/pam_get_data.c#13 $
    3535 */
    3636
     37#include <stdint.h>
    3738#include <string.h>
    3839
     
    5152pam_get_data(pam_handle_t *pamh,
    5253        const char *module_data_name,
    53         const void **data)
     54        void **data)
    5455{
    5556        pam_data_t *dp;
     
    5859        if (pamh == NULL)
    5960                RETURNC(PAM_SYSTEM_ERR);
    60         for (dp = pamh->module_data; dp != NULL; dp = dp->next)
     61        for (dp = pamh->module_data; dp != NULL; dp = dp->next) {
    6162                if (strcmp(dp->name, module_data_name) == 0) {
    62                         *data = dp->data;
     63                        *data = (void *)(intptr_t)dp->data;
    6364                        RETURNC(PAM_SUCCESS);
    6465                }
     66        }
    6567        RETURNC(PAM_NO_MODULE_DATA);
    6668}
  • trunk/lib/pam_get_user.c

    r258 r277  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_get_user.c#18 $
     34 * $P4: //depot/projects/openpam/lib/pam_get_user.c#19 $
    3535 */
    3636
     
    5858        const char *prompt)
    5959{
     60        const void *promptp;
    6061        char *resp;
    6162        int r;
     
    6869                RETURNC(PAM_SUCCESS);
    6970        if (prompt == NULL) {
    70                 r = pam_get_item(pamh, PAM_USER_PROMPT, (const void **)&prompt);
    71                 if (r != PAM_SUCCESS || prompt == NULL)
     71                r = pam_get_item(pamh, PAM_USER_PROMPT, &promptp);
     72                if (r != PAM_SUCCESS || promptp == NULL)
    7273                        prompt = user_prompt;
     74                else
     75                        prompt = promptp;
    7376        }
    7477        r = pam_prompt(pamh, PAM_PROMPT_ECHO_ON, &resp, "%s", prompt);
  • trunk/lib/pam_vprompt.c

    r245 r277  
    3232 * SUCH DAMAGE.
    3333 *
    34  * $P4: //depot/projects/openpam/lib/pam_vprompt.c#12 $
     34 * $P4: //depot/projects/openpam/lib/pam_vprompt.c#13 $
    3535 */
    3636
     
    6060        const struct pam_message *msgp;
    6161        struct pam_response *rsp;
    62         struct pam_conv *conv;
     62        const struct pam_conv *conv;
     63        const void *convp;
    6364        int r;
    6465
    6566        ENTER();
    66         r = pam_get_item(pamh, PAM_CONV, (const void **)&conv);
     67        r = pam_get_item(pamh, PAM_CONV, &convp);
    6768        if (r != PAM_SUCCESS)
    6869                RETURNC(r);
     70        conv = convp;
    6971        if (conv == NULL || conv->conv == NULL) {
    7072                openpam_log(PAM_LOG_ERROR, "no conversation function");
Note: See TracChangeset for help on using the changeset viewer.