Removed some warnings

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@874 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1996-10-21 23:12:23 +00:00
parent a9a0d3bd65
commit d7827cfb24
8 changed files with 528 additions and 518 deletions

60
cache.c
View File

@@ -311,7 +311,6 @@ ret_addrs(int fd, krb5_addresses *adr)
static krb5_error_code static krb5_error_code
store_ticket(int fd, krb5_ticket p) store_ticket(int fd, krb5_ticket p)
{ {
int i;
store_data(fd, p.enc_part); store_data(fd, p.enc_part);
return 0; return 0;
} }
@@ -319,7 +318,6 @@ store_ticket(int fd, krb5_ticket p)
static krb5_error_code static krb5_error_code
ret_ticket(int fd, krb5_ticket *tkt) ret_ticket(int fd, krb5_ticket *tkt)
{ {
int i;
ret_data(fd, &tkt->enc_part); ret_data(fd, &tkt->enc_part);
return 0; return 0;
} }
@@ -338,13 +336,35 @@ ret_authdata(int fd, krb5_data *auth)
return 0; return 0;
} }
krb5_error_code
erase_file(const char *filename)
{
int fd;
off_t pos;
char *p;
fd = open(filename, O_RDWR);
if(fd < 0)
if(errno == ENOENT)
return 0;
else
return errno;
pos = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
p = (char*) malloc(pos);
memset(p, 0, pos);
write(fd, p, pos);
free(p);
close(fd);
unlink(filename);
return 0;
}
krb5_error_code krb5_error_code
krb5_cc_initialize(krb5_context context, krb5_cc_initialize(krb5_context context,
krb5_ccache id, krb5_ccache id,
krb5_principal primary_principal) krb5_principal primary_principal)
{ {
char cc[1024];
char *p;
int ret; int ret;
int fd; int fd;
@@ -352,7 +372,7 @@ krb5_cc_initialize(krb5_context context,
f = krb5_cc_get_name(context, id); f = krb5_cc_get_name(context, id);
if(ret = erase_file(f)) if((ret = erase_file(f)))
return ret; return ret;
fd = open(f, O_RDWR | O_CREAT | O_EXCL, 0600); fd = open(f, O_RDWR | O_CREAT | O_EXCL, 0600);
@@ -365,26 +385,6 @@ krb5_cc_initialize(krb5_context context,
return 0; return 0;
} }
krb5_error_code
erase_file(const char *filename)
{
int fd;
off_t pos;
fd = open(filename, O_RDWR);
if(fd < 0)
if(errno == ENOENT)
return 0;
else
return errno;
pos = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
for(; pos > 0; pos -= 16)
write(fd, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16);
close(fd);
unlink(filename);
return 0;
}
krb5_error_code krb5_error_code
krb5_cc_destroy(krb5_context context, krb5_cc_destroy(krb5_context context,
@@ -433,7 +433,7 @@ krb5_cc_store_cred(krb5_context context,
store_ticket(fd, creds->ticket); store_ticket(fd, creds->ticket);
store_ticket(fd, creds->second_ticket); store_ticket(fd, creds->second_ticket);
close(fd); close(fd);
return 0; return 0; /* XXX */
} }
static krb5_error_code static krb5_error_code
@@ -462,7 +462,7 @@ krb5_cc_retrieve_cred(krb5_context context,
krb5_creds *mcreds, krb5_creds *mcreds,
krb5_creds *creds) krb5_creds *creds)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -471,7 +471,6 @@ krb5_cc_get_principal(krb5_context context,
krb5_principal *principal) krb5_principal *principal)
{ {
int fd; int fd;
char *f;
int16_t tag; int16_t tag;
fd = open(krb5_cc_get_name(context, id), O_RDONLY); fd = open(krb5_cc_get_name(context, id), O_RDONLY);
@@ -528,6 +527,7 @@ krb5_cc_get_first(krb5_context context,
krb5_ccache id, krb5_ccache id,
krb5_cc_cursor *cursor) krb5_cc_cursor *cursor)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -536,6 +536,7 @@ krb5_cc_get_next(krb5_context context,
krb5_creds *creds, krb5_creds *creds,
krb5_cc_cursor *cursor) krb5_cc_cursor *cursor)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -543,6 +544,7 @@ krb5_cc_end_get(krb5_context context,
krb5_ccache id, krb5_ccache id,
krb5_cc_cursor *cursor) krb5_cc_cursor *cursor)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -551,6 +553,7 @@ krb5_cc_remove_cred(krb5_context context,
krb5_flags which, krb5_flags which,
krb5_creds *cred) krb5_creds *cred)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -558,5 +561,6 @@ krb5_cc_set_flags(krb5_context context,
krb5_ccache id, krb5_ccache id,
krb5_flags flags) krb5_flags flags)
{ {
return 0; /* XXX */
} }

View File

