diff options
author | Thorsten Kukuk <kukuk@thkukuk.de> | 2005-06-09 17:29:18 +0000 |
---|---|---|
committer | Thorsten Kukuk <kukuk@thkukuk.de> | 2005-06-09 17:29:18 +0000 |
commit | 0a7fe016a03184815b03fe92d50c58e67c8c05fc (patch) | |
tree | b9c25dd0fbbb71e08b2826e046b763facdcff8df /modules/pammodutil/modutil_getlogin.c | |
parent | fa433b9e2fa1a00e13df36a8b709ffda9e3e715b (diff) | |
download | pam-0a7fe016a03184815b03fe92d50c58e67c8c05fc.tar.gz pam-0a7fe016a03184815b03fe92d50c58e67c8c05fc.tar.bz2 pam-0a7fe016a03184815b03fe92d50c58e67c8c05fc.zip |
Relevant BUGIDs: none
Purpose of commit: cleanup
Commit summary:
---------------
Fix all occurrence of dereferencing type-punned pointer will break
strict-aliasing rules warnings
Diffstat (limited to 'modules/pammodutil/modutil_getlogin.c')
-rw-r--r-- | modules/pammodutil/modutil_getlogin.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/modules/pammodutil/modutil_getlogin.c b/modules/pammodutil/modutil_getlogin.c index ef09d031..fa67402d 100644 --- a/modules/pammodutil/modutil_getlogin.c +++ b/modules/pammodutil/modutil_getlogin.c @@ -17,21 +17,22 @@ const char *_pammodutil_getlogin(pam_handle_t *pamh) { int status; - char *logname; + const void *logname; + const void *void_curr_tty; const char *curr_tty; char *curr_user; struct utmp *ut, line; - status = pam_get_data(pamh, _PAMMODUTIL_GETLOGIN, - (const void **) &logname); + status = pam_get_data(pamh, _PAMMODUTIL_GETLOGIN, &logname); if (status == PAM_SUCCESS) { return logname; } - status = pam_get_item(pamh, PAM_TTY, (const void **) &curr_tty); - if ((status != PAM_SUCCESS) || (curr_tty == NULL)) { - curr_tty = ttyname(0); - } + status = pam_get_item(pamh, PAM_TTY, &void_curr_tty); + if ((status != PAM_SUCCESS) || (void_curr_tty == NULL)) + curr_tty = ttyname(0); + else + curr_tty = (const char*)void_curr_tty; if ((curr_tty == NULL) || memcmp(curr_tty, "/dev/", 5)) { return NULL; @@ -52,7 +53,7 @@ const char *_pammodutil_getlogin(pam_handle_t *pamh) goto clean_up_and_go_home; } - strncpy(curr_user, ut->ut_user, sizeof(ut->ut_user)); + strncpy(curr_user, ut->ut_user, sizeof(ut->ut_user)); /* calloc already zeroed the memory */ status = pam_set_data(pamh, _PAMMODUTIL_GETLOGIN, curr_user, |