aboutsummaryrefslogtreecommitdiff
path: root/src/kadmin/passwd
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>2001-02-26 18:22:08 +0000
committerEzra Peisach <epeisach@mit.edu>2001-02-26 18:22:08 +0000
commitf1084090738a70aa8804c817c694566d30d291ce (patch)
treec56afad548d16dc3e4046a11c4e96972b9fe1aa2 /src/kadmin/passwd
parente781bfd8ff71c88dfc3cdb0b3602810a6385e8dc (diff)
downloadkrb5-f1084090738a70aa8804c817c694566d30d291ce.zip
krb5-f1084090738a70aa8804c817c694566d30d291ce.tar.gz
krb5-f1084090738a70aa8804c817c694566d30d291ce.tar.bz2
* kpasswd.c, tty_kpasswd.c, xm_kpasswd.c: Compiler warning
clenups. Use const when apropriate, remove assignments in conditionals, remove unnecessary casts. * kpasswd.h: New file with prototypes of functions used in different files. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13024 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/kadmin/passwd')
-rw-r--r--src/kadmin/passwd/ChangeLog9
-rw-r--r--src/kadmin/passwd/kpasswd.c19
-rw-r--r--src/kadmin/passwd/kpasswd.h46
-rw-r--r--src/kadmin/passwd/tty_kpasswd.c12
-rw-r--r--src/kadmin/passwd/xm_kpasswd.c8
5 files changed, 77 insertions, 17 deletions
diff --git a/src/kadmin/passwd/ChangeLog b/src/kadmin/passwd/ChangeLog
index a638a0a..da6d425 100644
--- a/src/kadmin/passwd/ChangeLog
+++ b/src/kadmin/passwd/ChangeLog
@@ -1,3 +1,12 @@
+Mon Feb 26 13:13:21 2001 Ezra Peisach <epeisach@mit.edu>
+
+ * kpasswd.c, tty_kpasswd.c, xm_kpasswd.c: Compiler warning
+ clenups. Use const when apropriate, remove assignments in
+ conditionals, remove unnecessary casts.
+
+ * kpasswd.h: New file with prototypes of functions used in
+ different files.
+
2000-10-17 Ezra Peisach <epeisach@mit.edu>
* tty_kpasswd.c (read_old_password): Argument pwsize changed to
diff --git a/src/kadmin/passwd/kpasswd.c b/src/kadmin/passwd/kpasswd.c
index b56292e..912990d 100644
--- a/src/kadmin/passwd/kpasswd.c
+++ b/src/kadmin/passwd/kpasswd.c
@@ -14,15 +14,14 @@ static char rcsid[] = "$Id$";
#include "kpasswd_strings.h"
#define string_text error_message
+#include "kpasswd.h"
+
#include <stdio.h>
#include <pwd.h>
#include <string.h>
extern char *whoami;
-extern void display_intro_message();
-extern long read_old_password();
-extern long read_new_password();
#define MISC_EXIT_STATUS 6
@@ -82,7 +81,7 @@ kpasswd(context, argc, argv)
krb5_principal princ = 0;
char *princ_str;
struct passwd *pw = 0;
- int pwsize;
+ unsigned int pwsize;
char password[255]; /* I don't really like 255 but that's what kinit uses */
char msg_ret[1024], admin_realm[1024];
ovsec_kadm_principal_ent_t principal_entry = NULL;
@@ -227,7 +226,9 @@ kpasswd(context, argc, argv)
com_err(whoami, 0, string_text(KPW_STR_POLICY_EXPLANATION),
princ_str, principal_entry->policy,
policy_entry->pw_min_length, policy_entry->pw_min_classes);
- if (code = ovsec_kadm_free_principal_ent(server_handle, principal_entry)) {
+
+ code = ovsec_kadm_free_principal_ent(server_handle, principal_entry);
+ if (code) {
(void) ovsec_kadm_free_policy_ent(server_handle, policy_entry);
krb5_free_principal(context, princ);
free(princ_str);
@@ -235,7 +236,9 @@ kpasswd(context, argc, argv)
(void) ovsec_kadm_destroy(server_handle);
return(MISC_EXIT_STATUS);
}
- if (code = ovsec_kadm_free_policy_ent(server_handle, policy_entry)) {
+
+ code = ovsec_kadm_free_policy_ent(server_handle, policy_entry);
+ if (code) {
krb5_free_principal(context, princ);
free(princ_str);
com_err(whoami, code, string_text(KPW_STR_WHILE_FREEING_POLICY));
@@ -246,8 +249,8 @@ kpasswd(context, argc, argv)
else {
/* kpasswd *COULD* output something here to encourage the choice
of good passwords, in the absence of an enforced policy. */
- if (code = ovsec_kadm_free_principal_ent(server_handle,
- principal_entry)) {
+ code = ovsec_kadm_free_principal_ent(server_handle, principal_entry);
+ if (code) {
krb5_free_principal(context, princ);
free(princ_str);
com_err(whoami, code, string_text(KPW_STR_WHILE_FREEING_PRINCIPAL));
diff --git a/src/kadmin/passwd/kpasswd.h b/src/kadmin/passwd/kpasswd.h
new file mode 100644
index 0000000..577ab38
--- /dev/null
+++ b/src/kadmin/passwd/kpasswd.h
@@ -0,0 +1,46 @@
+/*
+ * kadmin/passwd/kpasswd.h
+ *
+ * Copyright 2001 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ *
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ * distribute this software and its documentation for any purpose and
+ * without fee is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose. It is provided "as is" without express
+ * or implied warranty.
+ *
+ *
+ * Prototypes for the kpasswd program callback functions.
+ */
+
+#ifndef __KPASSWD_H__
+#define __KPASSWD_H__
+
+int kpasswd(krb5_context context, int argc, char *argv[]);
+
+long read_old_password(krb5_context context, char *password,
+ unsigned int *pwsize);
+
+long read_new_password(void *server_handle, char *password,
+ unsigned int *pwsize, char *msg_ret,
+ krb5_principal princ);
+
+void display_intro_message(const char *fmt_string, const char *arg_string);
+
+#endif /* __KPASSWD_H__ */
+
+
diff --git a/src/kadmin/passwd/tty_kpasswd.c b/src/kadmin/passwd/tty_kpasswd.c
index 3c61ecd..1894091 100644
--- a/src/kadmin/passwd/tty_kpasswd.c
+++ b/src/kadmin/passwd/tty_kpasswd.c
@@ -14,6 +14,7 @@ static char rcsid[] = "$Id$";
#include "kpasswd_strings.h"
#define string_text error_message
+#include "kpasswd.h"
#include <stdio.h>
#include <pwd.h>
#include <string.h>
@@ -21,8 +22,8 @@ static char rcsid[] = "$Id$";
char *whoami;
void display_intro_message(fmt_string, arg_string)
- char *fmt_string;
- char *arg_string;
+ const char *fmt_string;
+ const char *arg_string;
{
com_err(whoami, 0, fmt_string, arg_string);
}
@@ -33,7 +34,7 @@ long read_old_password(context, password, pwsize)
unsigned int *pwsize;
{
long code = krb5_read_password(context,
- (char *)string_text(KPW_STR_OLD_PASSWORD_PROMPT),
+ string_text(KPW_STR_OLD_PASSWORD_PROMPT),
0, password, pwsize);
return code;
}
@@ -41,7 +42,7 @@ long read_old_password(context, password, pwsize)
long read_new_password(server_handle, password, pwsize, msg_ret, princ)
void *server_handle;
char *password;
- int *pwsize;
+ unsigned int *pwsize;
char *msg_ret;
krb5_principal princ;
{
@@ -64,7 +65,8 @@ main(argc, argv)
whoami = (whoami = strrchr(argv[0], '/')) ? whoami + 1 : argv[0];
- if (retval = krb5_init_context(&context)) {
+ retval = krb5_init_context(&context);
+ if (retval) {
com_err(whoami, retval, "initializing krb5 context");
exit(retval);
}
diff --git a/src/kadmin/passwd/xm_kpasswd.c b/src/kadmin/passwd/xm_kpasswd.c
index 4232e3b..6697620 100644
--- a/src/kadmin/passwd/xm_kpasswd.c
+++ b/src/kadmin/passwd/xm_kpasswd.c
@@ -322,8 +322,8 @@ read_password(password, pwsize)
*/
void
display_intro_message(fmt_string, arg_string)
- char *fmt_string;
- char *arg_string;
+ const char *fmt_string;
+ const char *arg_string;
{
XmString xmstr;
char buf[1024];
@@ -341,7 +341,7 @@ long
read_old_password(context, password, pwsize)
krb5_context context;
char *password;
- int *pwsize;
+ unsigned int *pwsize;
{
long code;
@@ -355,7 +355,7 @@ long
read_new_password(server_handle, password, pwsize, msg_ret, princ)
void *server_handle;
char *password;
- int *pwsize;
+ unsigned int *pwsize;
char *msg_ret;
krb5_principal princ;
{