/*
SSSD
Library for rule based certificate to user mapping - Attribute name
mapping for different implementations
Authors:
Sumit Bose <sbose@redhat.com>
Copyright (C) 2017 Red Hat
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* AD data taken from
* and wine source code dlls/crypt32/oid.c and include/wincrypt.h . */
#include <stdbool.h>
#include <string.h>
#include <talloc.h>
struct oid_attr_name_map {
bool nss_ad_differ;
bool nss_openssl_differ;
const char *oid;
const char *nss;
const char *ad;
const char *openssl;
} oid_attr_name_map[] = {
{ false, false, "2.5.4.3", "CN", "CN", "CN"},
{ true, false, "2.5.4.8", "ST", "S", "ST"},
{ false, false, "2.5.4.10", "O", "O", "O"},
{ false, false, "2.5.4.11", "OU", "OU", "OU"},
{ false, false, "2.5.4.46", "dnQualifier", "dnQualifier", "dnQualifier"},
{ false, false, "2.5.4.6", "C", "C", "C"},
{ true, false, "2.5.4.5", "serialNumber", "SERIALNUMBER", "serialNumber"},
{ false, false, "2.5.4.7", "L", "L", "L"},
{ true, false, "2.5.4.12", "title", "T", "title"},
{ false, false, "2.5.4.4", "SN", "SN", "SN"},
{ true, true, "2.5.4.42", "givenName", "G", "GN"},
{ true, false, "2.5.4.43", "initials", "I", "initials"},
{ true, false, "2.5.4.44", "generationQualifier", "OID.2.5.4.44", "generationQualifier"},
{ false, false, "0.9.2342.19200300.100.1.25", "DC", "DC", "DC"},
{ true, true, "0.9.2342.19200300.100.1.3", "MAIL", "OID,0.9.2342.19200300.100.1.3", "mail"},
{ true, false, "0.9.2342.19200300.100.1.1", "UID", "OID.0.9.2342.19200300.100.1.1", "UID"},
{ true, true, "2.5.4.13", "OID.2.5.4.13", "Description", "description"},
{ true, false, "2.5.4.16", "postalAddress", "OID.2.5.4.16", "postalAddress"},
{ true, false, "2.5.4.17", "postalCode", "PostalCode", "postalCode"},
{ true, false, "2.5.4.18", "postOfficeBox", "POBox", "postOfficeBox"},
{ true, false, "2.5.4.51", "houseIdentifier", "OID.2.5.4.51", "houseIdentifier"},
{ false, true, "1.2.840.113549.1.9.1", "E", "E", "emailAddress"},
{ false, true, "2.5.4.9", "STREET", "STREET", "street"},
{ true, false, "2.5.4.65", "pseudonym", "OID.2.5.4.65", "pseudonym"},
{ true, false, "2.5.4.15", "businessCategory", "OID.2.5.4.15", "businessCategory"},
{ true, false, "2.5.4.41", "name", "OID.2.5.4.41", "name"},
};
{
char *p;
size_t c;
return NULL;
}
if (p == NULL) {
return NULL;
}
if (len == 0) {
return NULL;
}
if (!oid_attr_name_map[c].nss_ad_differ) {
continue;
}
continue;
}
}
return NULL;
}
{
size_t c;
return NULL;
}
if (!oid_attr_name_map[c].nss_openssl_differ) {
continue;
}
continue;
}
return oid_attr_name_map[c].nss;
}
return attr;
}