svn rev #22513: trunk/src/ lib/kadm5/srv/ plugins/preauth/pkinit/
ghudson@MIT.EDU
ghudson at MIT.EDU
Mon Aug 10 01:02:44 EDT 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=22513
Commit By: ghudson
Log Message:
Convert all uses of strtok() in libraries to strtok_r() for thread
safety.
Changed Files:
U trunk/src/lib/kadm5/srv/server_acl.c
U trunk/src/plugins/preauth/pkinit/pkinit_identity.c
Modified: trunk/src/lib/kadm5/srv/server_acl.c
===================================================================
--- trunk/src/lib/kadm5/srv/server_acl.c 2009-08-10 04:42:44 UTC (rev 22512)
+++ trunk/src/lib/kadm5/srv/server_acl.c 2009-08-10 05:02:43 UTC (rev 22513)
@@ -282,7 +282,7 @@
char *s;
restriction_t **rpp;
{
- char *sp = NULL, *tp, *ap;
+ char *sp = NULL, *tp, *ap, *save;
static const char *delims = "\t\n\f\v\r ,";
krb5_deltat dt;
krb5_flags flag;
@@ -299,7 +299,8 @@
code = ENOMEM;
} else {
memset(*rpp, 0, sizeof(**rpp));
- for (tp=strtok(sp, delims); tp; tp=strtok((char *)NULL, delims)) {
+ for (tp = strtok_r(sp, delims, &save); tp;
+ tp = strtok_r(NULL, delims, &save)) {
flag = 0;
if (!krb5_string_to_flags(tp, "+", "-", &flag)) {
/* OK, but was it in the positive or negative sense? */
@@ -315,7 +316,7 @@
(*rpp)->mask |= KADM5_POLICY_CLR;
} else {
/* everything else needs an argument ... */
- if (!(ap = strtok((char *)NULL, delims))) {
+ if (!(ap = strtok_r(NULL, delims, &save))) {
code = EINVAL;
break;
}
Modified: trunk/src/plugins/preauth/pkinit/pkinit_identity.c
===================================================================
--- trunk/src/plugins/preauth/pkinit/pkinit_identity.c 2009-08-10 04:42:44 UTC (rev 22512)
+++ trunk/src/plugins/preauth/pkinit/pkinit_identity.c 2009-08-10 05:02:43 UTC (rev 22513)
@@ -261,7 +261,7 @@
pkinit_identity_opts *idopts,
const char *residual)
{
- char *s, *cp, *vp;
+ char *s, *cp, *vp, *save;
krb5_error_code retval = ENOMEM;
if (residual == NULL || residual[0] == '\0')
@@ -272,7 +272,7 @@
if (s == NULL)
return retval;
- for ((cp = strtok(s, ":")); cp; (cp = strtok(NULL, ":"))) {
+ for (cp = strtok_r(s, ":", &save); cp; cp = strtok_r(NULL, ":", &save)) {
vp = strchr(cp, '=');
/* If there is no "=", this is a pkcs11 module name */
@@ -334,7 +334,7 @@
pkinit_identity_opts *idopts,
const char *residual)
{
- char *certname, *keyname;
+ char *certname, *keyname, *save;
krb5_error_code retval = ENOMEM;
if (residual == NULL || residual[0] == '\0')
@@ -344,8 +344,8 @@
if (certname == NULL)
goto cleanup;
- certname = strtok(certname, ",");
- keyname = strtok(NULL, ",");
+ certname = strtok_r(certname, ",", &save);
+ keyname = strtok_r(NULL, ",", &save);
idopts->cert_filename = strdup(certname);
if (idopts->cert_filename == NULL)
More information about the cvs-krb5
mailing list