@@ -9,7 +9,7 @@ krb5_get_krbhst (krb5_context context,
char buf[BUFSIZ]; char buf[BUFSIZ];
char *val; char *val;
sprintf (buf, "realms %.*s kdc", realm->length, realm->data); sprintf (buf, "realms %.*s kdc", (int)realm->length, (char*)realm->data);
err = krb5_get_config_tag (context->cf, buf, &val); err = krb5_get_config_tag (context->cf, buf, &val);
if (err) if (err)
return err; return err;
@@ -23,5 +23,6 @@ krb5_error_code
krb5_free_krbhst (krb5_context context, krb5_free_krbhst (krb5_context context,
char *const *hostlist) char *const *hostlist)
{ {
free (hostlist); free ((void*)hostlist);
return 0; /* XXX */
} }

View File

@@ -311,7 +311,6 @@ ret_addrs(int fd, krb5_addresses *adr)
static krb5_error_code static krb5_error_code
store_ticket(int fd, krb5_ticket p) store_ticket(int fd, krb5_ticket p)
{ {
int i;
store_data(fd, p.enc_part); store_data(fd, p.enc_part);
return 0; return 0;
} }
@@ -319,7 +318,6 @@ store_ticket(int fd, krb5_ticket p)
static krb5_error_code static krb5_error_code
ret_ticket(int fd, krb5_ticket *tkt) ret_ticket(int fd, krb5_ticket *tkt)
{ {
int i;
ret_data(fd, &tkt->enc_part); ret_data(fd, &tkt->enc_part);
return 0; return 0;
} }
@@ -338,13 +336,35 @@ ret_authdata(int fd, krb5_data *auth)
return 0; return 0;
} }
krb5_error_code
erase_file(const char *filename)
{
int fd;
off_t pos;
char *p;
fd = open(filename, O_RDWR);
if(fd < 0)
if(errno == ENOENT)
return 0;
else
return errno;
pos = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
p = (char*) malloc(pos);
memset(p, 0, pos);
write(fd, p, pos);
free(p);
close(fd);
unlink(filename);
return 0;
}
krb5_error_code krb5_error_code
krb5_cc_initialize(krb5_context context, krb5_cc_initialize(krb5_context context,
krb5_ccache id, krb5_ccache id,
krb5_principal primary_principal) krb5_principal primary_principal)
{ {
char cc[1024];
char *p;
int ret; int ret;
int fd; int fd;
@@ -352,7 +372,7 @@ krb5_cc_initialize(krb5_context context,
f = krb5_cc_get_name(context, id); f = krb5_cc_get_name(context, id);
if(ret = erase_file(f)) if((ret = erase_file(f)))
return ret; return ret;
fd = open(f, O_RDWR | O_CREAT | O_EXCL, 0600); fd = open(f, O_RDWR | O_CREAT | O_EXCL, 0600);
@@ -365,26 +385,6 @@ krb5_cc_initialize(krb5_context context,
return 0; return 0;
} }
krb5_error_code
erase_file(const char *filename)
{
int fd;
off_t pos;
fd = open(filename, O_RDWR);
if(fd < 0)
if(errno == ENOENT)
return 0;
else
return errno;
pos = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
for(; pos > 0; pos -= 16)
write(fd, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16);
close(fd);
unlink(filename);
return 0;
}
krb5_error_code krb5_error_code
krb5_cc_destroy(krb5_context context, krb5_cc_destroy(krb5_context context,
@@ -433,7 +433,7 @@ krb5_cc_store_cred(krb5_context context,
store_ticket(fd, creds->ticket); store_ticket(fd, creds->ticket);
store_ticket(fd, creds->second_ticket); store_ticket(fd, creds->second_ticket);
close(fd); close(fd);
return 0; return 0; /* XXX */
} }
static krb5_error_code static krb5_error_code
@@ -462,7 +462,7 @@ krb5_cc_retrieve_cred(krb5_context context,
krb5_creds *mcreds, krb5_creds *mcreds,
krb5_creds *creds) krb5_creds *creds)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -471,7 +471,6 @@ krb5_cc_get_principal(krb5_context context,
krb5_principal *principal) krb5_principal *principal)
{ {
int fd; int fd;
char *f;
int16_t tag; int16_t tag;
fd = open(krb5_cc_get_name(context, id), O_RDONLY); fd = open(krb5_cc_get_name(context, id), O_RDONLY);
@@ -528,6 +527,7 @@ krb5_cc_get_first(krb5_context context,
krb5_ccache id, krb5_ccache id,
krb5_cc_cursor *cursor) krb5_cc_cursor *cursor)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -536,6 +536,7 @@ krb5_cc_get_next(krb5_context context,
krb5_creds *creds, krb5_creds *creds,
krb5_cc_cursor *cursor) krb5_cc_cursor *cursor)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -543,6 +544,7 @@ krb5_cc_end_get(krb5_context context,
krb5_ccache id, krb5_ccache id,
krb5_cc_cursor *cursor) krb5_cc_cursor *cursor)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -551,6 +553,7 @@ krb5_cc_remove_cred(krb5_context context,
krb5_flags which, krb5_flags which,
krb5_creds *cred) krb5_creds *cred)
{ {
return 0; /* XXX */
} }
krb5_error_code krb5_error_code
@@ -558,5 +561,6 @@ krb5_cc_set_flags(krb5_context context,
krb5_ccache id, krb5_ccache id,
krb5_flags flags) krb5_flags flags)
{ {
return 0; /* XXX */
} }

