pam: clean up unused variables and prototyping
authorDerrick Brashear <shadow@dementia.org>
Wed, 3 Aug 2011 17:56:08 +0000 (13:56 -0400)
committerDerrick Brashear <shadow@dementia.org>
Sun, 7 Aug 2011 18:49:20 +0000 (11:49 -0700)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/pam/afs_auth.c
src/pam/afs_password.c
src/pam/afs_session.c
src/pam/afs_setcred.c
src/pam/afs_util.c

index 8bdc107..df18fbe 100644 (file)
 #include <sys/wait.h>
 #endif
 
+#include <afs/sys_prototypes.h>
 #include <afs/kautils.h>
 
 #include <security/pam_appl.h>
 #include <security/pam_modules.h>
 
 #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
index 846efc4..8cb26cc 100644 (file)
@@ -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);
index 2de18f8..ad205e0 100644 (file)
@@ -15,6 +15,7 @@
 #include <security/pam_appl.h>
 #include <security/pam_modules.h>
 
+#include <afs/auth.h>
 #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 {
index a6f7392..8520444 100644 (file)
 #include <security/pam_appl.h>
 #include <security/pam_modules.h>
 
+#include <afs/sys_prototypes.h>
 #include <afs/kautils.h>
 
 #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);
index d127926..df9a6f8 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <security/pam_appl.h>
 
+#include <afs/auth.h>
+
 #include "afs_util.h"