mirror of
https://github.com/samba-team/samba.git
synced 2025-02-08 05:57:51 +03:00
s3:libads: Use a talloc_asprintf in ads_find_machine_acct()
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> (cherry picked from commit 35f3e4aed1f1c2ba1c8dc50921f238937f343357)
This commit is contained in:
parent
ddd4a6af62
commit
60c5d1d3de
@ -1367,18 +1367,22 @@ char *ads_parent_dn(const char *dn)
|
||||
ADS_STATUS status;
|
||||
char *expr;
|
||||
const char *attrs[] = {"*", "msDS-SupportedEncryptionTypes", "nTSecurityDescriptor", NULL};
|
||||
TALLOC_CTX *frame = talloc_stackframe();
|
||||
|
||||
*res = NULL;
|
||||
|
||||
/* the easiest way to find a machine account anywhere in the tree
|
||||
is to look for hostname$ */
|
||||
if (asprintf(&expr, "(samAccountName=%s$)", machine) == -1) {
|
||||
DEBUG(1, ("asprintf failed!\n"));
|
||||
return ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
|
||||
expr = talloc_asprintf(frame, "(samAccountName=%s$)", machine);
|
||||
if (expr == NULL) {
|
||||
status = ADS_ERROR_NT(NT_STATUS_NO_MEMORY);
|
||||
goto done;
|
||||
}
|
||||
|
||||
status = ads_search(ads, res, expr, attrs);
|
||||
SAFE_FREE(expr);
|
||||
|
||||
done:
|
||||
TALLOC_FREE(frame);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user