* fetch_mkey.c (krb5_db_fetch_mkey): Clean up signedness warnings.
* kdb_db2.c (destroy_file_suffix): Declare function as
static. Rewrite code to use off_t and unsigned ints to handle gcc
warnings. (kdb5_context_internalize) Unmarshal boolean type properly.
* store_mkey.c (krb5_db_store_mkey): Use mode_t instead of int in
call to umask.
* configure.in: Add AC_TYPE_MODE_T and AC_TYPE_OFF_T for mode_t
and off_t declarations.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12661
dc483132-0cff-0310-8789-
dd5450dbe970
+2000-09-20 Ezra Peisach <epeisach@engrailed.mit.edu>
+
+ * kdb_xdr.c (krb5_dbe_free_contents): Clean up signedness warning.
+
+ * fetch_mkey.c (krb5_db_fetch_mkey): Clean up signedness warnings.
+
+ * kdb_db2.c (destroy_file_suffix): Declare function as
+ static. Rewrite code to use off_t and unsigned ints to handle gcc
+ warnings. (kdb5_context_internalize) Unmarshal boolean type properly.
+
+ * store_mkey.c (krb5_db_store_mkey): Use mode_t instead of int in
+ call to umask.
+
+ * configure.in: Add AC_TYPE_MODE_T and AC_TYPE_OFF_T for mode_t
+ and off_t declarations.
+
2000-07-04 Ezra Peisach <epeisach@mit.edu>
* encrypt_key.c, kdb_cpw.c, kdb_xdr.c: Add parenthesis about
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_HAVE_HEADERS(unistd.h)
+AC_TYPE_MODE_T
+AC_TYPE_OFF_T
+
AC_CHECK_FUNCS(srand48 srand srandom umask)
dnl AIX is unusual in that it wants all symbols resolved at link time
char defkeyfile[MAXPATHLEN+1];
krb5_data *realm = krb5_princ_realm(context, mname);
FILE *kf;
+ unsigned int len;
retval = 0;
key->magic = KV5M_KEYBLOCK;
retval = KRB5_KDB_BADSTORED_MKEY;
goto errout;
}
- if (!(key->contents = (krb5_octet *)malloc(key->length))) {
+
+ /* Provide an unsigned int */
+ len = key->length;
+ if (!(key->contents = (krb5_octet *)malloc(len))) {
retval = ENOMEM;
goto errout;
}
if (fread((krb5_pointer) key->contents,
- sizeof(key->contents[0]), key->length, kf) != key->length) {
+ sizeof(key->contents[0]), len, kf)
+ != key->length) {
retval = KRB5_KDB_CANTREAD_STORED;
- memset(key->contents, 0, key->length);
+ memset(key->contents, 0, len);
free(key->contents);
key->contents = 0;
} else
/*
* Destroy the database. Zero's out all of the files, just to be sure.
*/
-krb5_error_code
+static krb5_error_code
destroy_file_suffix(dbname, suffix)
char *dbname;
char *suffix;
{
char *filename;
struct stat statb;
- int nb,fd,i,j;
+ int nb,fd;
+ unsigned int j;
+ off_t pos;
char buf[BUFSIZ];
char zbuf[BUFSIZ];
int dowrite;
* we're just about to unlink it anyways.
*/
memset(zbuf, 0, BUFSIZ);
- i = 0;
- while (i < statb.st_size) {
+ pos = 0;
+ while (pos < statb.st_size) {
dowrite = 0;
nb = read(fd, buf, BUFSIZ);
if (nb < 0) {
break;
}
}
+ /* For signedness */
+ j = nb;
if (dowrite) {
- lseek(fd, i, SEEK_SET);
- nb = write(fd, zbuf, nb);
+ lseek(fd, pos, SEEK_SET);
+ nb = write(fd, zbuf, j);
if (nb < 0) {
int retval = errno;
free(filename);
return retval;
}
}
- i += nb;
+ pos += nb;
}
/* ??? Is fsync really needed? I don't know of any non-networked
filesystem which will discard queued writes to disk if a file
for (i = 0; i < entry.n_key_data; i++) {
if (entry.key_data[i].key_data_length[0]) {
memset((char *)entry.key_data[i].key_data_contents[0], 0,
- entry.key_data[i].key_data_length[0]);
+ (unsigned) entry.key_data[i].key_data_length[0]);
}
}
krb5_int32 lockcount;
krb5_int32 lockmode;
krb5_int32 dbnamelen;
+ krb5_boolean nb_lock;
char *dbname;
bp = *buffer;
kret = krb5_db_lock(tmpctx, lockmode);
if (!kret && lockmode)
dbctx->db_locks_held = lockcount;
- (void) krb5_db2_db_set_lockmode(tmpctx, nb_lockmode);
+ nb_lock = nb_lockmode & 0xff;
+ (void) krb5_db2_db_set_lockmode(tmpctx, nb_lock);
}
if (dbname)
krb5_xfree(dbname);
if (entry->key_data[i].key_data_length[j]) {
if (entry->key_data[i].key_data_contents[j]) {
memset(entry->key_data[i].key_data_contents[j],
- 0, entry->key_data[i].key_data_length[j]);
+ 0,
+ (unsigned) entry->key_data[i].key_data_length[j]);
free (entry->key_data[i].key_data_contents[j]);
}
}
char defkeyfile[MAXPATHLEN+1];
krb5_data *realm = krb5_princ_realm(context, mname);
#if HAVE_UMASK
- int oumask;
+ mode_t oumask;
#endif
if (!keyfile) {
(fwrite((krb5_pointer) &key->length,
sizeof(key->length), 1, kf) != 1) ||
(fwrite((krb5_pointer) key->contents,
- sizeof(key->contents[0]), key->length, kf) != key->length)) {
+ sizeof(key->contents[0]), (unsigned) key->length,
+ kf) != key->length)) {
retval = errno;
(void) fclose(kf);
}