"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "source3/libads/ldap.c" between
samba-4.12.3.tar.gz and samba-4.12.5.tar.gz

About: Samba is the standard Windows interoperability suite of programs for Linux and Unix providing secure, stable and fast file and print services for all clients using the SMB/CIFS protocol. 4.12 series.

ldap.c  (samba-4.12.3):ldap.c  (samba-4.12.5)
skipping to change at line 1374 skipping to change at line 1374
/* This is how Windows checks for machine accounts */ /* This is how Windows checks for machine accounts */
"objectClass", "objectClass",
"SamAccountName", "SamAccountName",
"userAccountControl", "userAccountControl",
"DnsHostName", "DnsHostName",
"ServicePrincipalName", "ServicePrincipalName",
"userPrincipalName", "userPrincipalName",
"unicodePwd", "unicodePwd",
/* Additional attributes Samba checks */ /* Additional attributes Samba checks */
"msDS-AdditionalDnsHostName",
"msDS-SupportedEncryptionTypes", "msDS-SupportedEncryptionTypes",
"nTSecurityDescriptor", "nTSecurityDescriptor",
NULL NULL
}; };
TALLOC_CTX *frame = talloc_stackframe(); TALLOC_CTX *frame = talloc_stackframe();
*res = NULL; *res = NULL;
/* the easiest way to find a machine account anywhere in the tree /* the easiest way to find a machine account anywhere in the tree
skipping to change at line 3659 skipping to change at line 3660
out: out:
ads_msgfree(ads, res); ads_msgfree(ads, res);
return name; return name;
} }
/******************************************************************** /********************************************************************
********************************************************************/ ********************************************************************/
static char **get_addl_hosts(ADS_STRUCT *ads, TALLOC_CTX *mem_ctx,
LDAPMessage *msg, size_t *num_values)
{
const char *field = "msDS-AdditionalDnsHostName";
struct berval **values = NULL;
char **ret = NULL;
size_t i, converted_size;
values = ldap_get_values_len(ads->ldap.ld, msg, field);
if (values == NULL) {
return NULL;
}
*num_values = ldap_count_values_len(values);
ret = talloc_array(mem_ctx, char *, *num_values + 1);
if (ret == NULL) {
ldap_value_free_len(values);
return NULL;
}
for (i = 0; i < *num_values; i++) {
ret[i] = NULL;
if (!convert_string_talloc(mem_ctx, CH_UTF8, CH_UNIX,
values[i]->bv_val,
strnlen(values[i]->bv_val,
values[i]->bv_len),
&ret[i], &converted_size)) {
ldap_value_free_len(values);
return NULL;
}
}
ret[i] = NULL;
ldap_value_free_len(values);
return ret;
}
ADS_STATUS ads_get_additional_dns_hostnames(TALLOC_CTX *mem_ctx,
ADS_STRUCT *ads,
const char *machine_name,
char ***hostnames_array,
size_t *num_hostnames)
{
ADS_STATUS status;
LDAPMessage *res = NULL;
int count;
status = ads_find_machine_acct(ads,
&res,
machine_name);
if (!ADS_ERR_OK(status)) {
DEBUG(1,("Host Account for %s not found... skipping operation.\n"
,
machine_name));
return status;
}
count = ads_count_replies(ads, res);
if (count != 1) {
status = ADS_ERROR(LDAP_NO_SUCH_OBJECT);
goto done;
}
*hostnames_array = get_addl_hosts(ads, mem_ctx, res, num_hostnames);
if (*hostnames_array == NULL) {
DEBUG(1, ("Host account for %s does not have msDS-AdditionalDnsHo
stName.\n",
machine_name));
status = ADS_ERROR(LDAP_NO_SUCH_OBJECT);
goto done;
}
done:
ads_msgfree(ads, res);
return status;
}
/********************************************************************
********************************************************************/
char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name ) char* ads_get_upn( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name )
{ {
LDAPMessage *res = NULL; LDAPMessage *res = NULL;
ADS_STATUS status; ADS_STATUS status;
int count = 0; int count = 0;
char *name = NULL; char *name = NULL;
status = ads_find_machine_acct(ads, &res, machine_name); status = ads_find_machine_acct(ads, &res, machine_name);
if (!ADS_ERR_OK(status)) { if (!ADS_ERR_OK(status)) {
DEBUG(0,("ads_get_upn: Failed to find account for %s\n", DEBUG(0,("ads_get_upn: Failed to find account for %s\n",
 End of changes. 2 change blocks. 
0 lines changed or deleted 83 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)