diff options
author | Noel Power <noel.power@suse.com> | 2018-01-12 14:22:34 +0000 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-03-02 14:07:14 +0100 |
commit | d9593803eadb9a3d4ee4448a2b39ffdd056b68af (patch) | |
tree | 21ac9449ce7c43182c730b2c37c509987eb0f6f6 /source3/libads/ldap.c | |
parent | 2dd94e41f6e76b4cbbeb1704778a8c27b6eb35f4 (diff) | |
download | samba-d9593803eadb9a3d4ee4448a2b39ffdd056b68af.tar.gz |
s3:libads: Clean up code a little rename 'ads_get_samaccountname()'
Function 'ads_get_samaccountname()' basically returns the machine_name passed
as an input param (appended with '$') if it exists on the ad. The function
really is testing for the existence of the samaccountname and is not really
'getting' it. This is also the way it is used. Renaming this function to
'ads_has_samaccountname()' better reflects what it is actually doing and how
clients calling the code use it. It also makes the client code using calling
this function less confusing.
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/libads/ldap.c')
-rw-r--r-- | source3/libads/ldap.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 4f238ef83c2..2acbb3aca11 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -3463,12 +3463,13 @@ out: /******************************************************************** ********************************************************************/ -char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name ) +bool ads_has_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *machine_name ) { LDAPMessage *res = NULL; ADS_STATUS status; int count = 0; char *name = NULL; + bool ok = false; status = ads_find_machine_acct(ads, &res, machine_name); if (!ADS_ERR_OK(status)) { @@ -3488,8 +3489,10 @@ char* ads_get_samaccountname( ADS_STRUCT *ads, TALLOC_CTX *ctx, const char *mach out: ads_msgfree(ads, res); - - return name; + if (name != NULL) { + ok = (strlen(name) > 0); + } + return ok; } #if 0 |