cli_credentials: add a helper to parse user or group names
commit00f4262ed0b22f6e333e5a29c5590b62c783905c
authorAlexander Bokovoy <ab@samba.org>
Wed, 4 Nov 2020 12:00:58 +0000 (4 14:00 +0200)
committerAlexander Bokovoy <ab@samba.org>
Wed, 4 Nov 2020 14:59:34 +0000 (4 14:59 +0000)
treeb37e0a17d2d84f02fbc71b5399bdd0107552b0eb
parenteb0474d27bae4592b25ac6bf600da29c6a1cb9f8
cli_credentials: add a helper to parse user or group names

cli_credentials_parse_string() parses a string specified for -U option
in command line tools. It has a side-effect that '%' character is always
considered to be a separator after which a password is specified.

Active Directory does allow to create user or group objects with '%' in
the name. It means cli_credentials_parse_string() will not be able to
properly parse such name.

Introduce cli_credentials_parse_name() for the cases when a password is
not expected in the name and call to cli_credentials_parse_name() from
cli_credentials_parse_string().

Test cli_credentials_parse_name() with its intended use in lookup_name()
refactoring.

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
auth/credentials/credentials.c
auth/credentials/credentials.h
auth/credentials/tests/test_creds.c