]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
pam: Use PAM_CONST more often
authorAndrew Deason <adeason@sinenomine.net>
Wed, 13 Apr 2011 15:52:50 +0000 (10:52 -0500)
committerDerrick Brashear <shadow@dementix.org>
Fri, 16 Dec 2011 11:00:37 +0000 (03:00 -0800)
Some callers of pam_get_item et al were just casting their argument to
a const void **. Some PAM implementations (Linux) want a const void**,
but others (Solaris) do not. Use the PAM_CONST symbol already defined
by autoconf to declare or cast the relevant variable const or not as
appropriate.

Reviewed-on: http://gerrit.openafs.org/4470
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 78d1f8d88334f711eaaf6555d3a962a504d3e80e)

Change-Id: I831fa52c238a6cf7ef211e8198815c4420ae7dce
Reviewed-on: http://gerrit.openafs.org/6291
Tested-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Derrick Brashear <shadow@dementix.org>
src/pam/afs_auth.c
src/pam/afs_password.c
src/pam/afs_setcred.c

index 6e68640ac4da69b8f24417d922c1240bb5dcfbfb..39c465b503b5daa05c515924d987664a426db3fe 100644 (file)
@@ -59,11 +59,11 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc,
     int use_klog = 0;
     int set_expires = 0;       /* This option is only used in pam_set_cred() */
     int got_authtok = 0;       /* got PAM_AUTHTOK upon entry */
-    char *user = NULL, *password = NULL;
+    PAM_CONST char *user = NULL, *password = NULL;
     afs_int32 password_expires = -1;
     int torch_password = 1;
     int i;
-    struct pam_conv *pam_convp = NULL;
+    PAM_CONST struct pam_conv *pam_convp = NULL;
     int auth_ok;
     struct passwd unix_pwd, *upwd = NULL;
     char upwd_buf[2048];       /* size is a guess. */
@@ -150,7 +150,7 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc,
                       refresh_token, set_token, dont_fork, use_klog);
 
     /* Try to get the user-interaction info, if available. */
-    errcode = pam_get_item(pamh, PAM_CONV, (const void **)&pam_convp);
+    errcode = pam_get_item(pamh, PAM_CONV, (PAM_CONST void **)&pam_convp);
     if (errcode != PAM_SUCCESS) {
        pam_afs_syslog(LOG_WARNING, PAMAFS_NO_USER_INT);
        pam_convp = NULL;
@@ -158,7 +158,7 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc,
 
     /* Who are we trying to authenticate here? */
     if ((errcode =
-        pam_get_user(pamh, (const char **)&user,
+        pam_get_user(pamh, &user,
                      "login: ")) != PAM_SUCCESS) {
        pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode);
        RET(PAM_USER_UNKNOWN);
@@ -198,7 +198,7 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc,
        RET(PAM_AUTH_ERR);
     }
 #endif
-    errcode = pam_get_item(pamh, PAM_AUTHTOK, (const void **)&password);
+    errcode = pam_get_item(pamh, PAM_AUTHTOK, (PAM_CONST void **)&password);
     if (errcode != PAM_SUCCESS || password == NULL) {
        if (use_first_pass) {
            pam_afs_syslog(LOG_ERR, PAMAFS_PASSWD_REQ, user);
index afd801965161cb5c36a3e15c2763a2a41cbe4deb..a296b14d1ea9558a03f94846533e03da6b14c38e 100644 (file)
@@ -50,14 +50,14 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv)
     char realm[256];
     char cell[256];
     char *localcell;
-    char *user = NULL, *password = NULL;
+    PAM_CONST char *user = NULL, *password = NULL;
     char *new_password = NULL, *verify_password = NULL;
     char upwd_buf[2048];       /* size is a guess. */
     char *reason = NULL;
     struct ktc_encryptionKey oldkey, newkey;
     struct ktc_token token;
     struct ubik_client *conn = 0;
-    struct pam_conv *pam_convp = NULL;
+    PAM_CONST struct pam_conv *pam_convp = NULL;
     struct passwd unix_pwd, *upwd = NULL;
 
 #ifndef AFS_SUN56_ENV
@@ -97,7 +97,7 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv)
     }
 
     /* Try to get the user-interaction info, if available. */
-    errcode = pam_get_item(pamh, PAM_CONV, (const void **)&pam_convp);
+    errcode = pam_get_item(pamh, PAM_CONV, (PAM_CONST void **)&pam_convp);
     if (errcode != PAM_SUCCESS) {
        pam_afs_syslog(LOG_WARNING, PAMAFS_NO_USER_INT);
        pam_convp = NULL;
@@ -105,7 +105,7 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv)
 
     /* Who are we trying to authenticate here? */
     if ((errcode =
-        pam_get_user(pamh, (const char **)&user,
+        pam_get_user(pamh, &user,
                      "AFS username: ")) != PAM_SUCCESS) {
        pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode);
        RET(PAM_USER_UNKNOWN);
@@ -143,7 +143,7 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv)
     }
 #endif
 
-    errcode = pam_get_item(pamh, PAM_AUTHTOK, (const void **)&password);
+    errcode = pam_get_item(pamh, PAM_AUTHTOK, (PAM_CONST void **)&password);
     if (errcode != PAM_SUCCESS || password == NULL) {
        if (use_first_pass) {
            pam_afs_syslog(LOG_ERR, PAMAFS_PASSWD_REQ, user);
index 573445d196513ccf00d5b749e62b5c38c0ee41c1..ff11322f665995af380076344aba902736823413 100644 (file)
@@ -51,7 +51,7 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv)
     int set_expires = 0;       /* the default is to not to set the env variable */
     int use_klog = 0;
     int i;
-    struct pam_conv *pam_convp = NULL;
+    PAM_CONST struct pam_conv *pam_convp = NULL;
     char my_password_buf[256];
     char *cell_ptr = NULL;
     char sbuffer[100];
@@ -59,7 +59,7 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv)
     int torch_password = 1;
     int auth_ok = 0;
     char *lh;
-    char *user = NULL;
+    PAM_CONST char *user = NULL;
     int password_expires = -1;
     char *reason = NULL;
     struct passwd unix_pwd, *upwd = NULL;
@@ -133,7 +133,7 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv)
        pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass,
                       try_first_pass, ignore_uid, ignore_uid_id, 8, 8, 8, 8);
     /* Try to get the user-interaction info, if available. */
-    errcode = pam_get_item(pamh, PAM_CONV, (const void **)&pam_convp);
+    errcode = pam_get_item(pamh, PAM_CONV, (PAM_CONST void **)&pam_convp);
     if (errcode != PAM_SUCCESS) {
        if (logmask && LOG_MASK(LOG_DEBUG))
            pam_afs_syslog(LOG_DEBUG, PAMAFS_NO_USER_INT);
@@ -142,7 +142,7 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv)
 
     /* Who are we trying to authenticate here? */
     if ((errcode =
-        pam_get_user(pamh, (const char **)&user,
+        pam_get_user(pamh, (PAM_CONST char **)&user,
                      "AFS username:")) != PAM_SUCCESS) {
        pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode);
        RET(PAM_USER_UNKNOWN);