From: Derrick Brashear Date: Wed, 3 Aug 2011 17:56:08 +0000 (-0400) Subject: pam: clean up unused variables and prototyping X-Git-Tag: openafs-devel-1_7_1~185 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=3d84c065fbf893d753bcd8da1211be536b07e29d pam: clean up unused variables and prototyping don't define variables on platforms we won't use them on do prototype functions we call. basically, we compile with warnings enabled now, so, fix everything so we *can*. Change-Id: I749f27c227ac70c58ccc68f1548f8274f10e3587 Reviewed-on: http://gerrit.openafs.org/5154 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/pam/afs_auth.c b/src/pam/afs_auth.c index 8bdc107..df18fbe 100644 --- a/src/pam/afs_auth.c +++ b/src/pam/afs_auth.c @@ -16,15 +16,16 @@ #include #endif +#include #include #include #include #include "afs_message.h" +#include "afs_pam_msg.h" #include "afs_util.h" - #define RET(x) { retcode = (x); goto out; } extern int @@ -61,12 +62,15 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, int i; 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. */ + struct passwd *upwd = NULL; char *reason = NULL; pid_t cpid, rcpid; int status; struct sigaction newAction, origAction; +#if !(defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)) + char upwd_buf[2048]; /* size is a guess. */ + struct passwd unix_pwd; +#endif #ifndef AFS_SUN5_ENV diff --git a/src/pam/afs_password.c b/src/pam/afs_password.c index 846efc4..8cb26cc 100644 --- a/src/pam/afs_password.c +++ b/src/pam/afs_password.c @@ -48,13 +48,16 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv) char *localcell; 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; PAM_CONST struct pam_conv *pam_convp = NULL; - struct passwd unix_pwd, *upwd = NULL; + struct passwd *upwd = NULL; +#if !(defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)) + char upwd_buf[2048]; /* size is a guess. */ + struct passwd unix_pwd; +#endif #ifndef AFS_SUN5_ENV openlog(pam_afs_ident, LOG_CONS, LOG_AUTH); diff --git a/src/pam/afs_session.c b/src/pam/afs_session.c index 2de18f8c..ad205e0 100644 --- a/src/pam/afs_session.c +++ b/src/pam/afs_session.c @@ -15,6 +15,7 @@ #include #include +#include #include "afs_message.h" #include "afs_util.h" @@ -55,7 +56,7 @@ pam_sm_close_session(pam_handle_t * pamh, int flags, int argc, i++; remain = 1; remainlifetime = (int)strtol(argv[i], (char **)NULL, 10); - if (remainlifetime == 0) + if (remainlifetime == 0) { if ((errno == EINVAL) || (errno == ERANGE)) { remainlifetime = REMAINLIFETIME; pam_afs_syslog(LOG_ERR, PAMAFS_REMAINLIFETIME, argv[i], @@ -64,6 +65,7 @@ pam_sm_close_session(pam_handle_t * pamh, int flags, int argc, no_unlog = 0; remain = 0; } + } } else if (strcmp(argv[i], "no_unlog") == 0) { no_unlog = 1; } else { diff --git a/src/pam/afs_setcred.c b/src/pam/afs_setcred.c index a6f7392..8520444 100644 --- a/src/pam/afs_setcred.c +++ b/src/pam/afs_setcred.c @@ -15,9 +15,11 @@ #include #include +#include #include #include "afs_message.h" +#include "afs_pam_msg.h" #include "afs_util.h" @@ -25,7 +27,7 @@ #define RET(x) { retcode = (x); goto out; } #if defined(AFS_KERBEROS_ENV) -extern char *ktc_tkt_string(); +extern char *ktc_tkt_string(void); #endif extern int @@ -52,13 +54,15 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv) char sbuffer[100]; char *torch_password = NULL; int auth_ok = 0; - char *lh; PAM_CONST char *user = NULL; const char *password = NULL; int password_expires = -1; char *reason = NULL; - struct passwd unix_pwd, *upwd = NULL; - char upwd_buf[2048]; /* size is a guess. */ + struct passwd *upwd = NULL; +#if !(defined(AFS_LINUX20_ENV) || defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV) || defined(AFS_NBSD_ENV)) + char upwd_buf[2048]; /* size is a guess. */ + struct passwd unix_pwd; +#endif #ifndef AFS_SUN5_ENV openlog(pam_afs_ident, LOG_CONS, LOG_AUTH); diff --git a/src/pam/afs_util.c b/src/pam/afs_util.c index d127926..df9a6f8 100644 --- a/src/pam/afs_util.c +++ b/src/pam/afs_util.c @@ -28,6 +28,8 @@ #include +#include + #include "afs_util.h"