*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.164 2008/02/08 17:58:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.165 2008/07/24 17:51:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
}
/*
- * Crack the LDAP url. We do a very trivial parse..
+ * Crack the LDAP url. We do a very trivial parse:
+ *
* ldap[s]://<server>[:<port>]/<basedn>[;prefix[;suffix]]
+ *
+ * This code originally used "%127s" for the suffix, but that doesn't
+ * work for embedded whitespace. We know that tokens formed by
+ * hba.c won't include newlines, so we can use a "not newline" scanset
+ * instead.
*/
server[0] = '\0';
/* ldap, including port number */
r = sscanf(port->auth_arg,
- "ldap://%127[^:]:%d/%127[^;];%127[^;];%127s",
+ "ldap://%127[^:]:%d/%127[^;];%127[^;];%127[^\n]",
server, &ldapport, basedn, prefix, suffix);
if (r < 3)
{
/* ldaps, including port number */
r = sscanf(port->auth_arg,
- "ldaps://%127[^:]:%d/%127[^;];%127[^;];%127s",
+ "ldaps://%127[^:]:%d/%127[^;];%127[^;];%127[^\n]",
server, &ldapport, basedn, prefix, suffix);
if (r >= 3)
ssl = true;
{
/* ldap, no port number */
r = sscanf(port->auth_arg,
- "ldap://%127[^/]/%127[^;];%127[^;];%127s",
+ "ldap://%127[^/]/%127[^;];%127[^;];%127[^\n]",
server, basedn, prefix, suffix);
}
if (r < 2)
{
/* ldaps, no port number */
r = sscanf(port->auth_arg,
- "ldaps://%127[^/]/%127[^;];%127[^;];%127s",
+ "ldaps://%127[^/]/%127[^;];%127[^;];%127[^\n]",
server, basedn, prefix, suffix);
if (r >= 2)
ssl = true;