aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2008-11-05 17:08:47 +0000
committerGreg Hudson <ghudson@mit.edu>2008-11-05 17:08:47 +0000
commitddf60ba5e894ad339c96c6f61446dfc8cb79e779 (patch)
tree7c422431eee6bfe27aa691c05f8a1741b8934397
parent34bf3f538cc063b49fc9ac691d617522a7962e19 (diff)
downloadkrb5-ddf60ba5e894ad339c96c6f61446dfc8cb79e779.zip
krb5-ddf60ba5e894ad339c96c6f61446dfc8cb79e779.tar.gz
krb5-ddf60ba5e894ad339c96c6f61446dfc8cb79e779.tar.bz2
Rename krb5int_buf_cstr to krb5int_buf_data, since k5bufs can be used
for binary data as well as C string data. The buffer will always have a null byte at krb5int_buf_len bytes regardless of whether it contains C string data. ticket: 6200 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@21003 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/clients/ksu/authorization.c2
-rw-r--r--src/include/k5-buf.h6
-rw-r--r--src/lib/crypto/t_hmac.c2
-rw-r--r--src/lib/gssapi/mechglue/oid_ops.c2
-rw-r--r--src/lib/kadm5/alt_prof.c2
-rw-r--r--src/lib/kadm5/str_conv.c2
-rw-r--r--src/lib/krb5/krb/preauth.c2
-rw-r--r--src/lib/krb5/krb/srv_rcache.c2
-rw-r--r--src/lib/krb5/os/dnssrv.c2
-rw-r--r--src/lib/krb5/os/hst_realm.c2
-rw-r--r--src/lib/krb5/os/sendto_kdc.c4
-rw-r--r--src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c2
-rw-r--r--src/util/support/k5buf.c2
-rw-r--r--src/util/support/libkrb5support-fixed.exports2
-rw-r--r--src/util/support/t_k5buf.c32
15 files changed, 33 insertions, 33 deletions
diff --git a/src/clients/ksu/authorization.c b/src/clients/ksu/authorization.c
index 829251d..fa59623 100644
--- a/src/clients/ksu/authorization.c
+++ b/src/clients/ksu/authorization.c
@@ -515,7 +515,7 @@ krb5_boolean find_first_cmd_that_exists(fcmd_arr, cmd_out, err_out)
for(j= 0; j < i; j ++)
krb5int_buf_add_fmt(&buf, " %s ", fcmd_arr[j]);
krb5int_buf_add(&buf, "\n");
- *err_out = krb5int_buf_cstr(&buf);
+ *err_out = krb5int_buf_data(&buf);
if (*err_out == NULL) {
perror(prog_name);
exit(1);
diff --git a/src/include/k5-buf.h b/src/include/k5-buf.h
index 885c2fd..de869d3 100644
--- a/src/include/k5-buf.h
+++ b/src/include/k5-buf.h
@@ -106,17 +106,17 @@ void krb5int_buf_truncate(struct k5buf *buf, size_t len);
For a dynamic buffer, any buffer modification operation except
krb5int_buf_truncate may invalidate the byte array address. */
-char *krb5int_buf_cstr(struct k5buf *buf);
+char *krb5int_buf_data(struct k5buf *buf);
/* Retrieve the length of BUF, or -1 if there has been an allocation
failure or the fixed buffer ran out of room. The length is equal
- to strlen(krb5int_buf_cstr(buf)) unless binary data was added with
+ to strlen(krb5int_buf_data(buf)) unless binary data was added with
krb5int_buf_add_len. */
ssize_t krb5int_buf_len(struct k5buf *buf);
/* Free the storage used in the dynamic buffer BUF. The caller may
choose to take responsibility for freeing the return value of
- krb5int_buf_cstr instead of using this function. If BUF is a fixed
+ krb5int_buf_data instead of using this function. If BUF is a fixed
buffer, an assertion failure will result. It is unnecessary
(though harmless) to free a buffer after an error is detected; the
storage will already have been freed in that case. */
diff --git a/src/lib/crypto/t_hmac.c b/src/lib/crypto/t_hmac.c
index 63b90c7..bf629c3 100644
--- a/src/lib/crypto/t_hmac.c
+++ b/src/lib/crypto/t_hmac.c
@@ -245,7 +245,7 @@ static void test_hmac()
krb5int_buf_add(&buf, "0x");
for (j = 0; j < out.length; j++)
krb5int_buf_add_fmt(&buf, "%02x", 0xff & outbuf[j]);
- if (krb5int_buf_cstr(&buf) == NULL)
+ if (krb5int_buf_data(&buf) == NULL)
abort();
if (strcmp(stroutbuf, md5tests[i].hexdigest)) {
printf("*** CHECK FAILED!\n"
diff --git a/src/lib/gssapi/mechglue/oid_ops.c b/src/lib/gssapi/mechglue/oid_ops.c
index 44d79f3..9e77ef1 100644
--- a/src/lib/gssapi/mechglue/oid_ops.c
+++ b/src/lib/gssapi/mechglue/oid_ops.c
@@ -256,7 +256,7 @@ generic_gss_oid_to_str(minor_status, oid, oid_str)
}
}
krb5int_buf_add(&buf, "}");
- bp = krb5int_buf_cstr(&buf);
+ bp = krb5int_buf_data(&buf);
if (bp == NULL) {
*minor_status = ENOMEM;
return(GSS_S_FAILURE);
diff --git a/src/lib/kadm5/alt_prof.c b/src/lib/kadm5/alt_prof.c
index 8fa742c..b6d8bdc 100644
--- a/src/lib/kadm5/alt_prof.c
+++ b/src/lib/kadm5/alt_prof.c
@@ -92,7 +92,7 @@ krb5_aprof_init(fname, envname, acontextp)
krb5int_buf_add(&buf, filenames[i]);
}
krb5_free_config_files(filenames);
- profile_path = krb5int_buf_cstr(&buf);
+ profile_path = krb5int_buf_data(&buf);
if (profile_path == NULL)
return ENOMEM;
profile = (profile_t) NULL;
diff --git a/src/lib/kadm5/str_conv.c b/src/lib/kadm5/str_conv.c
index 7ffcc8e..c35d515 100644
--- a/src/lib/kadm5/str_conv.c
+++ b/src/lib/kadm5/str_conv.c
@@ -188,7 +188,7 @@ krb5_flags_to_string(flags, sep, buffer, buflen)
pflags |= flags_table[i].fl_flags;
}
}
- if (krb5int_buf_cstr(&buf) == NULL)
+ if (krb5int_buf_data(&buf) == NULL)
return(ENOMEM);
/* See if there's any leftovers */
diff --git a/src/lib/krb5/krb/preauth.c b/src/lib/krb5/krb/preauth.c
index 32249df..1157411 100644
--- a/src/lib/krb5/krb/preauth.c
+++ b/src/lib/krb5/krb/preauth.c
@@ -444,7 +444,7 @@ char *handle_sam_labels(krb5_sam_challenge *sc)
}
krb5int_buf_add_len(&buf, prompt, prompt_len);
krb5int_buf_add(&buf, ": ");
- return krb5int_buf_cstr(&buf);
+ return krb5int_buf_data(&buf);
}
/*
diff --git a/src/lib/krb5/krb/srv_rcache.c b/src/lib/krb5/krb/srv_rcache.c
index 4ce0733..a426881 100644
--- a/src/lib/krb5/krb/srv_rcache.c
+++ b/src/lib/krb5/krb/srv_rcache.c
@@ -66,7 +66,7 @@ krb5_get_server_rcache(krb5_context context, const krb5_data *piece,
krb5int_buf_add_fmt(&buf, "_%lu", uid);
#endif
- cachename = krb5int_buf_cstr(&buf);
+ cachename = krb5int_buf_data(&buf);
if (cachename == NULL)
return ENOMEM;
diff --git a/src/lib/krb5/os/dnssrv.c b/src/lib/krb5/os/dnssrv.c
index e10d01d..4dcd57c 100644
--- a/src/lib/krb5/os/dnssrv.c
+++ b/src/lib/krb5/os/dnssrv.c
@@ -99,7 +99,7 @@ krb5int_make_srv_query_realm(const krb5_data *realm,
if (len > 0 && host[len - 1] != '.')
krb5int_buf_add(&buf, ".");
- if (krb5int_buf_cstr(&buf) == NULL)
+ if (krb5int_buf_data(&buf) == NULL)
return 0;
#ifdef TEST
diff --git a/src/lib/krb5/os/hst_realm.c b/src/lib/krb5/os/hst_realm.c
index 038348e..2150ab3 100644
--- a/src/lib/krb5/os/hst_realm.c
+++ b/src/lib/krb5/os/hst_realm.c
@@ -119,7 +119,7 @@ krb5_try_realm_txt_rr(const char *prefix, const char *name, char **realm)
if (len > 0 && host[len - 1] != '.')
krb5int_buf_add(&buf, ".");
}
- if (krb5int_buf_cstr(&buf) == NULL)
+ if (krb5int_buf_data(&buf) == NULL)
return KRB5_ERR_HOST_REALM_UNKNOWN;
ret = krb5int_dns_init(&ds, host, C_IN, T_TXT);
if (ret < 0)
diff --git a/src/lib/krb5/os/sendto_kdc.c b/src/lib/krb5/os/sendto_kdc.c
index 46ed6f6..971047b 100644
--- a/src/lib/krb5/os/sendto_kdc.c
+++ b/src/lib/krb5/os/sendto_kdc.c
@@ -240,8 +240,8 @@ krb5int_debug_fprint (const char *fmt, ...)
krb5int_buf_add_fmt(&buf, " af%d", ai->ai_addr->sa_family);
} else
krb5int_buf_add_fmt(&buf, " %s.%s", addrbuf, portbuf);
- if (krb5int_buf_cstr(&buf))
- putstr(krb5int_buf_cstr(&buf));
+ if (krb5int_buf_data(&buf))
+ putstr(krb5int_buf_data(&buf));
krb5int_free_buf(&buf);
break;
case 'D':
diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
index 26f4984..d0b7aa1 100644
--- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
+++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal.c
@@ -468,7 +468,7 @@ krb5_ldap_parse_principal_name(i_princ_name, o_princ_name)
krb5int_buf_add_len(&buf, p, 1);
}
krb5int_buf_add(&buf, at_rlm_name);
- *o_princ_name = krb5int_buf_cstr(&buf);
+ *o_princ_name = krb5int_buf_data(&buf);
if (!*o_princ_name)
return ENOMEM;
}
diff --git a/src/util/support/k5buf.c b/src/util/support/k5buf.c
index 974893d..0bdffb1 100644
--- a/src/util/support/k5buf.c
+++ b/src/util/support/k5buf.c
@@ -192,7 +192,7 @@ void krb5int_buf_truncate(struct k5buf *buf, size_t len)
}
-char *krb5int_buf_cstr(struct k5buf *buf)
+char *krb5int_buf_data(struct k5buf *buf)
{
return (buf->buftype == ERROR) ? NULL : buf->data;
}
diff --git a/src/util/support/libkrb5support-fixed.exports b/src/util/support/libkrb5support-fixed.exports
index 1b4b0a8..fef8fba 100644
--- a/src/util/support/libkrb5support-fixed.exports
+++ b/src/util/support/libkrb5support-fixed.exports
@@ -35,6 +35,6 @@ krb5int_buf_add
krb5int_buf_add_len
krb5int_buf_add_fmt
krb5int_buf_truncate
-krb5int_buf_cstr
+krb5int_buf_data
krb5int_buf_len
krb5int_free_buf
diff --git a/src/util/support/t_k5buf.c b/src/util/support/t_k5buf.c
index cfb2547..bb60db4 100644
--- a/src/util/support/t_k5buf.c
+++ b/src/util/support/t_k5buf.c
@@ -63,7 +63,7 @@ static void test_basic()
krb5int_buf_add(&buf, "Hello ");
krb5int_buf_add_len(&buf, "world", 5);
check_buf(&buf, "basic fixed");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || strcmp(s, "Hello world") != 0 || len != 11, "basic fixed");
@@ -71,7 +71,7 @@ static void test_basic()
krb5int_buf_add_len(&buf, "Hello", 5);
krb5int_buf_add(&buf, " world");
check_buf(&buf, "basic dynamic");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || strcmp(s, "Hello world") != 0 || len != 11, "basic dynamic");
krb5int_free_buf(&buf);
@@ -93,7 +93,7 @@ static void test_realloc()
krb5int_buf_add_len(&buf, data, 128);
fail_if(buf.space != 256, "realloc 1");
check_buf(&buf, "realloc 1");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || len != 138 || memcmp(s, data, len) != 0, "realloc 1");
@@ -101,7 +101,7 @@ static void test_realloc()
krb5int_buf_add_len(&buf, data, 128);
fail_if(buf.space != 512, "realloc 2");
check_buf(&buf, "realloc 2");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || len != 266 || memcmp(s, data, len) != 0, "realloc 2");
krb5int_free_buf(&buf);
@@ -112,7 +112,7 @@ static void test_realloc()
krb5int_buf_add_len(&buf, data, 256);
fail_if(buf.space != 512, "realloc 3");
check_buf(&buf, "realloc 3");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || len != 266 || memcmp(s, data, len) != 0, "realloc 3");
krb5int_free_buf(&buf);
@@ -123,7 +123,7 @@ static void test_realloc()
krb5int_buf_add_len(&buf, data, 512);
fail_if(buf.space != 1024, "realloc 4");
check_buf(&buf, "realloc 4");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || len != 522 || memcmp(s, data, len) != 0, "realloc 4");
krb5int_free_buf(&buf);
@@ -133,7 +133,7 @@ static void test_realloc()
krb5int_buf_add_len(&buf, data, 10);
krb5int_buf_add_len(&buf, NULL, SPACE_MAX);
check_buf(&buf, "realloc 5");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(buf.buftype != ERROR || s != NULL || len != -1, "realloc 5");
krb5int_free_buf(&buf);
@@ -143,7 +143,7 @@ static void test_realloc()
krb5int_buf_add_len(&buf, data, 100);
krb5int_buf_add_len(&buf, NULL, SPACE_MAX * 2);
check_buf(&buf, "realloc 6");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(buf.buftype != ERROR || s != NULL || len != -1, "realloc 6");
krb5int_free_buf(&buf);
@@ -160,7 +160,7 @@ static void test_overflow()
krb5int_buf_add(&buf, "12345");
krb5int_buf_add(&buf, "12345");
check_buf(&buf, "overflow 1");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(buf.buftype != ERROR || s != NULL || len != -1, "overflow 1");
@@ -169,7 +169,7 @@ static void test_overflow()
krb5int_buf_add(&buf, "12345");
krb5int_buf_add_len(&buf, NULL, SPACE_MAX * 2);
check_buf(&buf, "overflow 2");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(buf.buftype != ERROR || s != NULL || len != -1, "overflow 2");
}
@@ -204,7 +204,7 @@ static void test_truncate()
krb5int_buf_add(&buf, "fghij");
krb5int_buf_truncate(&buf, 7);
check_buf(&buf, "truncate");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || len != 7 || strcmp(s, "abcdefg") != 0, "truncate");
krb5int_free_buf(&buf);
@@ -220,7 +220,7 @@ static void test_binary()
krb5int_buf_add_len(&buf, data, 3);
krb5int_buf_add_len(&buf, data, 3);
check_buf(&buf, "binary");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || len != 6, "binary");
fail_if(s[0] != 'a' || s[1] != 0 || s[2] != 'b', "binary");
@@ -244,14 +244,14 @@ static void test_fmt()
krb5int_buf_add(&buf, "foo");
krb5int_buf_add_fmt(&buf, " %d ", 3);
check_buf(&buf, "fmt 1");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || len != 6 || strcmp(s, "foo 3 ") != 0, "fmt 1");
/* Overflow the same buffer with formatted text. */
krb5int_buf_add_fmt(&buf, "%d%d%d%d", 1, 2, 3, 4);
check_buf(&buf, "fmt 2");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(buf.buftype != ERROR || s != NULL || len != -1, "fmt 2");
@@ -260,7 +260,7 @@ static void test_fmt()
krb5int_buf_add(&buf, "foo");
krb5int_buf_add_fmt(&buf, " %d ", 3);
check_buf(&buf, "fmt 3");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || len != 6 || strcmp(s, "foo 3 ") != 0, "fmt 3");
@@ -268,7 +268,7 @@ static void test_fmt()
krb5int_buf_add_fmt(&buf, "%s", data);
check_buf(&buf, "fmt 4");
fail_if(buf.space != 2048, "fmt 4");
- s = krb5int_buf_cstr(&buf);
+ s = krb5int_buf_data(&buf);
len = krb5int_buf_len(&buf);
fail_if(!s || len != 1029 || strcmp(s + 6, data) != 0, "fmt 4");
krb5int_free_buf(&buf);