diff options
author | Martijn van Duren <martijn@cvs.openbsd.org> | 2018-11-06 14:14:13 +0000 |
---|---|---|
committer | Martijn van Duren <martijn@cvs.openbsd.org> | 2018-11-06 14:14:13 +0000 |
commit | 0eb1f5735cc1d9eb6ac470444c156dcc46846df7 (patch) | |
tree | 03ca7d36f6ab214784d0608e923bee17797b4aee /usr.bin/ldap | |
parent | 982ec6ae96e3dd9c308ab1c4734f33d46f90ff0f (diff) |
Implement SAFE-INIT-CHAR.
OK claudio@
Diffstat (limited to 'usr.bin/ldap')
-rw-r--r-- | usr.bin/ldap/ldapclient.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/ldap/ldapclient.c b/usr.bin/ldap/ldapclient.c index 3a71d5a37b3..98c98085773 100644 --- a/usr.bin/ldap/ldapclient.c +++ b/usr.bin/ldap/ldapclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ldapclient.c,v 1.5 2018/10/23 08:28:34 martijn Exp $ */ +/* $OpenBSD: ldapclient.c,v 1.6 2018/11/06 14:14:12 martijn Exp $ */ /* * Copyright (c) 2018 Reyk Floeter <reyk@openbsd.org> @@ -404,8 +404,13 @@ ldapc_printattr(struct ldapc *ldap, const char *key, const char *value) * in SAFE-STRINGs. String value that do not match the * criteria must be encoded as Base64. */ - for (cp = (const unsigned char *)value; - encode == 0 &&*cp != '\0'; cp++) { + cp = (const unsigned char *)value; + /* !SAFE-INIT-CHAR: SAFE-CHAR minus %x20 %x3A %x3C */ + if (*cp == ' ' || + *cp == ':' || + *cp == '<') + encode = 1; + for (; encode == 0 &&*cp != '\0'; cp++) { /* !SAFE-CHAR %x01-09 / %x0B-0C / %x0E-7F */ if (*cp > 127 || *cp == '\0' || |