View File

@@ -9,7 +9,7 @@ krb5_get_krbhst (krb5_context context,
char buf[BUFSIZ]; char buf[BUFSIZ];
char *val; char *val;
sprintf (buf, "realms %.*s kdc", realm->length, realm->data); sprintf (buf, "realms %.*s kdc", (int)realm->length, (char*)realm->data);
err = krb5_get_config_tag (context->cf, buf, &val); err = krb5_get_config_tag (context->cf, buf, &val);
if (err) if (err)
return err; return err;
@@ -23,5 +23,6 @@ krb5_error_code
krb5_free_krbhst (krb5_context context, krb5_free_krbhst (krb5_context context,
char *const *hostlist) char *const *hostlist)
{ {
free (hostlist); free ((void*)hostlist);
return 0; /* XXX */
} }

View File

@@ -67,7 +67,7 @@ krb5_sendto_kdc (krb5_context context,
} }
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i)
for (hp = hostlist; p = *hp; ++hp) { for (hp = hostlist; (p = *hp); ++hp) {
char *addr; char *addr;
char *colon; char *colon;
@@ -77,7 +77,7 @@ krb5_sendto_kdc (krb5_context context,
hostent = gethostbyname (p); hostent = gethostbyname (p);
if (colon) if (colon)
*colon++ = ':'; *colon++ = ':';
while (addr = *hostent->h_addr_list++) { while ((addr = *hostent->h_addr_list++)) {
struct sockaddr_in a; struct sockaddr_in a;
memset (&a, 0, sizeof(a)); memset (&a, 0, sizeof(a));

View File

@@ -119,7 +119,7 @@ krb5_string_to_key (char *str,
for (i = 0; i < len; i += 8) { for (i = 0; i < len; i += 8) {
unsigned char tmp[8]; unsigned char tmp[8];
init (tmp, &s[i]); init (tmp, (unsigned char*)&s[i]);
if (odd == 0) { if (odd == 0) {
odd = 1; odd = 1;
@@ -135,7 +135,7 @@ krb5_string_to_key (char *str,
free (s); free (s);
des_set_odd_parity (&tempkey); des_set_odd_parity (&tempkey);
if (des_is_weak_key (&tempkey)) if (des_is_weak_key (&tempkey))
xor ((char *)&tempkey, "0x000x000x000x000x000x000x000xF0"); xor ((unsigned char *)&tempkey, (unsigned char*)"0x000x000x000x000x000x000x000xF0");
memcpy (key->contents.data, &tempkey, sizeof(tempkey)); memcpy (key->contents.data, &tempkey, sizeof(tempkey));
return 0; return 0;
} }

View File

@@ -67,7 +67,7 @@ krb5_sendto_kdc (krb5_context context,
} }
for (i = 0; i < 3; ++i) for (i = 0; i < 3; ++i)
for (hp = hostlist; p = *hp; ++hp) { for (hp = hostlist; (p = *hp); ++hp) {
char *addr; char *addr;
char *colon; char *colon;
@@ -77,7 +77,7 @@ krb5_sendto_kdc (krb5_context context,
hostent = gethostbyname (p); hostent = gethostbyname (p);
if (colon) if (colon)
*colon++ = ':'; *colon++ = ':';
while (addr = *hostent->h_addr_list++) { while ((addr = *hostent->h_addr_list++)) {
struct sockaddr_in a; struct sockaddr_in a;
memset (&a, 0, sizeof(a)); memset (&a, 0, sizeof(a));

View File

@@ -119,7 +119,7 @@ krb5_string_to_key (char *str,
for (i = 0; i < len; i += 8) { for (i = 0; i < len; i += 8) {
unsigned char tmp[8]; unsigned char tmp[8];
init (tmp, &s[i]); init (tmp, (unsigned char*)&s[i]);
if (odd == 0) { if (odd == 0) {
odd = 1; odd = 1;
@@ -135,7 +135,7 @@ krb5_string_to_key (char *str,
free (s); free (s);
des_set_odd_parity (&tempkey); des_set_odd_parity (&tempkey);
if (des_is_weak_key (&tempkey)) if (des_is_weak_key (&tempkey))
xor ((char *)&tempkey, "0x000x000x000x000x000x000x000xF0"); xor ((unsigned char *)&tempkey, (unsigned char*)"0x000x000x000x000x000x000x000xF0");
memcpy (key->contents.data, &tempkey, sizeof(tempkey)); memcpy (key->contents.data, &tempkey, sizeof(tempkey));
return 0; return 0;
} }